Deploy webservice with cxf on jboss wildfly - wildfly-8

I get the SAXParseException if I deploy my webservice on wildfly. It does run on jboss 7 (different maven dependencies).
I added the spring module to wildfly modules.
Does anyone have a idea what I am missing.
Thanks a lot for taking the time and have a good day.
web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="3.1"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_2.5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<!-- param-value>WEB-INF/cxf-servlet.xml</param-value -->
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<resource-env-ref>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager
</resource-env-ref-type>
</resource-env-ref>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>services/*</url-pattern>
</servlet-mapping>
applicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jaxws="http://cxf.apache.org/jaxws"
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-3.2.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint xmlns:e="http://www.de/namespace/service/Druckagent/v1"
id="druckagent" address="/druckagent"
implementor="druckagent.druck.impl.DruckagentImpl"
endpointName="e:DruckagentPort" />
</beans>
jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<!-- subsystem name="webservices" / -->
</exclude-subsystems>
<dependencies>
<module name="org.apache.cxf" />
<module name="org.apache.cxf.impl" />
<module name="org.springframework.spring" />
</dependencies>
</deployment>
</jboss-deployment-structure>
webservice.xml
<webservices xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_web_services_1_2.xsd"
xmlns:ger="http://ciaows.org/wsdl" version="1.1">
<webservice-description>
<webservice-description-name>Druckagent</webservice-description-name>
<port-component>
<port-component-name>DruckagentImpl</port-component-name>
<wsdl-port>DruckagentPort</wsdl-port>
<service-endpoint-interface>broker.verwaltung.Druckagent</service-endpoint-interface>
<service-impl-bean>
<ejb-link>DruckagentImpl</ejb-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webXml>${basedir}/src/main/resources/WEB-INF/web.xml</webXml>
<webResources>
<webResource>
<directory>${basedir}/src/main/resources/WEB-INF</directory>
<includes>
<include>applicationContext.xml</include>
<include>web.xml</include>
<include>beans.xml</include>
<include>jboss-webservices.xml</include>
<include>webservices.xml</include>
<include>ejb-jar.xml</include>
<include>jboss-deployment-structure.xml</include>
</includes>
<targetPath>WEB-INF</targetPath>
</webResource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<!-- AS7scope>compile</scope-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<!-- AS7scope>compile</scope-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
</profiles>
Exception
16:15:03,189 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (MSC service thread 1-1) Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
16:15:03,192 DEBUG [org.springframework.beans.factory.xml.DefaultDocumentLoader] (MSC service thread 1-1) Using JAXP provider [__redirected.__DocumentBuilderFactory]
16:15:03,194 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] (MSC service thread 1-1) Loading schema mappings from [META-INF/spring.schemas]
16:15:03,194 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] (MSC service thread 1-1) Loaded schema mappings: {}
16:15:06,473 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name
16:15:24,198 WARN[org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (MSC service thread 1-1) Ignored XML validation warning: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; schema_reference.4: Schemadokument "http://www.springframework.org/schema/beans/spring-beans-3.2.xsd" konnte nicht gelesen werden, da 1) das Dokument nicht gefunden werden konnte; 2) das Dokument nicht gelesen werden konnte; 3) das Root-Element des Dokuments nicht <xsd:schema> ist.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:433) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:347) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4128) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:4119) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument1(XSDHandler.java:2463) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2167) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:562) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:588) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2448) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1767) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:602) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3065) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:881) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:237) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300) [rt.jar:1.7.0_25]
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) [spring-context-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) [spring-context-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451) [spring-context-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:194) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) [rt.jar:1.7.0_25]
16:15:24,211 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-1) Context initialization failed: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
Caused by: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) [rt.jar:1.7.0_25]
16:15:24,218 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host."/druckserver-0.0.1-SNAPSHOT": org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host."/druckserver-0.0.1-SNAPSHOT": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:223) Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) Caused by: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) [rt.jar:1.7.0_25]
16:15:24,229 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"JBAS014671: Failed services" => {"jboss.undertow.deployment.default-server.default-host.\"/druckserver-0.0.1-SNAPSHOT\"" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host.\"/druckserver-0.0.1-SNAPSHOT\": Failed to start service Caused by: java.lang.RuntimeException: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements \"beans\" kann nicht gefunden werden. 16:15:24,255 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018565: Replaced deployment "druckserver-0.0.1-SNAPSHOT.war" with deployment "druckserver-0.0.1-SNAPSHOT.war"16:15:24,255 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report JBAS014777: Services which failed to start: service jboss.undertow.deployment.default-server.default-host."/druckserver-0.0.1-SNAPSHOT" service jboss.undertow.deployment.default-server.default-host."/druckserver-0.0.1-SNAPSHOT": org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default- host."/druckserver-
0.0.1-SNAPSHOT": Failed to start service>

Here is a solution to the problem. Might be other ways to fix it but this one worked for me. Just needed this two files and the beans.xml
web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="3.1"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_2.5.xsd">
</web-app>
jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<!-- subsystem name="webservices" / -->
</exclude-subsystems>
<dependencies>
<module name="org.apache.cxf" />
<module name="org.apache.cxf.impl" />
<module name="org.springframework.spring" export="true" meta-inf="export"/>
</dependencies>
</deployment>
</jboss-deployment-structure>

Related

Webapp runs correctly with jetty 9 maven plugin, but not with jetty runner

Being new to Maven, I'm trying to make an executable jar of my webapp with an embedded jetty. Unfortunately, I'm having many difficulties achieving this, and decided to follow a step-by-step progression: first using jetty-maven-plugin (OK, with a lot of pain), then using jetty-runner (KO, the matter of this SO question), and finally using embedded jetty (KO).
I've spent so much time doing this, having different exceptions depending on the jetty version and pulled so much hair out, that I finally decided to ask the community for some help.
I hope this question won't be marked as a duplicate of SO #12241989 (or any other similar), because I have the same kind of problem, but clearly not the same root cause since I'm using the same version of jetty-maven-plugin and jetty-runner.
Context
webapp uses JSF2 (mojarra 2.2.8) + CDI (weld) + Primefaces + Websockets
Configuration
1. Jetty plugin
excerpt from pom.xml
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
<jetty.groupId>org.eclipse.jetty</jetty.groupId>
<jetty.version>9.0.4.v20130625</jetty.version>
<jetty.descriptor>${project.basedir}/src/main/webapp/WEB-INF/web.xml</jetty.descriptor>
<jetty.env>${project.basedir}/src/main/webapp/WEB-INF/jetty-env.xml</jetty.env>
<jetty.contextPath>/</jetty.contextPath>
<jetty.overrideDescriptor>${project.basedir}/src/main/webapp/WEB-INF/jetty-web-override.xml</jetty.overrideDescriptor>
<myfaces.version>2.2.5</myfaces.version>
<mojarra.version>2.2.8</mojarra.version>
</properties>
...
<plugin>
<groupId>${jetty.groupId}</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<webApp>
<contextPath>${jetty.contextPath}</contextPath>
<descriptor>${jetty.descriptor}</descriptor>
<jettyEnvXml>${jetty.env}</jettyEnvXml>
<overrideDescriptor>${jetty.overrideDescriptor}</overrideDescriptor>
</webApp>
<contextXml>
${project.basedir}/src/main/webapp/WEB-INF/jetty-context.xml
</contextXml>
</configuration>
</plugin>
jetty-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="serverClasses">
<Array type="java.lang.String">
<Item>
-org.eclipse.jetty.servlet.ServletContextHandler.Decorator
</Item>
</Array>
</Set>
</Configure>
jetty-env.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="webAppCtx" class="org.eclipse.jetty.webapp.WebAppContext">
<New id="appManager" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>
<Ref id="webAppCtx" />
</Arg>
<Arg>BeanManager</Arg>
<Arg>
<New class="javax.naming.Reference">
<Arg>javax.enterprise.inject.spi.BeanManager</Arg>
<Arg>org.jboss.weld.resources.ManagerObjectFactory</Arg>
<Arg />
</New>
</Arg>
</New>
</Configure>
jetty-web-override.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_3_0.xsd"
version="3.0">
<!-- CDI-->
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<resource-env-ref>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>
<!-- mojarra -->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
With this configuration, the application runs correctly. sigh of relief
2. Jetty runner
I believe the easiest way to reproduce the above configuration with jetty runner is using a jetty context xml file that describes my webapp. So I ended up with the following context file :
context.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="war">target/myapp.war</Set>
<Set name="descriptor">src/main/webapp/WEB-INF/web.xml</Set>
<Set name="overrideDescriptor">src/main/webapp/WEB-INF/jetty-web-override.xml</Set>
<Set name="serverClasses">
<Array type="java.lang.String">
<Item>
-org.eclipse.jetty.servlet.ServletContextHandler.Decorator
</Item>
</Array>
</Set>
<New id="appManager" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>BeanManager</Arg>
<Arg>
<New class="javax.naming.Reference">
<Arg>javax.enterprise.inject.spi.BeanManager</Arg>
<Arg>org.jboss.weld.resources.ManagerObjectFactory</Arg>
<Arg />
</New>
</Arg>
</New>
</Configure>
Then when I run the jetty runner (with the same version):
java -jar jetty-runner-9.0.4.v20130625.jar context.xml
...everything seems OK, except the (annoying) fact that the startup listener of my app (annotated with Servlet 3.0 #WebListener) does not start.
And if I try to navigate to http://localhost:8080/, I get the following stack trace:
HTTP ERROR 500
Problem accessing /. Reason:
Server Error
Caused by:
javax.faces.view.facelets.TagAttributeException: /index.xhtml #119,66 src="/WEB-INF/include/#{applicationManager.layout}.xhtml" /index.xhtml #119,66 src="/WEB-INF/include/#{appli
cationManager.layout}.xhtml": java.lang.NullPointerException
at com.sun.faces.facelets.tag.TagAttributeImpl.getObject(TagAttributeImpl.java:358)
at com.sun.faces.facelets.tag.TagAttributeImpl.getValue(TagAttributeImpl.java:322)
at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:112)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:161)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:990)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
...
Caused by: javax.el.ELException: /index.xhtml #119,66 src="/WEB-INF/include/#{applicationManager.layout}.xhtml": java.lang.NullPointerException
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
at com.sun.faces.facelets.tag.TagAttributeImpl.getObject(TagAttributeImpl.java:356)
... 60 more
Caused by: javax.el.ELException: java.lang.NullPointerException
at javax.el.BeanELResolver.getValue(BeanELResolver.java:368)
If I try to enforce the listening of my StartupListener class by specifying in web.xml:
<listener>
<listener-class>fr.mygroup.myapp.listeners.StartupListener</listener-class>
</listener>
...I get the same error.
Anyway, the fact that my StartupListener is not listened is clearly not the cause of the error but a consequence. But I can't figure out what's wrong with my jetty-runner configuration.
I desperately feel like it's a long way to go to an executable überjar of my webapp :(
Appendix
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.mygroupid</groupId>
<artifactId>myapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
<jetty.groupId>org.eclipse.jetty</jetty.groupId>
<jetty.version>9.0.4.v20130625</jetty.version>
<jetty.descriptor>${project.basedir}/src/main/webapp/WEB-INF/web.xml</jetty.descriptor>
<jetty.env>${project.basedir}/src/main/webapp/WEB-INF/jetty-env.xml</jetty.env>
<jetty.contextPath>/</jetty.contextPath>
<jetty.overrideDescriptor>${project.basedir}/src/main/webapp/WEB-INF/jetty-web-override.xml</jetty.overrideDescriptor>
<myfaces.version>2.2.5</myfaces.version>
<mojarra.version>2.2.8</mojarra.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>${jetty.groupId}</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<webApp>
<contextPath>${jetty.contextPath}</contextPath>
<descriptor>${jetty.descriptor}</descriptor>
<jettyEnvXml>${jetty.env}</jettyEnvXml>
<overrideDescriptor>${jetty.overrideDescriptor}</overrideDescriptor>
</webApp>
<contextXml>
${project.basedir}/src/main/webapp/WEB-INF/jetty-context.xml
</contextXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
<repositories>
<repository>
<id>ebi-repo</id>
<name>The EBI internal repository</name>
<url>http://www.ebi.ac.uk/~maven/m2repo</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${mojarra.version}</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${mojarra.version}</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>2.1.2.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<!-- Primefaces 5.1 -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.1</version>
</dependency>
<!-- Primefaces Themes -->
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>
<!-- Biomodels API -->
<dependency>
<groupId>uk.ac.ebi.biomodels</groupId>
<artifactId>biomodels-wslib</artifactId>
<version>1.21</version>
</dependency>
<!-- Ganymed SSH -->
<dependency>
<groupId>ch.ethz.ganymed</groupId>
<artifactId>ganymed-ssh2</artifactId>
<version>262</version>
</dependency>
<!-- Atmosphere -->
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>2.2.3</version>
</dependency>
<!-- Logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.1.2</version>
</dependency>
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<!-- GSON -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<!-- Apache commons -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
</project>

JSF + Weld CDI + WebService (over Jetty9) does not work

I just don't get what the big mistake is that I'm doing...
It's just not possible for me to get Weld CDI to work. Before I integrated CDI into my webapp (JSF + PrimeFaces + DB4O + Jersey), everything worked mostly fine.
Since I replaced the #ManagedBean stuff with #Named and so on and did changed my pom for using CDI, Jetty does not start anymore.
SOLVED (see UPDATE #1)
I used ManagedBeans in the past, but needed the CDI for injection withing webservices.
See UPDATE 2 for that.
My project-structure:
My Exception:
org.jboss.weld.exceptions.WeldException: WELD-001524 Unable to load proxy class for bean Implicit Bean [javax.enterprise.inject.Instance] with qualifiers [#Default] with class interface javax.enterpr
ise.inject.Instance using classloader WebAppClassLoader=343602030#147af36e
at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:318)
at org.jboss.weld.bean.builtin.AbstractFacadeBean.initializeAfterBeanDiscovery(AbstractFacadeBean.java:60)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:129)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:120)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by:
java.lang.LinkageError: loader constraint violation: loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) previously initiated loading for a different type with name "javax/enterpris
e/util/TypeLiteral"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
at java.lang.Class.privateGetPublicMethods(Class.java:2641)
at java.lang.Class.getMethods(Class.java:1457)
at org.jboss.weld.bean.proxy.ProxyFactory.addMethodsFromClass(ProxyFactory.java:523)
at org.jboss.weld.bean.proxy.ProxyFactory.addMethods(ProxyFactory.java:478)
at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:412)
at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:311)
at org.jboss.weld.bean.builtin.AbstractFacadeBean.initializeAfterBeanDiscovery(AbstractFacadeBean.java:60)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:129)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:120)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
My pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- This is the project descriptor for the examples of my components -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>DB4O-webapp</artifactId>
<packaging>war</packaging>
<name>DB4O-Web</name>
<parent>
<groupId>DB4O-Test</groupId>
<artifactId>DB4O-Test-project</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.db4o</groupId>
<artifactId>db4o-full-java5</artifactId>
<version>8.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>2.0.3.Final</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.0.4.v20130625</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<!-- Repository for jstl 1.2 -->
<repository>
<id>java.net</id>
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout>
</repository>
<repository>
<id>db4o-repo</id>
<url>http://source.db4o.com/maven/</url>
<layout>default</layout>
</repository>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<build>
<finalName>DB4O-Test</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.0.4.v20130625</version>
<configuration>
<!--option>weld</option-->
<scanIntervalSeconds>2</scanIntervalSeconds>
<reload>automatic</reload>
<webApp>
<contextPath>/${project.build.finalName}</contextPath>
</webApp>
<jettyXml>src/main/webapp/WEB-INF/jetty-env.xml</jettyXml>
<contextXml>src/main/webapp/WEB-INF/jetty-context.xml</contextXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<description>debug web.xml</description>
<context-param>
<description>State saving method: "client" or "server" (= default)
See JSF Specification 2.5.3
</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.AUTO_SCROLL</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>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<!--listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener-->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>de.mypackage.guide.ws</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<resource-env-ref>
<description>Object factory for the CDI Bean Manager</description>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>
</web-app>
My beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans 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/beans_1_0.xsd">
</beans>
My jetty-config.xml:
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="webAppCtx" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="serverClasses">
<Array type="java.lang.String">
<Item>org.eclipse.jetty.servlet.ServletContextHandler.Decorator</Item>
</Array>
</Set>
</Configure>
My jetty-env.xml:
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="webAppCtx" class="org.eclipse.jetty.webapp.WebAppContext">
<New id="BeanManager" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>
<Ref id="webAppCtx" />
</Arg>
<Arg>BeanManager</Arg>
<Arg>
<New class="javax.naming.Reference">
<Arg>javax.enterprise.inject.spi.BeanManager</Arg>
<Arg>org.jboss.weld.resources.ManagerObjectFactory</Arg>
<Arg />
</New>
</Arg>
</New>
</Configure>
Example class:
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import de.mypackage.guide.model.Device;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.core.MediaType;
import java.io.Serializable;
import java.util.Collection;
/**
* Created with IntelliJ IDEA.
* Date: 08.08.13
* Time: 08:21
*/
#Named
#RequestScoped
public class DeviceService implements Serializable {
#Inject
private DatabaseService databaseService;
public DeviceService() {}
#PostConstruct
public void init() {
}
public void sendDevice() {
Client create = Client.create();
WebResource service = create.resource( "http://localhost:8080/ws" );
System.out.println( service.path( "register" ).path( "device" ).path( "meinDevice" )
.type( MediaType.TEXT_PLAIN ).put(String.class) );
}
public Collection<Device> getAllDevices() {
return this.databaseService.retrieveAll(Device.class);
}
public DatabaseService getDatabaseService() {
return databaseService;
}
public void setDatabaseService(DatabaseService databaseService) {
this.databaseService = databaseService;
}
public Device getDevice(String deviceName) {
return this.databaseService.retrieveFiltered(Device.class, "regId", deviceName).toArray(new Device[0])[0];
}
public void saveDevice(Device device) {
this.databaseService.store(device);
}
}
Thanks in advance for any help!
UPDATE #1:
After solving my exception above by following the commentary below the first answer from John Ament, I have another problem.
Now I get a NPE. Seems that my service won't get injected at all. By reading my log output it says that CDI support is enabled, so maybe it's some configuration (beans.xml etc.) problem?
SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NullPointerException
at de.mypackage.guide.ws.RegistrationService.device(RegistrationService.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
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:302)
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:1511)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:505)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:138)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:564)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:213)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1094)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1028)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:258)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:445)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:267)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:224)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
at java.lang.Thread.run(Thread.java:724)
2013-08-09 07:52:43.853:WARN:oejs.ServletHandler:qtp1061696789-23: /ws/register/device/meinDevice
java.lang.NullPointerException
at de.mypackage.guide.ws.RegistrationService.device(RegistrationService.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
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:302)
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:1511)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:505)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:138)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:564)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:213)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1094)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1028)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:258)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:445)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:267)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:224)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
at java.lang.Thread.run(Thread.java:724)
UPDATE #2
I checked the injection within the services and they work (getting some test-output from another service), so the problem lies within the webservice <---> CDI stuff.
Could there be a problem with the different contexts of cdi, webservices and jsf?
#Path("/register")
public class RegistrationService {
#Inject
private DeviceService deviceService;
#GET
#Produces( MediaType.TEXT_PLAIN )
#Path("/get/{device}")
public String getDevice(#PathParam("device") String device) {
return this.deviceService.getDevice(device).getRegId();
}
#PUT
#Path( "/device/{device}" )
#Consumes( MediaType.TEXT_PLAIN )
#Produces( MediaType.TEXT_PLAIN )
public String device(#PathParam("device") String device) {
this.deviceService.saveDevice(new Device(device));
System.out.println("Erfolgreich!");
return "Device: " + device;
}
public DeviceService getDeviceService() {
return deviceService;
}
public void setDeviceService(DeviceService deviceService) {
this.deviceService = deviceService;
}
}
Which Maven version are you using? 3.1?? I had the same problem when trying to run my app through jetty:run goal (maven-jetty-plugin 9.x) and Maven 3.1. I've just revert my Maven to 3.0.x version and now it goes well.
It looks like the api jars for CDI aren't being loaded, you have them as provided which excludes them from runtime.

