Why I receive this strange 'ExceptionHandlerFactory' issue on jboss-7? - jsf-2

I want to migrate an existing icefaces application into jboss server 7 but I receive this exception:
15:01:27,399 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC ser
vice thread 1-2) Critical error during deployment: : com.sun.faces.config.Config
urationException: Factory 'javax.faces.context.ExceptionHandlerFactory' was not
configured properly.
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactories
Exist(FactoryConfigProcessor.java:305) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.processor.FactoryConfigProcessor.process(Factory
ConfigProcessor.java:219) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:361)
[jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureLi
stener.java:225) [jsf-impl-2.1.7-jbossorg-2.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(Standar
dContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
ervice.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
rviceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
rollerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110) [rt.jar:1.7.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603) [rt.jar:1.7.0]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: javax.faces.FacesException: org.icefaces.impl.application.ExtendedExc
eptionHandlerFactory
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java
:643) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.jav
a:509) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.FactoryFinder.access$400(FactoryFinder.java:139) [jboss-j
sf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.jav
a:993) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:343) [jboss-j
sf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactories
Exist(FactoryConfigProcessor.java:303) [jsf-impl-2.1.7-jbossorg-2.jar:]
... 11 more
Caused by: java.lang.InstantiationException: org.icefaces.impl.application.Exten
dedExceptionHandlerFactory
at java.lang.Class.newInstance0(Class.java:357) [rt.jar:1.7.0]
at java.lang.Class.newInstance(Class.java:325) [rt.jar:1.7.0]
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java
:641) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
... 16 more
I am simply stuck 'cause I don't know how to solve this.
Does anybody have a clue?
I have javax.faces.jar in my lib directory of ear but seems that removing it does not help (I receive a lot of other exceptions).
UPDATE: If I add this to web.xml:
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
the error seems to be gone, but another one appears:
15:56:51,975 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-
host].[/cloudmatrix]] (MSC service thread 1-3) Exception sending context initial
ized event to listener instance of class com.sun.faces.config.ConfigureListener:
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIG
URATION FAILED! Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider i
s not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureLi
stener.java:292) [javax.faces.jar:2.1.6-SNAPSHOT]
at org.apache.catalina.core.StandardContext.contextListenerStart(Standar
dContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
ervice.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
rviceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
rollerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110) [rt.jar:1.7.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603) [rt.jar:1.7.0]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Cl
ass org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance
of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:375)
[javax.faces.jar:2.1.6-SNAPSHOT]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureLi
stener.java:225) [javax.faces.jar:2.1.6-SNAPSHOT]
... 8 more
Caused by: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.Jan
dexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
at com.sun.faces.spi.AnnotationProviderFactory.createAnnotationProvider(
AnnotationProviderFactory.java:78) [javax.faces.jar:2.1.6-SNAPSHOT]
at com.sun.faces.config.ConfigManager$AnnotationScanTask.<init>(ConfigMa
nager.java:807) [javax.faces.jar:2.1.6-SNAPSHOT]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:348)
[javax.faces.jar:2.1.6-SNAPSHOT]
... 9 more

I had to put jboss-deployment-structure.xml in my ear with this content:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
<module name="org.jboss.as.web" slot="main" />
</exclusions>
<dependencies>
<module name="org.hibernate.validator" export="true"/>
<module name="javax.validation.api" export="true"/>
<module name="org.codehaus.jettison" export="true"/>
<module name="org.jboss.resteasy.resteasy-jaxrs" export="true"/>
<module name="org.jboss.resteasy.resteasy-jackson-provider" export="true"/>
<module name="org.apache.log4j" export="true"/>
<module name="org.jboss.as.web" slot="main" export="true"/>
<module name="javax.faces.api" slot="main" export="true"/>
<module name="com.sun.jsf-impl" slot="main" export="true"/>
<module name="org.jboss.as.web" slot="main">
<imports>
<include path="/org/**" />
<exclude path="/META-INF/**" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>

Related

Why isn't Ivy downloading an artifact from our intranet repo?

