The problem I have is that jsf tags are not being parsed, so I'm not seeing richfaces components in my pages. I'm using richfaces 4, tomcat 7, and jsf 2.0
This is my faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
</faces-config>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>bisis-please-work</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<description>
This parameter tells MyFaces if javascript code should be allowed in
the rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default is 'true'</description>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>
If true, rendered HTML code will be formatted, so that it is 'human-readable'
i.e. additional line separators and whitespace will be written, that do not
influence the HTML code.
Default is 'true'</description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>
If true, a javascript function will be rendered that is able to restore the
former vertical scroll on every request. Convenient feature if you have pages
with long lists and you do not want the browser page to always jump to the top
if you trigger a link or button action that stays on the same page.
Default is 'false'
</description>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
</web-app>
And this is what I get when starting Tomcat 7
Nov 7, 2011 1:33:45 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_25\bin;D:\svn\My\GAE\_sdk_python\;C:\Users\Brankica\Desktop\eclipse;;.
Nov 7, 2011 1:33:46 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:bisis-please-work' did not find a matching property.
Nov 7, 2011 1:33:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Nov 7, 2011 1:33:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Nov 7, 2011 1:33:46 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1896 ms
Nov 7, 2011 1:33:46 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 7, 2011 1:33:46 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.22
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsf/core is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsf/html is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "org.apache.myfaces.webapp.StartupServletContextListener" is already configured for this context. The duplicate definition has been ignored.
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS' found, using default value true
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_VIEWSTATE_ID' found, using default value true
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.STRICT_XHTML_LINKS' found, using default value true
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_FORM_SUBMIT_SCRIPT_INLINE' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getLongInitParameter
INFO: No context init parameter 'org.apache.myfaces.CONFIG_REFRESH_PERIOD' found, using default value 2
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.VIEWSTATE_JAVASCRIPT' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getStringInitParameter
INFO: No context init parameter 'org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS' found, using default value auto
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.VALIDATE_XML' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG' found, using default value true
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.DEBUG_PHASE_LISTENER' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig createAndInitializeMyFacesConfig
INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
Nov 7, 2011 1:33:58 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getStandardFacesConfig
INFO: Reading standard config META-INF/standard-faces-config.xml
Nov 7, 2011 1:33:58 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getWebAppFacesConfig
INFO: Reading config /WEB-INF/faces-config.xml
Nov 7, 2011 1:33:58 AM org.apache.myfaces.config.annotation.DefaultAnnotationProvider webClasses
WARNING: AnnotationConfigurator does not found classes for annotations in /WEB-INF/classes/ . This could happen because maven jetty plugin is used (goal jetty:run). Try configure org.apache.myfaces.annotation.SCAN_PACKAGES init parameter or use jetty:run-exploded instead.
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getClassloaderFacesConfig
INFO: Reading config : jar:file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/richfaces-components-ui-4.0.0.Final.jar!/META-INF/faces-config.xml
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getClassloaderFacesConfig
INFO: Reading config : jar:file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/richfaces-core-impl-4.0.0.Final.jar!/META-INF/faces-config.xml
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-api' was found in version '2.1.3' from path 'file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/myfaces-api-2.1.3.jar'
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-bundle' was found in version '2.1.3' from path 'file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/myfaces-bundle-2.1.3.jar'
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-impl' was found in version '2.1.3' from path 'file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/myfaces-impl-2.1.3.jar'
Nov 7, 2011 1:34:00 AM org.apache.myfaces.util.ExternalSpecifications isBeanValidationAvailable
INFO: MyFaces Bean Validation support disabled
Nov 7, 2011 1:34:00 AM org.apache.myfaces.application.ApplicationImpl getProjectStage
INFO: Couldn't discover the current project stage, using Production
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.FacesConfigurator handleSerialFactory
INFO: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory getLifecycleProvider
INFO: Using LifecycleProvider org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider
Nov 7, 2011 1:34:01 AM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
INFO: ServletContext 'D:\informaticki projekat\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\bisis-please-work\' initialized.
Nov 7, 2011 1:34:01 AM org.richfaces.javascript.ClientServiceConfigParser parse
WARNING: Found JavaScript function definition for class org.hibernate.validator.constraints.NotEmpty, but that class is not presented
Nov 7, 2011 1:34:01 AM org.richfaces.cache.CacheManager getCacheFactory
INFO: Selected fallback cache factory
Nov 7, 2011 1:34:01 AM org.richfaces.cache.lru.LRUMapCacheFactory createCache
INFO: Creating LRUMap cache instance using parameters: {org.apache.myfaces.DETECT_JAVASCRIPT=false, org.apache.myfaces.PRETTY_HTML=true, org.apache.myfaces.AUTO_SCROLL=true, org.apache.myfaces.ALLOW_JAVASCRIPT=true, javax.servlet.jsp.jstl.fmt.localizationContext=resources.application, javax.faces.STATE_SAVING_METHOD=client}
Nov 7, 2011 1:34:01 AM org.richfaces.cache.lru.LRUMapCacheFactory createCache
INFO: Creating LRUMap cache instance of 512 items capacity
Nov 7, 2011 1:34:01 AM org.richfaces.application.InitializationListener onStart
INFO: RichFaces Core Implementation by JBoss, a division of Red Hat, Inc., version v.4.0.0.Final SVN r.22269
Nov 7, 2011 1:34:01 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 7, 2011 1:34:02 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Nov 7, 2011 1:34:02 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 15218 ms
Example I use for testing (the source code I get from browser is identical):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich">
<f:view contentType="text/html">
<h:head>
<title>Calendar</title>
</h:head>
<h:body>
<rich:calendar datePattern="dd/MM/yyyy hh:mm:ss" />
</h:body>
If anyone has some suggestions, please write.. Thanks in advance
the source code I get from browser is identical
In other words, the FacesServlet wasn't called and was therefore not able to do its job. That can only mean that the request URL did not match the URL pattern of the FacesServlet as definied in web.xml. Perhaps you opened the page by http://localhost:8080/bisis-please-work/somepage.xhtml instead of by http://localhost:8080/bisis-please-work/somepage.jsf which would match <url-pattern>*.jsf</url-pattern> as you've definied in web.xml.
Alternatively, you can also replace *.jsf by *.xhtml so that you don't need to fiddle with URLs anymore and also don't need to worry about the client being able to see the raw JSF source code. The only disadvantage is that you won't be able to serve "plain vanilla" XHTML files without invoking the FacesServlet, but that shouldn't matter, those files should have the .html extension anyway.
I had the same problem, but with a different root cause. For me, richfaces components, in particular the rich:tabPanel, were not rendering because there were plain html tags in the page.
<head>...</head>
instead of
<h:head>...</h:head>
caused the rich:tabPanel to not display at all.
Using plain html body tags caused the tabs to render, but not be clickable.
Related
I just started with this Struts 2 HelloWorld Tutorial [1] and exactly followed the steps explained in this tutorial but there is a problem with starting the filters. Here is the console output:
[1] https://www.tutorialspoint.com/struts_2/struts_examples.htm
Jun 06, 2017 4:53:35 PM org.apache.catalina.core.AprLifecycleListener init
INFORMATION: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_112\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_131/bin/server;C:/Program Files/Java/jre1.8.0_131/bin;C:/Program Files/Java/jre1.8.0_131/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Enterprise Vault\EVClient\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\eclipse;;.
Jun 06, 2017 4:53:35 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNUNG: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:HelloWorldStruts2' did not find a matching property.
Jun 06, 2017 4:53:36 PM org.apache.coyote.AbstractProtocol init
INFORMATION: Initializing ProtocolHandler ["http-bio-18080"]
Jun 06, 2017 4:53:36 PM org.apache.catalina.startup.Catalina load
INFORMATION: Initialization processed in 428 ms
Jun 06, 2017 4:53:36 PM org.apache.catalina.core.StandardService startInternal
INFORMATION: Starting service Catalina
Jun 06, 2017 4:53:36 PM org.apache.catalina.core.StandardEngine startInternal
INFORMATION: Starting Servlet Engine: Apache Tomcat/7.0.52
Jun 06, 2017 4:53:39 PM org.apache.catalina.startup.TaglibUriRule body
INFORMATION: TLD skipped. URI: /struts-tags is already defined
Jun 06, 2017 4:53:39 PM org.apache.catalina.core.ApplicationContext log
INFORMATION: No Spring WebApplicationInitializer types detected on classpath
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
Jun 06, 2017 4:53:39 PM org.apache.catalina.core.StandardContext filterStart
SCHWERWIEGEND: Exception starting filter struts2
java.lang.reflect.InvocationTargetException - Class: com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector
File: ContainerImpl.java
Method: construct
Line: 427 - com/opensymphony/xwork2/inject/ContainerImpl.java:427:-1
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:450)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:427)
at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:218)
at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:52)
at com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:91)
at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:571)
at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:568)
at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:560)
at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:568)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:278)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:160)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
... 14 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:410)
... 26 more
Caused by: java.lang.NoSuchMethodError: org.apache.commons.lang3.text.StrSubstitutor.setValueDelimiter(Ljava/lang/String;)Lorg/apache/commons/lang3/text/StrSubstitutor;
at com.opensymphony.xwork2.config.providers.EnvsValueSubstitutor.<init>(EnvsValueSubstitutor.java:32)
... 31 more
Jun 06, 2017 4:53:39 PM org.apache.catalina.core.StandardContext startInternal
SCHWERWIEGEND: Error filterStart
Jun 06, 2017 4:53:39 PM org.apache.catalina.core.StandardContext startInternal
SCHWERWIEGEND: Context [/HelloWorldStruts2] startup failed due to previous errors
Jun 06, 2017 4:53:39 PM org.apache.coyote.AbstractProtocol start
INFORMATION: Starting ProtocolHandler ["http-bio-18080"]
Jun 06, 2017 4:53:39 PM org.apache.catalina.startup.Catalina start
INFORMATION: Server startup in 3183 ms
I think there is no need to paste my code here as it is exactly the code as stated in the tutorial link above. Except I replaced
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
with
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
as proposed in this answer, which did not resolve the issue: java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher
I am using struts 2.3.4, but tried it also with struts 2.2 and 2.5 - neither works.
I found the flaw: I have left the struts 2.5 jars in the "Deployment Assembly", since some other post proposed this when it showed some other exception. I removed them and booom.. now it works. Thanks, Aleksandr!
I'm new to struts2. I'm try to apply spring security on my struts2 application. I'm following this link.I'm getting this error. Help please. Thanks.
my web.xml is
`<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Archetype Created Web Application</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>`
and my applicationcontext-security.xml is
`<beans:beans xmlns="http://www.springframework.org
/schema/security"
xmlns:beans="http://www.springframework.org
/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org
/schema/beans
http://www.springframework.org/schema/beans/spring-
beans-4.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-
security-4.0.xsd">
<global-method-security pre-post-annotations="enabled">
<!-- AspectJ pointcut expression that locates our "post" method and applies
security that way <protect-pointcut expression="execution(* bigbank.*Service.post*(..))"
access="ROLE_TELLER"/> -->
</global-method-security>
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/welcome" access="hasRole('ROLE_USER')" />
<form-login login-page="/login" default-target-url="/welcome"
authentication-failure-url="/loginfailed?error=true" />
<logout />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="anjana" password="packt123" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>`
and my struts.xml is `
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" namespace="/" extends="struts-default">
<action name="helloWorld">
<result>success.jsp</result>
</action>
<action name="login">
<result>login.jsp</result>
</action>
<action name="loginfailed">
<result>login.jsp?error=true</result>
</action>
<action name="welcome">
<result>index.jsp</result>
</action>
</package>
</struts>
console message is
Nov 04, 2015 12:05:00 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:Spring_Security_Struts2' did not find a matching property.
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.26
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Aug 18 2015 11:38:37 UTC
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.26.0
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk1.8.0_60\jre
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_60-b27
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\jalagarip\Documents\GitHub\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Users\jalagarip\tomcat\apache-tomcat-8.0.26
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\jalagarip\Documents\GitHub\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\jalagarip\tomcat\apache-tomcat-8.0.26
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\jalagarip\Documents\GitHub\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\jalagarip\tomcat\apache-tomcat-8.0.26\endorsed
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Nov 04, 2015 12:05:00 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_60\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_65/bin/server;C:/Program Files/Java/jre1.8.0_65/bin;C:/Program Files/Java/jre1.8.0_65/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\app\jalagarip\product\11.2.0\dbhome_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\jalagarip\curl;C:\Program Files\cURL\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Apache Software Foundation\apache-maven-3.3.3\bin;C:\Program Files\Java\jdk1.8.0_60\bin;C:\Program Files\Java\jre1.8.0_60\bin;;C:\Users\jalagarip\Desktop;;.
Nov 04, 2015 12:05:00 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Nov 04, 2015 12:05:00 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Nov 04, 2015 12:05:00 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Nov 04, 2015 12:05:00 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Nov 04, 2015 12:05:00 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1025 ms
Nov 04, 2015 12:05:00 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 04, 2015 12:05:00 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.26
Nov 04, 2015 12:05:03 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Nov 04, 2015 12:05:04 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Nov 04, 2015 12:05:04 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Nov 04, 2015 12:05:04 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Nov 04, 2015 12:05:04 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Wed Nov 04 12:05:04 IST 2015]; root of context hierarchy
Nov 04, 2015 12:05:04 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
Nov 04, 2015 12:05:04 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:605)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:509)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
... 21 more
Nov 04, 2015 12:05:04 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:605)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:509)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
... 21 more
Nov 04, 2015 12:05:04 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Nov 04, 2015 12:05:04 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/Spring_Security_Struts2] startup failed due to previous errors
Nov 04, 2015 12:05:04 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Nov 04, 2015 12:05:04 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
INFO: Closing Root WebApplicationContext: startup date [Wed Nov 04 12:05:04 IST 2015]; root of context hierarchy
Nov 04, 2015 12:05:04 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
WARNING: Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Wed Nov 04 12:05:04 IST 2015]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:414)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:969)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:928)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:583)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4776)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5390)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Nov 04, 2015 12:05:04 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1000)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:976)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:928)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:583)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4776)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5390)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Nov 04, 2015 12:05:04 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Nov 04, 2015 12:05:04 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Nov 04, 2015 12:05:04 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3788 ms
`
The Problem was with the name of the configuration file as I followed that link.
The name used was different at different places in that link.Thanks.
Could you help me solve this problem. When I was trying to program the simple Struts2 HelloWorld program. It always has this error:The requested resource () is not available. Could you help me solve it?Thank you!
JSP File
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
hello world
</body>
</html>
This is HelloWorld.java
package com.test.action;
public class HelloWorld {
public String execute()throws Exception
{
return "success";
}
}
struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="struts2" extends="struts-default">
<action name="helloworld" class="com.test.action.HelloWorld">
<result name="success">/helloworld.jsp</result>
</action>
</package>
</struts>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Exception
Nov 30, 2012 11:07:54 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Nov 30, 2012 11:07:54 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:test' did not find a matching property.
Nov 30, 2012 11:07:54 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Hibernate' did not find a matching property.
Nov 30, 2012 11:07:54 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:struts2' did not find a matching property.
Nov 30, 2012 11:07:54 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Nov 30, 2012 11:07:54 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1232 ms
Nov 30, 2012 11:07:54 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Nov 30, 2012 11:07:54 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Nov 30, 2012 11:07:55 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Nov 30, 2012 11:07:55 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Nov 30, 2012 11:07:55 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/struts2] startup failed due to previous errors
Nov 30, 2012 11:07:55 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Nov 30, 2012 11:07:55 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 30, 2012 11:07:55 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/64 config=null
Nov 30, 2012 11:07:55 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 821 ms
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher<filter-class> and remove the unwanted jar files.you keep only the following jar files in in lib folder
commons-logging-1.0.4.jar
freemarker-2.3.8.jar
ognl-2.6.11.jar
struts2-core-2.0.11.jar
xwork-2.0.4.jar.
Regards,
Nag kamma.
I'm trying to learn the Struts2 framework.
I got the HelloWorld example form the site:
`www.vaannila.com/struts/struts-tutorial/struts-tutorial-using-eclipse-1.html
The highlighted code is shown as a warning:
<%#taglib uri="/struts-tags" prefix="s" %>
s:redirect forward="helloWorld"/>
Th warning is given below:
Multiple annotations found at this line:
- Unknown tag (bean:write).
- Unknown tag (bean:write).
I get the same warning in my index.jsp file for the code:
and when i run the tomcat, I get the following in my console. I know my tomcat is running but how do i rectify this?
Jun 13, 2012 1:12:28 PM org.apache.catalina.core.AprLifecycleListener init
**INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32;**
**Jun 13, 2012 1:12:28 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:StrutsExample1' did not find a matching property.**
Jun 13, 2012 1:12:28 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 13, 2012 1:12:28 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 13, 2012 1:12:28 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 735 ms
Jun 13, 2012 1:12:28 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 13, 2012 1:12:28 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.27
Jun 13, 2012 1:12:31 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 13, 2012 1:12:31 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 13, 2012 1:12:31 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2586 ms
<bean:write> is struts 1.x you have to use <s:property> in struts 2.x.
See s:property documentation
I have a grails app developed under version 1.3.7It works very well when I run using grails command "grails run-app" .
I created the war file using the grails command "grails war" and deployed it into the tomcat 5.5 version running on my local machine. The app doesnt show up on the url..
When I checked the log files, there were few INFO statements followed by an error saying "Error listenerstart". Below is the text from the log file.
Sep 20, 2011 1:57:44 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.20.
Sep 20, 2011 1:57:44 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Sep 20, 2011 1:57:44 PM org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 20, 2011 1:57:44 PM org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
Sep 20, 2011 1:57:44 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 484 ms
Sep 20, 2011 1:57:44 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 20, 2011 1:57:44 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.33
Sep 20, 2011 1:57:44 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Sep 20, 2011 1:57:45 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive sample-0.2.war
Sep 20, 2011 1:57:49 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Sep 20, 2011 1:57:49 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue Sep 20 13:57:49 MDT 2011]; root of context hierarchy
Sep 20, 2011 1:57:49 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
Sep 20, 2011 1:57:49 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#1cf662f: defining beans [grailsApplication,pluginManager,grailsConfigurator,grailsResourceLoader,grailsResourceHolder,characterEncodingFilter]; root of factory hierarchy
Sep 20, 2011 1:57:49 PM org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean afterPropertiesSet
INFO: Loading Grails application with information from descriptor.
Sep 20, 2011 1:57:49 PM org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean afterPropertiesSet
INFO: No reloading, using standard classloader.
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager findUserPlugins
INFO: Attempting to load [0] user defined plugins
Sep 20, 2011 1:57:50 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.3.1.GA
Sep 20, 2011 1:57:50 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Sep 20, 2011 1:57:50 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : javassist
Sep 20, 2011 1:57:50 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [logging] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [i18n] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [core] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [filters] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [servlets] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [release] with version [1.0.0.M1] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [svn] with version [1.0.0.M1] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [dataSource] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [groovyPages] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [codecs] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [urlMappings] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [controllers] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [scaffolding] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [mimeTypes] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [domainClass] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [converters] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [hibernate] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [services] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:50 PM org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager registerPlugin
INFO: Grails plug-in [validation] with version [1.3.7] loaded successfully
Sep 20, 2011 1:57:51 PM org.codehaus.groovy.grails.commons.TagLibArtefactHandler initialize
INFO: There are conflicting tags: org.codehaus.groovy.grails.plugins.web.taglib.FormTagLib.g:out vs. org.codehaus.groovy.grails.plugins.web.taglib.RenderTagLib.g:out. The former will take precedence.
Sep 20, 2011 1:57:51 PM org.codehaus.groovy.grails.commons.TagLibArtefactHandler initialize
INFO: There are conflicting tags: org.codehaus.groovy.grails.plugins.web.taglib.FormTagLib.g:out vs. org.codehaus.groovy.grails.plugins.web.taglib.RenderTagLib.g:out. The former will take precedence.
Sep 20, 2011 1:57:51 PM org.codehaus.groovy.grails.commons.TagLibArtefactHandler initialize
INFO: There are conflicting tags: org.codehaus.groovy.grails.plugins.web.taglib.FormTagLib.g:out vs. org.codehaus.groovy.grails.plugins.web.taglib.RenderTagLib.g:out. The former will take precedence.
Sep 20, 2011 1:57:51 PM org.codehaus.groovy.grails.commons.TagLibArtefactHandler initialize
INFO: There are conflicting tags: org.codehaus.groovy.grails.plugins.web.taglib.FormTagLib.g:out vs. org.codehaus.groovy.grails.plugins.web.taglib.RenderTagLib.g:out. The former will take precedence.
Sep 20, 2011 1:57:54 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Sep 20, 2011 1:57:54 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/sample-0.2] startup failed due to previous errors
Sep 20, 2011 1:57:55 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 20, 2011 1:57:55 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Sep 20, 2011 1:57:55 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Sep 20, 2011 1:57:55 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 10438 ms
Sep 20, 2011 1:58:09 PM org.apache.coyote.http11.Http11AprProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Sep 20, 2011 1:58:09 PM org.apache.coyote.ajp.AjpAprProtocol pause
INFO: Pausing Coyote AJP/1.3 on ajp-8009
Sep 20, 2011 1:58:10 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Sep 20, 2011 1:58:10 PM org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Sep 20, 2011 1:58:10 PM org.apache.coyote.ajp.AjpAprProtocol destroy
INFO: Stopping Coyote AJP/1.3 on ajp-8009
I really appreciate your help here
My colleague Jelmer has written a blog posting about exactly this subject
Read it and you will find out how to get log output for the ERROR:ListenerStart. That will help you solve your problem.
Well, the problem got resolved. In my case, I was using a wrong netcdf JAR file. There are two netcdf-java jar files. One is netcdfAll-{version}.jar and netcdf-{version}.jar. Initially, I was using the netcdfAll-{version}.jar, when I replaced it with netcdf-{version}.jar, the error got resolved. The reason I am thinking is the first specified netcdfAll jar file has logging dependencies that would have caused the error. This is just my opinion, I have no log error evidence to prove that so. Replacing the jar file just worked fine in my case.
I had been solving this issue for the past 4 days and I did an extensive search on Google for this error and read through various forums and Q&A sites to see how people had resolved their error. In most of the cases, the error was due to the JAR files present in the {your-app}/WEB-INF/lib/ directory. It may be missing some required jar files or presence of duplicate JAR files.Something to do with the JAR files. So, just a little tip, we you face an error like this on tomcat be sure to double check your lib directory to see you have the correct set of JAR files. I also tried several logging implementations, to see the system log the cause of the error, in my case I couldn't find any stacktrace being produced.
Anyways, the error is resolved and thanks to "Hans Westerbeek" for helping on this.