Primefaces push on glassfish 3.1.2 Exception

this is my config.xml
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>1.0.0.RC1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.5</version>
</dependency>
web.xml
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
is the counter example, when clic after 3 or 7 then:
WARNING: GRIZZLY0024: Terminate process interrupted.
java.lang.InterruptedException at
java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1325)
at java.util.concurrent.Semaphore.tryAcquire(Semaphore.java:414) at
com.sun.grizzly.http.ProcessorTask.terminateProcess(ProcessorTask.java:1021)
at
com.sun.grizzly.arp.DefaultAsyncExecutor.finishResponse(DefaultAsyncExecutor.java:186)
at
com.sun.grizzly.arp.DefaultAsyncExecutor.finishExecute(DefaultAsyncExecutor.java:210)
at
com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:133)
at
com.sun.grizzly.comet.CometEngine.flushPostExecute(CometEngine.java:426)
at com.sun.grizzly.comet.CometEngine.interrupt0(CometEngine.java:405)
at com.sun.grizzly.comet.CometEngine.interrupt(CometEngine.java:383)
at
com.sun.grizzly.comet.CometContext.resumeCometHandler(CometContext.java:442)
at
org.atmosphere.container.GrizzlyCometSupport.resume(GrizzlyCometSupport.java:172)
at
org.atmosphere.container.GrizzlyCometSupport.action(GrizzlyCometSupport.java:184)
at
org.atmosphere.container.GrizzlyCometSupport.action(GrizzlyCometSupport.java:81)
at
org.atmosphere.cpr.AtmosphereResourceImpl.resume(AtmosphereResourceImpl.java:317)
at
org.atmosphere.handler.AbstractReflectorAtmosphereHandler.onStateChange(AbstractReflectorAtmosphereHandler.java:146)
at
org.atmosphere.cpr.DefaultBroadcaster.broadcast(DefaultBroadcaster.java:853)
at
org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:768)
at
org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:801)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
I haven't tried primefaces-push but I just use Atmosphere (primefaces-push is using Atmosphere too). To make it work I have to add those JVM options:
-Dv3.grizzly.cometSupport=true
-Djava.net.preferIPv4Stack=true (I am not sure if this option is still required with the last versions of Atmosphere)
Maybe it could help you.