I've had a prototype Ivy build working reasonably well. I just looked at it today and I'm seeing that it's finding an artifact on my intranet repo but not downloading it to the local cache or retrieving it in my local build, which causes the build to fail.
The build specifies several other dependencies, most of which are found on mavencentral, and one in another repo in the same local intranet repo that it's finding (but not downloading) the other artifact.
I've tried a few times to clear out the ivy cache and run this again, but it downloads all of the artifacts except for this particular one.
First, here is the relevant output from the build, with some minor pieces elided:
install-dependencies:
:: Apache Ivy 2.3.0 - 20130110142753 :: http://ant.apache.org/ivy/ ::
:: loading settings :: file = <pathtoivysettingsxmlfile>
:: resolving dependencies :: com.att.ecom.poc#coherence_poc;working#<hostname> [not transitive]
confs: [default]
found com.att.ecom.poc#poc-domain-model;0.0.1-SNAPSHOT in mavenCentralSnapshots
found org.apache.commons#commons-lang3;3.1 in central
found org.springframework#spring-aop;4.0.0.RELEASE in central
found org.springframework#spring-beans;4.0.0.RELEASE in central
found org.springframework#spring-context;4.0.0.RELEASE in central
found org.springframework#spring-core;4.0.0.RELEASE in central
found org.springframework#spring-expression;4.0.0.RELEASE in central
found org.springframework#spring-web;4.0.0.RELEASE in central
found com.oracle.coherence#coherence;12.1.2-0-0 in mavenCentralThirdparty
:: resolution report :: resolve 351ms :: artifacts dl 8ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 9 | 0 | 0 | 0 || 8 | 0 |
---------------------------------------------------------------------
:: retrieving :: com.att.ecom.poc#coherence_poc
confs: [default]
0 artifacts copied, 8 already retrieved (0kB/5ms)
The repositories "mavenCentralSnapshots" and "mavenCentralThirdparty" are actually on our local intranet repo (which is also confusedly called "maven central").
Notice that it says there are 9 modules, but only 8 were downloaded. The first artifact in the list, "poc-domain-model" is the one that is not being downloaded, but I don't see why.
Here is my "ivysettings.xml" file:
<ivysettings>
<settings defaultResolver="default"/>
<property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
<resolvers>
<chain name="default">
<filesystem name="local-maven2" m2compatible="true" >
<artifact pattern="${m2-pattern}"/>
<ivy pattern="${m2-pattern}"/>
</filesystem>
<ibiblio name="mavenCentralSnapshots" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-snapshots"/>
<ibiblio name="mavenCentralThirdparty" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-3rd-party"/>
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
And here is my "ivy.xml":
<ivy-module version="2.0">
<info organisation="com.att.ecom.poc" module="coherence_poc"/>
<dependencies>
<dependency org="com.att.ecom.poc" name="poc-domain-model" rev="0.0.1-SNAPSHOT"/>
<dependency org="org.apache.commons" name="commons-lang3" rev="3.1"/>
<dependency org="org.springframework" name="spring-aop" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-beans" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-context" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-core" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-expression" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-web" rev="4.0.0.RELEASE"/>
<dependency org="com.oracle.coherence" name="coherence" rev="12.1.2-0-0"/>
</dependencies>
</ivy-module>
And finally, here's the excerpt from my build.xml that calls Ivy:
<target name="install-dependencies">
<ivy:resolve transitive="false" type="jar"/>
<ivy:retrieve conf="*" type="jar" pattern="${basedir}/lib/[artifact]-[type]-[revision].[ext]"/>
</target>
Is it obvious what my problem is, or is there something I can do to get more information?
Update:
Here is an elided version of my "com.att.ecom.poc-coherence_poc-default.xml" file:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="com.att.ecom.poc"
module="coherence_poc"
revision="working#<hostname>"
conf="default"
confs="default"
date="20140210084517"/>
<dependencies>
<module organisation="com.oracle.coherence" name="coherence">
<revision name="12.1.2-0-0" status="release" pubdate="20131118143843" resolver="mavenCentralThirdparty" artresolver="mavenCentralThirdparty" homepage="" downloaded="false" searched="false" default="false" conf="system, default, optional, compile, *, provided, runtime, javadoc, sources, master" position="8">
<metadata-artifact status="no" details="" size="2283" time="0" location="<homedir>\.ivy2\cache\com.oracle.coherence\coherence\ivy-12.1.2-0-0.xml" searched="false" origin-is-local="false" origin-location="<intranetmavenrepo>/nexus/content/repositories/cditspoc-3rd-party/com/oracle/coherence/coherence/12.1.2-0-0/coherence-12.1.2-0-0.pom"/>
<caller organisation="com.att.ecom.poc" name="coherence_poc" conf="default" rev="12.1.2-0-0" rev-constraint-default="12.1.2-0-0" rev-constraint-dynamic="12.1.2-0-0" callerrev="working#<hostname>"/>
<artifacts>
<artifact name="coherence" type="jar" ext="jar" status="no" details="" size="7027491" time="0" location="<homedir>\.ivy2\cache\com.oracle.coherence\coherence\jars\coherence-12.1.2-0-0.jar">
<origin-location is-local="false" location="<intranetmavenrepo>/nexus/content/repositories/cditspoc-3rd-party/com/oracle/coherence/coherence/12.1.2-0-0/coherence-12.1.2-0-0.jar"/>
</artifact>
</artifacts>
</revision>
</module>
<module organisation="org.springframework" name="spring-web">
<revision name="4.0.0.RELEASE" status="release" pubdate="20131211234952" resolver="central" artresolver="central" homepage="https://github.com/SpringSource/spring-framework" downloaded="false" searched="false" default="false" conf="system, default, optional, compile, *, provided, runtime, javadoc, sources, master" position="7">
<license name="The Apache Software License, Version 2.0" url="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<metadata-artifact status="no" details="" size="5998" time="0" location="<homedir>\.ivy2\cache\org.springframework\spring-web\ivy-4.0.0.RELEASE.xml" searched="false" origin-is-local="false" origin-location="http://repo1.maven.org/maven2/org/springframework/spring-web/4.0.0.RELEASE/spring-web-4.0.0.RELEASE.pom"/>
<caller organisation="com.att.ecom.poc" name="coherence_poc" conf="default" rev="4.0.0.RELEASE" rev-constraint-default="4.0.0.RELEASE" rev-constraint-dynamic="4.0.0.RELEASE" callerrev="working#<hostname>"/>
<artifacts>
<artifact name="spring-web" type="jar" ext="jar" status="no" details="" size="661567" time="0" location="<homedir>\.ivy2\cache\org.springframework\spring-web\jars\spring-web-4.0.0.RELEASE.jar">
<origin-location is-local="false" location="http://repo1.maven.org/maven2/org/springframework/spring-web/4.0.0.RELEASE/spring-web-4.0.0.RELEASE.jar"/>
</artifact>
</artifacts>
</revision>
</module>
... several other spring and commons artifacts resolved from central
<module organisation="com.att.ecom.poc" name="poc-domain-model">
<revision name="0.0.1-SNAPSHOT" status="integration" pubdate="20140207093019" resolver="mavenCentralSnapshots" artresolver="mavenCentralSnapshots" homepage="" downloaded="false" searched="false" default="false" conf="system, default, optional, compile, *, provided, runtime, javadoc, sources, master" position="0">
<metadata-artifact status="no" details="" size="3337" time="0" location="<homedir>\.ivy2\cache\com.att.ecom.poc\poc-domain-model\ivy-0.0.1-SNAPSHOT.xml" searched="false" origin-is-local="false" origin-location="<intranetmavenrepo>/nexus/content/repositories/cditspoc-snapshots/com/att/ecom/poc/poc-domain-model/0.0.1-SNAPSHOT/poc-domain-model-0.0.1-20140207.173018-85.pom"/>
<caller organisation="com.att.ecom.poc" name="coherence_poc" conf="default" rev="0.0.1-SNAPSHOT" rev-constraint-default="0.0.1-SNAPSHOT" rev-constraint-dynamic="0.0.1-SNAPSHOT" callerrev="working#<hostname>"/>
<artifacts>
</artifacts>
</revision>
</module>
</dependencies>
</ivy-report>
Update:
I finally noticed that the download fails because the exact fully-qualified path doesn't exist on the intranet repo. It's looking for a file with "SNAPSHOT" in the name, but the files in the directory only have timestamps, not "SNAPSHOT".
I noticed the following discussion, which seems relevant: enter link description here .
As a result of this, I modified by "ivysettings.xml" to the following slightly elided version:
<ivysettings>
<settings defaultResolver="default"/>
<property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
<resolvers>
<chain name="default">
<filesystem name="local-maven2" m2compatible="true" >
<artifact pattern="${m2-pattern}"/>
<ivy pattern="${m2-pattern}"/>
</filesystem>
<ibiblio name="mavenCentralSnapshots" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-snapshots"
pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
<ibiblio name="mavenCentralThirdparty" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-3rd-party"/>
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
Unfortunately, this made no difference, it still just tries to find the "SNAPSHOT" file, which doesn't exist.
Update:
Actually, I realized another extremely important detail in that error where it fails to find the SNAPSHOT artifact on our MavenCentral. Here's the actual excerpt from the output:
:: problems summary ::
:::: WARNINGS
[FAILED ] com.att.ecom.poc#poc-domain-model;0.0.1-SNAPSHOT!poc-domain-model.jar(bundle): (0ms)
==== shared: tried
C:\Users\dk068x\.ivy2\shared\com.att.ecom.poc\poc-domain-model\0.0.1-SNAPSHOT\bundles\poc-domain-model.jar
==== public: tried
http://repo1.maven.org/maven2/com/att/ecom/poc/poc-domain-model/0.0.1-SNAPSHOT/poc-domain-model-0.0.1-SNAPSHOT.jar
What I should have noticed from this is that it isn't even trying to get the artifact from my snapshot repository at all. It's failing to find it on the public mavencentral, not mine. That tells me there's something wrong with my "ivysettings.xml", but I don't know what it would be.
Please check the comment above as well:
however in addition: change your ivy.xml to the following:
<ivy-module version="2.0">
<info organisation="com.att.ecom.poc" module="coherence_poc"/>
<dependencies>
<dependency org="com.att.ecom.poc" name="poc-domain-model" rev="0.0.1-SNAPSHOT"/>
</dependencies>
</ivy-module>
And then enable check the "ivy console" with debug level. (Ivy console in the console view of Eclipse) if possible.