The matching wildcard is strict, but no declaration can be found for element 'security:ldap-server'

I am trying to start application on Tomcat 7 which starts embedded ldap server.
That is my security-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:context="http://www.springframework.org/schema/context"
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-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:property-placeholder location="file:///${catalina.home}/webapps/test.properties"
ignore-unresolvable="true" />
<!--<security:ldap-server id="ldapBPS" url="${ldap.url}" manager-dn="${ldap.managerDN}" manager-password="${ldap.managerPass}"-->
<!--root="${ldap.root}" />-->
<security:ldap-server id="ldapLocal" ldif="classpath:test-ldap.ldif" root="test" />
<security:authentication-manager>
<security:ldap-authentication-provider
user-search-filter="${ldap.conf.userSearchFilter}"
user-search-base="${ldap.conf.confuserSearchBase}"
group-search-filter="${ldap.conf.groupSearchFilter}"
group-search-base="${ldap.conf.groupSearchBase}"
group-role-attribute="${ldap.conf.groupRoleAttr}"
role-prefix="${ldap.conf.rolePrefix}">
</security:ldap-authentication-provider>
</security:authentication-manager>
</beans>
Here are Maven dependencies, as far as Spring is concerned:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>${springframework.version}</version>
</dependency>
Using this configuration I get the following error during Tomcat startup:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from class path resource [META-INF/spring/mifid/mifid-security.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'security:ldap-server'.
Any ideas where is the source of that error?
Thank you in advance.

java.lang.IllegalAccessError: tried to access class com.sun.faces.context.ApplicationMap

i ve a jsf application which works fine on eclipse with tomcat 7. The problem happened when i packaged it (with mvn package..) and put the .war file in the tomcat webapps directory to deploy it.
in the tomcat console i got :
SEVERE: Error listenerStart
Nov 2, 2012 12:38:09 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/jsf_prime_ldap] startup failed due to previous errors
Nov 2, 2012 12:38:09 AM org.apache.catalina.loader.WebappClassLoader checkThread
LocalMapForLeaks
SEVERE: The web application [/jsf_prime_ldap] created a ThreadLocal with key of
type [com.sun.faces.config.ConfigureListener$1] (value [com.sun.faces.config.Con
figureListener$1#6972f1]) and a value of type [com.sun.faces.config.ConfigureLis
tener.ServletContextAdapter] (value [com.sun.faces.config.ConfigureListener$Serv
letContextAdapter#18fee4f]) but failed to remove it when the web application was
stopped. Threads are going to be renewed over time to try and avoid a probable
memory leak.
for more details about this problem, in the localhost's tomcat log file i have :
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.IllegalAccessError: tried to access class com.sun.faces.context.ApplicationMap from class com.sun.faces.config.InitFacesContext$ServletContextAdapter
at com.sun.faces.config.InitFacesContext$ServletContextAdapter.getApplicationMap(InitFacesContext.java:331)
at javax.faces.FactoryFinder$FactoryManagerCacheKey.<init>(FactoryFinder.java:850)
at javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryManager(FactoryFinder.java:719)
at javax.faces.FactoryFinder$FactoryManagerCache.access$100(FactoryFinder.java:691)
at javax.faces.FactoryFinder.setFactory(FactoryFinder.java:373)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:666)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:417)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:348)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Nov 2, 2012 12:38:09 AM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.IllegalAccessError: com/sun/faces/context/ApplicationMap
at com.sun.faces.config.InitFacesContext$ServletContextAdapter.getApplicationMap(InitFacesContext.java:331)
at javax.faces.FactoryFinder$FactoryManagerCacheKey.<init>(FactoryFinder.java:850)
at javax.faces.FactoryFinder$FactoryManagerCache.removeApplicationFactoryManager(FactoryFinder.java:810)
at javax.faces.FactoryFinder.releaseFactories(FactoryFinder.java:395)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:378)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4831)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478)
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.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
in the tomcat lib directory i have added these jars :
commons-beanutils-1.8.3/
commons-collections-3.2.1/
commons-digester-1.5/
commons-logging-1.1.1/
el-impl-2.2/
jsf-api-2.1.11/
jsf-impl-2.1.11/
jsp-api-2.1/jstl-1.2/
primefaces-3.4.1
The application's pom file :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jsfprimeldap</groupId>
<artifactId>jsf_prime_ldap</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>jsf_prime_ldap Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>prime-repo</id>
<name>Prime Repo</name>
<url>http://repository.primefaces.org</url>
</repository>
</repositories>
<dependencies>
<!-- PrimeFaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.4.1</version>
</dependency>
<!-- JSF 2 -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<!-- EL -->
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>1.1_02</version>
</dependency>
<!-- Tomcat 6 need this <dependency> <groupId>com.sun.el</groupId> <artifactId>el-ri</artifactId>
<version>1.0</version> </dependency> -->
</dependencies>
<build>
<finalName>jsf_prime_ldap</finalName>
<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>
</configuration>
</plugin>
</plugins>
</build>
</project>
and my 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" id="WebApp_ID" version="3.0">
<display-name>jsf_prime_ldap</display-name>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<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>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
i didn't find any similar problem in google.. i wish to find the solution for this problem here.
thanks for help
in the tomcat lib directory i have added these jars : commons-beanutils-1.8.3/ commons-collections-3.2.1/ commons-digester-1.5/ commons-logging-1.1.1/ el-impl-2.2/ jsf-api-2.1.11/ jsf-impl-2.1.11/ jsp-api-2.1/jstl-1.2/ primefaces-3.4.1
Undo this step. Reinstall Tomcat altogether if you're uncertain. Do not ever touch it unless you really understand what you're doing. This is the cause of the whole problem. The classpath has become a messup and the duplicate JARs/classes are conflicting each other.
Webapp-specific JARs doesn't belong in there. They belong in /WEB-INF/lib, expect of the EL and JSP JARs; Tomcat has as being a JSP/Servlet/EL container already its own implementations for this. You should not put JSP/Servlet/EL libraries of a different container make/version in the classpath at all.
Technically, at least the both JSF JARs, the JSTL JAR and the PrimeFaces JAR should be in /WEB-INF/lib. However, as you're using Maven, it should already have taken care about this. You don't need to do anything regard this. So all you need to do is to free Tomcat from illegal JARs/classes.

Resources