Deploying grails application on Jboss 7.1.2 with provided dependencies

I want to deploy multiple grails applications on Jboss. Because they all use same grails version (2.1.1) I want to exclude common jars from war file and provide them via Jboss module. For starters, I'm trying with one application, but can't get it to work.
What I tried
Set defaultDependenciesProvided true in BuildConfig.groovy (before inherits("global"))
Created module folders: modules/commons/grails/main and put all the common jars in
Created module.xml
Added Dependencies: commons.grails to MANIFEST.MF file inside war
Tried to deploy the app
What happend
10:16:12,800 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "sofmk13-web-0.1.war"
10:16:23,095 WARN [org.jboss.modules] (MSC service thread 1-4) Failed to define class org.codehaus.groovy.grails.web.taglib.jsp.JspInvokeGrailsTagLibTag in Module "commons.grails:main" from local module loader #4ec57293 (roots: C:\development\tools\jboss-as-7.1.2.Final\modules,C:\development\repository\jboss): java.lang.LinkageError: Failed to link org/codehaus/groovy/grails/web/taglib/jsp/JspInvokeGrailsTagLibTag (Module "commons.grails:main" from local module loader #4ec57293 (roots: C:\development\tools\jboss-as-7.1.2.Final\modules,C:\development\repository\jboss))
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
at org.jboss.modules.Module.loadModuleClass(Module.java:527)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_17]
at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_17]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_17]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
at org.jboss.modules.Module.loadModuleClass(Module.java:527)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_17]
at java.lang.Class.forName(Class.java:266) [rt.jar:1.7.0_17]
at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54)
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81) [jboss-as-ee-7.1.2.Final.jar:7.1.2.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
Caused by: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/DynamicAttributes
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_17]
at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_17]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_17]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
... 31 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.jsp.tagext.DynamicAttributes from [Module "commons.grails:main" from local module loader #4ec57293 (roots: C:\development\tools\jboss-as-7.1.2.Final\modules,C:\development\repository\jboss)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 36 more
There is a lot of similar warnings for different classes.
Can somebody point me to what to try next? I can't decipher what exactly is wrong from the error message.
Thanks!
After some trial and error I finally managed to exclude some of the jars and provide them as modules. The hardest part was to get all the jar dependencies right. A brief overview follows. We start with description of how to prepare war archive to use the modules. Then we describe how modules are added to jboss.
Prepare WAR archive (assuming the modules are already provided)
create jboss-deployment-structure.xml file inside /web-app/WEB-INF folder. Here we specify which modules application uses and set appropriate versions (with slot parameter). Note that these modules provide all the jars we'll excluded from the war in the next step.
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<dependencies>
<module name="commons.restGrailsJars" slot="2.1.1"/>
<module name="org.springframework" slot="3.1.2.RELEASE"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
add code to exclude shared jars from war file. We use grails.war.resources configuration option inside BuildConfig.groovy. It lets us do some extra processing before war is created, so we can delete shared jars from the archive (they are listed in the list). Append following lines to the file:
grails.war.resources = { resourceDir ->
File libDir = new File(resourceDir, 'WEB-INF/lib')
['aopalliance',
'asm',
'aspectjrt',
'aspectjweaver',
'cglib',
'commons-beanutils',
'commons-codec',
'commons-collections',
'commons-dbcp',
'commons-el',
'commons-fileupload',
'commons-io',
'oro',
'sitemesh',
'slf4j',
'spring-aop',
'spring-asm',
'spring-beans',
'spring-core',
'spring-expression',
'xpp3_min',
'h2',
'servlet-api']
.each { jarNameStart ->
libDir.eachFile { file ->
if (file.name.startsWith(jarNameStart)) {
file.delete()
println "deleted jar $file"
}
}
}
}
Adding Jboss modules
Adding modules is pretty easy if we know what dependencies are needed by each jar library. Here is an example of adding modules for Spring version 3.2.3.RELEASE.
Spring framework jars reside inside modules/org/springframework folder.
Create new folder named 3.2.3.RELEASE and copy all the jars that can be shared*.
Put module.xml beside the jars. It looks something like this: (notice changed slot value which corresponds to release version and folder name)
<module xmlns="urn:jboss:module:1.1" name="org.springframework" slot="3.2.3.RELEASE">
<resources>
<resource-root path="spring-asm-3.2.3.RELEASE.jar"/>
<resource-root path="spring-core-3.2.3.RELEASE.jar"/>
<resource-root path="spring-aop-3.2.3.RELEASE.jar"/>
<resource-root path="spring-beans-3.2.3.RELEASE.jar"/>
<resource-root path="spring-expression-3.2.3.RELEASE.jar"/>
</resources>
<dependencies>
<module name="aopalliance.aopalliance" export="true"/>
<module name="cglib.cglib" export="true"/>
<module name="org.aspectj.aspectjweaver" export="true"/>
<module name="org.apache.commons.logging" export="true"/>
<module name="org.apache.commons.pool" export="true"/>
<module name="javax.servlet.api"/>
<module name="javax.faces.api" slot="1.2" />
<module name="com.sun.jsf-impl" slot="1.2" />
<module name="org.jboss.vfs"/>
<module name="javax.persistence.api"/>
<module name="javax.xml.bind.api"/>
<module name="javax.api"/>
<module name="javax.jms.api"/>
<module name="javax.annotation.api"/>
</dependencies>
</module>
If some modules are missing, application won't deploy (or it will, but strange things, like email validation failures will happen).
You have to do similar thing for all the libraries you want to exclude from war archive. I managed to exclude all the jars listed in 'Prepare WAR archive' section (2.).
There are several root resources you are including that are already modules so you should add a dependency rather than including the JAR. You also should probably avoid adding jcl-over-slf4j-1.6.2.jar. There is already an slf4j bridge provided.
The error seems to indicate you need a dependency on javax.servlet.jsp.api.
I didn't go over it in great detail, but I'm thinking your module.xml should look more like the following.
<module xmlns="urn:jboss:module:1.1" name="commons.grails">
<resources>
<resource-root path="aopalliance-1.0.jar"/>
<resource-root path="asm-3.1.jar"/>
<resource-root path="aspectjrt-1.6.10.jar"/>
<resource-root path="aspectjweaver-1.6.10.jar"/>
<resource-root path="cglib-2.2.jar"/>
<resource-root path="commons-codec-1.5.jar"/>
<resource-root path="commons-dbcp-1.4.jar"/>
<resource-root path="commons-el-1.0.jar"/>
<resource-root path="commons-fileupload-1.2.2.jar"/>
<resource-root path="commons-validator-1.3.1.jar"/>
<resource-root path="concurrentlinkedhashmap-lru-1.2_jdk5.jar"/>
<resource-root path="ehcache-core-2.4.6.jar"/>
<resource-root path="grails-bootstrap-2.1.1.jar"/>
<resource-root path="grails-core-2.1.1.jar"/>
<resource-root path="grails-crud-2.1.1.jar"/>
<resource-root path="grails-datastore-core-1.1.0.RELEASE.jar"/>
<resource-root path="grails-datastore-gorm-1.1.0.RELEASE.jar"/>
<resource-root path="grails-datastore-simple-1.1.0.RELEASE.jar"/>
<resource-root path="grails-hibernate-2.1.1.jar"/>
<resource-root path="grails-logging-2.1.1.jar"/>
<resource-root path="grails-plugin-codecs-2.1.1.jar"/>
<resource-root path="grails-plugin-controllers-2.1.1.jar"/>
<resource-root path="grails-plugin-converters-2.1.1.jar"/>
<resource-root path="grails-plugin-datasource-2.1.1.jar"/>
<resource-root path="grails-plugin-domain-class-2.1.1.jar"/>
<resource-root path="grails-plugin-filters-2.1.1.jar"/>
<resource-root path="grails-plugin-gsp-2.1.1.jar"/>
<resource-root path="grails-plugin-i18n-2.1.1.jar"/>
<resource-root path="grails-plugin-log4j-2.1.1.jar"/>
<resource-root path="grails-plugin-mimetypes-2.1.1.jar"/>
<resource-root path="grails-plugin-scaffolding-2.1.1.jar"/>
<resource-root path="grails-plugin-services-2.1.1.jar"/>
<resource-root path="grails-plugin-servlets-2.1.1.jar"/>
<resource-root path="grails-plugin-url-mappings-2.1.1.jar"/>
<resource-root path="grails-plugin-validation-2.1.1.jar"/>
<resource-root path="grails-resources-2.1.1.jar"/>
<resource-root path="grails-spring-2.1.1.jar"/>
<resource-root path="grails-web-2.1.1.jar"/>
<resource-root path="groovy-all-1.8.8.jar"/>
<resource-root path="icu4j-51_1.jar"/>
<resource-root path="oro-2.0.8.jar"/>
<resource-root path="postgresql-9.2-1002.jdbc4.jar"/>
<resource-root path="sitemesh-2.4.jar"/>
<resource-root path="spring-aop-3.1.2.RELEASE.jar"/>
<resource-root path="spring-asm-3.1.2.RELEASE.jar"/>
<resource-root path="spring-aspects-3.1.2.RELEASE.jar"/>
<resource-root path="spring-beans-3.1.2.RELEASE.jar"/>
<resource-root path="spring-context-3.1.2.RELEASE.jar"/>
<resource-root path="spring-context-support-3.1.2.RELEASE.jar"/>
<resource-root path="spring-core-3.1.2.RELEASE.jar"/>
<resource-root path="spring-expression-3.1.2.RELEASE.jar"/>
<resource-root path="spring-jdbc-3.1.2.RELEASE.jar"/>
<resource-root path="spring-jms-3.1.2.RELEASE.jar"/>
<resource-root path="spring-orm-3.1.2.RELEASE.jar"/>
<resource-root path="spring-tx-3.1.2.RELEASE.jar"/>
<resource-root path="spring-web-3.1.2.RELEASE.jar"/>
<resource-root path="spring-webmvc-3.1.2.RELEASE.jar"/>
<resource-root path="xpp3_min-1.1.4c.jar"/>
</resources>
<dependencies>
<module name="javax.servlet.jsp.api" export="true"/>
<module name="javax.servlet.jstl.api" export="true"/>
<module name="com.h2database.h2"/>
<module name="org.apache.commons.beanutils"/>
<module name="org.apache.commons.collections"/>
<module name="org.apache.commons.lang"/>
<module name="org.apache.commons.io"/>
<module name="org.apache.commons.pool"/>
<module name="org.apache.log4j"/>
<module name="org.slf4j"/>
</dependencies>
</module>
I've removed some of the dependencies not needed and added module dependencies where appropriate.

Tiles 3 & Struts 2 Error

I was trying to use Struts 2 & Tiles 3 according to this link.
However as soon as I add the listener-class on my web.xml:
<listener>
<listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
</listener>
I had the following error while uploading on my glassfish server:
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException:
java.lang.NoClassDefFoundError: org/springframewor
/core/io/support/ResourcePatternResolver. Please see server.log for
more details.
The error message was:
[#|2012-12-23T18:36:10.982+0800|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=22;_ThreadName=Thread-4;|Exception
while invoking class com.sun.enterprise.web.WebApplication start
method java.lang.Exception: java.lang.IllegalStateException:
ContainerBase.addChild: start: org.apache.catalina.LifecycleException:
java.lang.NoClassDefFoundError:
org/springframework/core/io/support/ResourcePatternResolver at
com.sun.enterprise.web.WebApplication.start(WebApplication.java:138)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
at
org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)
at
org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)
at
org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)
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
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at
com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at
com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at
com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
at
com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
at
org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at
com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:680) |#]
It seemed to be loooking for something in Spring Framework, but I'm using Struts2 + Tiles 3.
Am I missing anything?
Here's my code:
<?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" id="WebApp_ID" version="3.0">
<display-name>SongLyricsSystemv1</display-name>
<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>
<listener>
<listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
</listener>
<context-param>
<param-name>insertAttribute</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<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>
</web-app>
tiles.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="baseLayout" template="WebContent/BaseLayout.jsp">
<put-attribute name="menu" value="WebContent/Menu.jsp" />
</definition>
<definition name="/welcome.tiles" extends="baseLayout">
<put-attribute name="title" value="Welcome" />
<put-attribute name="body" value="WebContent/Welcome.jsp" />
</definition>
<definition name="/customer.tiles" extends="baseLayout">
<put-attribute name="title" value="Customer Form" />
<put-attribute name="body" value="WebContent/Customer.jsp" />
</definition>
<definition name="/customer.success.tiles" extends="baseLayout">
<put-attribute name="title" value="Customer Added" />
<put-attribute name="body" value="WebContent/SuccessCustomer.jsp" />
</definition>
</tiles-definitions>
Struts.xml:
<struts>
<package name="default" namespace="/" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="login"
class="com.java.actions.LoginAction">
<result name="success" type="tiles">/welcome.tiles</result>
<result name="error">Login.jsp</result>
</action>
<action name="customer"
class="com.java.actions.CustomerAction">
<result name="success" type="tiles">/customer.success.tiles</result>
<result name="input" type="tiles">/customer.tiles</result>
</action>
<action name="customer-form">
<result name="success" type="tiles">/customer.tiles</result>
</action>
</package>
</struts>
My list of jar files:
antlr-2.7.2.jar
classworlds-1.1.jar
commons-beanutils-1.8.0.jar
commons-chain-1.2.jar
commons-collections-3.1.jar
commons-digester-2.0.jar
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
commons-lang-2.4.jar
commons-lang3-3.1.jar
commons-logging-1.1.1.jar
commons-logging-api-1.1.jar
commons-validator-1.3.1.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
javax.servlet-api.jar
javax.servlet.jsp-api.jar
jcl-over-slf4j-1.7.2.jar
jul-to-slf4j-1.7.2.jar
log4j-over-slf4j-1.7.2.jar
mvel2-2.1.3.jar
ognl-3.0.5.jar
oro-2.0.8.jar
oval-1.31.jar
sitemesh-2.4.2.jar
slf4j-api-1.7.2.jar
slf4j-ext-1.7.2.jar
slf4j-jcl-1.7.2.jar
slf4j-jdk14-1.7.2.jar
slf4j-log4j12-1.7.2.jar
slf4j-migrator-1.7.2.jar
slf4j-nop-1.7.2.jar
slf4j-simple-1.7.2.jar
struts2-core-2.3.7.jar
struts2-tiles-plugin-2.3.7.jar
tiles-api-3.0.1.jar
tiles-autotag-core-runtime-1.1.0.jar
tiles-compat-3.0.1.jar
tiles-core-3.0.1.jar
tiles-el-3.0.1.jar
tiles-extras-3.0.1.jar
tiles-freemarker-3.0.1.jar
tiles-jsp-3.0.1.jar
tiles-mvel-3.0.1.jar
tiles-ognl-3.0.1.jar
tiles-request-api-1.0.1.jar
tiles-request-freemarker-1.0.1.jar
tiles-request-jsp-1.0.1.jar
tiles-request-mustache-1.0.1.jar
tiles-request-servlet-1.0.1.jar
tiles-request-servlet-wildcard-1.0.1.jar
tiles-request-velocity-1.0.1.jar tiles-servlet-3.0.1.jar
tiles-template-3.0.1.jar
tiles-velocity-3.0.1.jar
velocity-1.6.3.jar
xstream-1.4.2.jar
xwork-core-2.3.7.jar
Is there anything I am still missing?
These are the jars that are deployed with a working struts2 tiles3 integration (same as the link you pointed to):
aopalliance-1.0.jar
asm-3.3.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
builder-0.6.2.jar
commons-beanutils-1.8.0.jar
commons-collections-3.2.jar
commons-digester-2.0.jar
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
commons-lang3-3.1.jar
commons-lang-2.4.jar
core-0.6.2.jar
freemarker-2.3.19.jar
guava-r09.jar
jackson-core-asl-1.5.2.jar
jackson-mapper-asl-1.5.2.jar
javassist-3.11.0.GA.jar
jcl-over-slf4j-1.5.8.jar
mvel2-2.0.11.jar
ognl-3.0.5.jar
oro-2.0.8.jar
slf4j-api-1.5.8.jar
slf4j-jdk14-1.5.8.jar
spring-beans-2.5.6.jar
spring-context-2.5.6.jar
spring-core-2.5.6.jar
spring-web-2.5.6.jar
struts2-convention-plugin-2.3.4.1.jar
struts2-core-2.3.4.1.jar
tiles-api-3.0.1.jar
tiles-autotag-core-runtime-1.1.0.jar
tiles-compat-3.0.1.jar
tiles-core-3.0.1.jar
tiles-el-3.0.1.jar
tiles-extras-3.0.1.jar
tiles-freemarker-3.0.1.jar
tiles-jsp-3.0.1.jar
tiles-mvel-3.0.1.jar
tiles-ognl-3.0.1.jar
tiles-request-api-1.0.1.jar
tiles-request-freemarker-1.0.1.jar
tiles-request-jsp-1.0.1.jar
tiles-request-mustache-1.0.1.jar
tiles-request-servlet-1.0.1.jar
tiles-request-servlet-wildcard-1.0.1.jar
tiles-request-velocity-1.0.1.jar
tiles-servlet-3.0.1.jar
tiles-template-3.0.1.jar
tiles-velocity-3.0.1.jar
velocity-1.6.2.jar
velocity-tools-2.0.jar
xwork-core-2.3.4.1.jar
I would strongly recommend you use maven for the build here is a complete pom.xml:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>com.quaternion</groupId>
<artifactId>Struts2_Tiles3_Integration</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Struts2_Tiles3_Integration</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>2.3.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I wrote a tutorial that might be helpful here: http://www.nabisoft.com/tutorials/struts2/maven-struts-2-enterprise-application-based-on-java-ee-7-and-glassfish-4
It tells you how to use Struts 2 with Tiles 3 and Maven on Glassfish 4. You can just download a working example (maven project) and use the IDE of your choice, i.e. NetBeans or Eclipse. I hope this helps others. Make sure to configure your JDBC resource as described in the tutorial because the example also uses JPA. Spring is not coverd/used in my tutorial.

Configuring JBoss AS 7.1.1 with Mojarra 2.0.4 issues

I have a working webapp on JBoss AS 5.1.0 GA. Which uses Mojarra 2.0.4 jars. I'm in a process of migrating this on to JBoss AS 7.1.1. This version of JBoss is shipped with 2.1.7. So I downgraded the Mojarra version by defining slots for 2.0.4 and referring to them as dependency in the META-INF/jboss-deployment-structure.xml along with other dependencies.
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
</exclusions>
<dependencies>
<module name="org.hibernate.validator" export="true"/>
<module name="javax.validation.api" export="true"/>
<module name="com.google.gson" export="true"/>
<module name="org.codehaus.jettison" export="true"/>
<module name="org.jboss.resteasy.resteasy-jaxrs" export="true"/>
<module name="org.jboss.resteasy.resteasy-jackson-provider" export="true"/>
<module name="org.apache.log4j" export="true"/>
<module name="org.jboss.as.web" slot="main" export="true"/>
<module name="javax.faces.api" slot="2.0.4" export="true"/>
<module name="com.sun.jsf-impl" slot="2.0.4" export="true"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
This caused the following exception to be thrown at deployment
12:51:18,761 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-3) Initializing Mojarra 2.0.4 (FCS b09) for context ''
12:51:20,355 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-3) Unsanitized stacktrace from failed start...: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider
To which I referred to this link and modified my dependencies as follows
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
<module name="org.jboss.as.web" slot="main" />
</exclusions>
<dependencies>
<module name="org.hibernate.validator" export="true"/>
<module name="javax.validation.api" export="true"/>
<module name="com.google.gson" export="true"/>
<module name="org.codehaus.jettison" export="true"/>
<module name="org.jboss.resteasy.resteasy-jaxrs" export="true"/>
<module name="org.jboss.resteasy.resteasy-jackson-provider" export="true"/>
<module name="org.apache.log4j" export="true"/>
<module name="org.jboss.as.web" slot="main" export="true"/>
<module name="javax.faces.api" slot="2.0.4" export="true"/>
<module name="com.sun.jsf-impl" slot="2.0.4" export="true"/>
<module name="org.jboss.as.web" slot="main">
<imports>
<include path="/org/**" />
<exclude path="/META-INF/**" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
Which got rid of the error at deployment but introduced the following runtime exception
12:59:19,434 ERROR [stderr] (http--0.0.0.0-8080-4) java.lang.IllegalArgumentException: null source
12:59:19,435 ERROR [stderr] (http--0.0.0.0-8080-4) at java.util.EventObject.<init>(EventObject.java:38)
12:59:19,436 ERROR [stderr] (http--0.0.0.0-8080-4) at javax.faces.event.SystemEvent.<init>(SystemEvent.java:71)
12:59:19,444 ERROR [stderr] (http--0.0.0.0-8080-4) at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:73)
and
12:59:19,489 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[Faces Servlet]] (http--0.0.0.0-8080-4) Servlet.service() for servlet Faces Servlet threw exception: java.lang.NullPointerException
at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter(PartialViewContextImpl.java:431) [jsf-impl.jar:2.0.4-b09]
at com.sun.faces.context.PartialViewContextImpl.access$300(PartialViewContextImpl.java:72) [jsf-impl.jar:2.0.4-b09]
at com.sun.faces.context.PartialViewContextImpl$DelayedInitPartialResponseWriter.getWrapped(PartialViewContextImpl.java:559) [jsf-impl.jar:2.0.4-b09]
I figured (by googling, of course) that the exception is often caused by three things
Invalid/unclosed tags used in xhtml (a wrongly propagated exception)
Session timeout (a wrongly propagated exception)
Limit on no of POST parameters in Tomcat
Unfortunately, first two were not the causes. I ran my erroneous xhtml pages through validators and found that markup was valid, neither was my session had expired. I also increased the org.apache.tomcat.util.http.Parameters.MAX_COUNT to 5000 in standalone.xml to address the third point. The error still persists.
I also tried migrating to the default bundled Mojarra 2.7.1 version. That prevented the first runtime exception but the second one remained.
The only peculiar thing about those pages causing this error is they have ajax calls in them.
Funny enough, the application is working fine with AS 5.1.0 GA, so if my markup is erroneous, it would have given me a difficult time on 5.1.0 as well, which it didn't. So invalid markup is unlikely.
Any pointers much appreciated!
UPDATE: Just found out that line at PartialViewContextImpl.java:431 shows that the ctx.getRenderKit() is evaluating to null. No idea why though
UPDATE2: It turns out that the problem is seen only if I use pure html input components within the form i.e. <input type="text">, <select> etc. If I remove those from the <h:form> or I convert them into corresponding JSF tags, it works fine. Something is going terribly wrong somewhere. I'm not able to figure out excatly if this is caused by jboss, Mojarra or specifically my app. I tried it with a plain vanilla JSF app and it had no errors whether or not I use html input tags. So its the combination of my app and jboss 7.x that is causing this. Any ideas?
Finally! The issue was related to a bug in Mojarra 2.1.7 as reported here
The Solution is to give a name attribute to every pure html component included in <h:form>. The part that I could not understand that this bug seems to be related to Mojarra 2.1.7. And the jars I configured for my app were 2.0.4 version, yet the error was seen.

java.lang.NullPointerException at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForReading [duplicate]

This question already has answers here:
*.xhtml url-pattern causes java.lang.NullPointerException at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForReading
(2 answers)
Closed 7 years ago.
I am running my application in apache-tomcat-7.0.16 using JSF-2.1.2. After adding navigation rules in faces-config.xml, I am getting the NullPointerException. This bug was filed in JSF forum. Is there any compatible version between JSF and the tomcat app server or any solution for this? Error stack trace is given below:
java.lang.NullPointerException
at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForReading(ELFlash.java:793)
at com.sun.faces.context.flash.ELFlash.getPhaseMapForReading(ELFlash.java:826)
at com.sun.faces.context.flash.ELFlash.isEmpty(ELFlash.java:484)
at com.sun.faces.facelets.util.DevTools.writeVariables(DevTools.java:325)
at com.sun.faces.facelets.util.DevTools.writeVariables(DevTools.java:215)
at com.sun.faces.facelets.util.DevTools.debugHtml(DevTools.java:130)
at com.sun.faces.renderkit.RenderKitUtils.renderHtmlErrorPage(RenderKitUtils.java:1159)
at com.sun.faces.context.ExceptionHandlerImpl.throwIt(ExceptionHandlerImpl.java:269)
at com.sun.faces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:141)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:546)
at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:364)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Same issue with Tomcat 7.0.26 and and JSF 2.1.7. Works with JSF 2.0.9
Initially had just configured
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
</dependency>
But got
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
It was only after attempting to add a dependency on jstl that I got the NullPointerException. After rolling back to JSF 2.0.9, I also removed the dependency on jstl.
Recently, I had a similar problem with the same error stack trace. <welcome-file-list> entry was like this when I got that error:
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
However, the error disappeared when I changed the entry to (denote the leading faces):
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
I was facing same issue. I was able to solve it by modifying faces-config.xml as below
<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>

Resources