I have a project developed under Eclipse with JBoss tools installed. When I deploy the application to the Jboss server, some helper jar files which are made available to the project through Maven are not copied inside the WEB-INF/lib folder. Hence, I get a ClassNotFound exception at runtime.
Is there any approach to convince Eclipse (or Maven) to copy the jars into the lib folder at deployment?
EDIT: the pom.xml looks like:
<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.whatever.simulators</groupId>
<artifactId>eebuildingsim</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>eebuildingsim Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- begin JBoss -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.2.FINAL</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<version>2.3.0.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.2</version>
<scope>provided</scope>
</dependency>
<!-- end JBoss -->
<dependency>
<groupId>ro.mysite</groupId>
<artifactId>petrinetexec</artifactId>
<version>0.1.3.81</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.whatever.myAuxiliaryStuff</groupId>
<artifactId>myAuxiliaryStuff </artifactId>
<version>0.1.0.1305</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.0-m09</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.0-m09</version>
</dependency>
</dependencies>
<build>
<finalName>eebuildingsim</finalName>
</build>
The artifact myAuxiliaryStuff should be deployed under WEB-INF/lib, under the jboss deployment server.
Using:
Eclipse: Juno Service Release 1
Jboss: 7.1.1. final
m2e 1.3.1.20130219-1424
eclipse web tools platform 3.4.2.v2013
Later edit: the error reported in jboss' log file looks like:
12:31:38,507 INFO [org.jboss.weld.deployer] (MSC service thread 1-5)
JBAS016002: Processing weld deployment mywar.war 12:31:38,522 ERROR
[org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed
to start service jboss.deployment.unit."mywar.war".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."mywar.war".POST_MODULE: Failed to process phase
POST_MODULE of deployment "mywar.war" at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119)
[jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
[rt.jar:1.7.0_05] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
[rt.jar:1.7.0_05] at java.lang.Thread.run(Thread.java:722)
[rt.jar:1.7.0_05] Caused by: java.lang.NoSuchFieldError: FLOW at
com.sun.faces.flow.FlowDiscoveryCDIExtension.<clinit>(FlowDiscoveryCDIExtension.java:90)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method) [rt.jar:1.7.0_05] at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
[rt.jar:1.7.0_05] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[rt.jar:1.7.0_05] at
java.lang.reflect.Constructor.newInstance(Constructor.java:525)
[rt.jar:1.7.0_05] at
org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.loadExtension(WeldPortableExtensionProcessor.java:117)
at
org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.loadAttachments(WeldPortableExtensionProcessor.java:100)
at
org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.deploy(WeldPortableExtensionProcessor.java:86)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113)
[jboss-as-server-7.1.1.Final.jar:7.1.1.Final] ... 5 more
12:31:38,522 INFO [org.jboss.as.server] (DeploymentScanner-threads -
2) JBAS015870: Deploy of deployment "mywar.war" was rolled back with
failure message {"JBAS014671: Failed services" =>
{"jboss.deployment.unit.\"mywar.war\".POST_MODULE" =>
"org.jboss.msc.service.StartException in service
jboss.deployment.unit.\"mywar.war\".POST_MODULE: Failed to process
phase POST_MODULE of deployment \"mywar.war\""}} 12:31:38,647 INFO
[org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877:
Stopped deployment mywar.war in 115ms 12:31:38,647 INFO
[org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774:
Service status report JBAS014775: New missing/unsatisfied
dependencies:
service jboss.naming.context.java.module.mywar.mywar (missing) dependents: [service
jboss.naming.context.java.module.mywar.mywar.ValidatorFactory, service
jboss.naming.context.java.module.mywar.mywar.Validator] JBAS014777:
Services which failed to start: service
jboss.deployment.unit."mywar.war".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."mywar.war".POST_MODULE: Failed to process phase
POST_MODULE of deployment "mywar.war"
12:31:38,647 ERROR [org.jboss.as.server.deployment.scanner]
(DeploymentScanner-threads - 1) {"JBAS014653: Composite operation
failed and was rolled back. Steps that failed:" => {"Operation step-2"
=> {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"mywar.war\".POST_MODULE" =>
"org.jboss.msc.service.StartException in service
jboss.deployment.unit.\"mywar.war\".POST_MODULE: Failed to process
phase POST_MODULE of deployment \"mywar.war\""}}}}
Eclipse and the plugins are a bit finicky. This is what I've done to get it to work.
Project -> Properties -> Deployment Assembly
Add...
Java Build Path Entries (Next >)
Maven Dependencies (Finish)
The Deploy Properties panel should now include an entry for Source: Maven Dependecies -> Deploy Path: WEB_INF/lib
This is suspicious:
java.lang.NoSuchFieldError: FLOW
Which is related to JSF, if I'm not mistaken. I've got a few suggestions but I'm not an expert in any aspect.
First try to add provided dependency scope for jsf-api and jsf-impl like this (since the JBoss has them):
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.0-m09</version>
<scope>provided</scope> // <----- do it for both
</dependency>
AFAIK, JBoss 7.1.1 already has the JSF 2.1.7. So, if you really need the JSF 2.2 you should update the JSF module in JBoss. Here is how to Migration to JSF 2.2.
Another option is to bundle the JSF in to your WAR and inform JBoss to exclude the container version (the one that is shipped with JBoss) of it:
in web.xml add:
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
and in jboss-deployment-structure.xml exclude the JBoss's implementation:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="javax.faces.api" />
</exclusions>
.
.
.
Based on your description, you only have Eclipse and JBoss Tools in use and dependencies stored in Maven pom files. For Eclipse to become aware of those dependencies, you need to have eclipse-maven integration. M2e is the common choice for it.
So you would need these installed:
m2e
m2e-wtp
Go to the directory where your pom.xml resides and execute following command.
mvn package
This command should create a war file for you to deploy to your application server. This file is a zip file, look to its contents and see if your myAuxiliaryStuff.jar is in web-inf/lib. If it is, your problem lies with eclipse integration with maven.
You seem to have everything installed.
I had this problem too.
Just needed to right click on the project and choose.
"Mark as Deployable"
Related
after deploying my application over WildFly I see the following messages:
2017-02-15 10:06:51,440 ERROR [org.jboss.msc.service.fail]
(ServerService Thread Pool -- 178) MSC000001: Failed to start service
jboss.undertow.deployment.default-server.default-host./cati:
org.jboss.msc.service.StartException in service
jboss.undertow.deployment.default-server.default-host./cati:
java.lang.NoSuchMethodError:
org.apache.tomcat.util.descriptor.DigesterFactory.newDigester(ZZLorg/apache/tomcat/util/digester/RuleSet;Z)Lorg/apache/tomcat/util/digester/Digester;
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320) Caused by: java.lang.NoSuchMethodError:
org.apache.tomcat.util.descriptor.DigesterFactory.newDigester(ZZLorg/apache/tomcat/util/digester/RuleSet;Z)Lorg/apache/tomcat/util/digester/Digester;
at org.apache.tomcat.util.descriptor.tld.TldParser.(TldParser.java:49)
at org.apache.tomcat.util.descriptor.tld.TldParser.(TldParser.java:44)
at org.apache.jasper.servlet.TldScanner.(TldScanner.java:79)
at org.apache.jasper.servlet.JasperInitializer.newTldScanner(JasperInitializer.java:120)
at org.eclipse.jetty.apache.jsp.JettyJasperInitializer.newTldScanner(JettyJasperInitializer.java:115)
at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:101)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:184)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
... 6 more
in my maven project I also import the following depdencies
<!-- GWT -->
<!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-user -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-servlet -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-dev -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util-scan</artifactId>
<version>8.5.2</version>
</dependency>
As I read over the WildFly project the Tomcat container was removed that why I added the following dependecies :
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util-scan</artifactId>
<version>8.5.2</version>
</dependency>
any ideea how to bypass this error message ?
Of course is not working , as you can see if you add for testing the following depedency (gwt-dev):
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.8.0</version>
</dependency>
is including the jetty server and this is one of the movtiv for receving the message from my first question.
Be sure to not clutter the server side with compile time dependencies.
gwt-servlet is needed only for runtime, gwt-dev and gwt-user should be set to provided - which results in having them available for compiling to JavaScript, but leaving them out in the final WAR file on the application server.
<!-- GWT -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
</dependency>
But after all it looks to me like you should not try to put any Tomcat libraries in the WildFly server as it already contains everything to run the server part of your application.
Therefore just stick to the plain servlet API like so:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
It is provided again, as WildFly has it built-in.
Can you try to exclude the Tomcat dependencies and see if it works for you?
I am trying to build a plugin for netbeans using maven and for some reason Netbeans doesn't recognize xercesimpl.jar packaged with the plugin. Here is the stacktrace I see.
java.io.IOException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:353)
at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:276)
at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:207)
at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createSVGDocument(SAXSVGDocumentFactory.java:105)
[catch] at org.netbeans.modules.plantumlnb.SVGImagePreviewPanel.createSVGDocument(SVGImagePreviewPanel.java:59)
at org.netbeans.modules.plantumlnb.SVGImagePreviewPanel.renderSVGFile(SVGImagePreviewPanel.java:48)
at org.netbeans.modules.plantumlnb.RenderImageThread$1.run(RenderImageThread.java:56)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Here is the image showing that the xercesimpl.jar is indeed packaged with the nbm file.
Here is a list of all the jars that were downloaded during build process.
NBM Plugin generates manifest
Adding on module's Class-Path:
net.sourceforge.plantuml:plantuml:jar:7959
batik:batik-swing:jar:1.6-1
batik:batik-bridge:jar:1.6-1
batik:batik-gvt:jar:1.6-1
batik:batik-awt-util:jar:1.6-1
batik:batik-script:jar:1.6-1
rhino:js:jar:1.5R4.1
batik:batik-svg-dom:jar:1.6-1
batik:batik-dom:jar:1.6-1
batik:batik-xml:jar:1.6-1
xerces:xercesImpl:jar:2.5.0
batik:batik-parser:jar:1.6-1
batik:batik-css:jar:1.6-1
batik:batik-rasterizer:jar:1.6-1
batik:batik-transcoder:jar:1.6-1
fop:fop:jar:0.20.5
batik:batik-1.5-fop:jar:0.20-5
xml-apis:xml-apis:jar:1.0.b2
xalan:xalan:jar:2.4.1
avalon-framework:avalon-framework:jar:4.0
batik:batik-util:jar:1.6-1
batik:batik-gui-util:jar:1.6-1
batik:batik-ext:jar:1.6-1
xml-apis:xmlParserAPIs:jar:2.0.2
org.axsl.org.w3c.dom.svg:svg-dom-java:jar:1.1
org.axsl.org.w3c.dom.smil:smil-boston-dom-java:jar:2000-02-25
org.w3c.css:sac:jar:1.3
crimson:crimson:jar:1.1.3
I am not sure what I am missing, any help is appreciated.
My dependencies weren't right, so once I fixed them, it started recognizing. For anybody looking to include Batik in their maven based netbeans module I am including the dependencies below.
<dependency>
<groupId>batik</groupId>
<artifactId>batik-swing</artifactId>
<version>1.6-1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-script</artifactId>
<version>1.6-1</version>
<!-- exclude xerces as Netbeans includes it -->
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- include xerces in test scope as unittests need it -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.5.0</version>
<type>jar</type>
<scope>test</scope>
</dependency>
I'm migrating an application from JBoss 6.1.0 JBoss EAP 4.2.xa.
I know I have changed many things, one of the most important is that JBoss now includes most of the framework / most used libraries (modules), which is great (war files smaller).
Now, I have two applications, both mounted with Spring / CXF and Maven2. One exposes a web services and the second for the first client.
The problem is in the client application, at runtime, when I try to instantiate the proxy web service I get the following error:
------ java.lang.NoClassDefFoundError: org/apache/cxf/jaxws/JaxWsProxyFactoryBean
at es....MyFactory.getService_WSC(MyFactory.java:59)
...
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
...
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
...
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassNotFoundException: org.apache.cxf.jaxws.JaxWsProxyFactoryBean from [Module "deployment.myapp.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:399)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) ... 21 more ------
In my pom.xml, I have the following (CXF as provided):
<properties>
<cxf.version>2.6.6</cxf.version>
<cxf.scope>provided</cxf.scope>
</properties>
<!-- CXF -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
<scope>${cxf.scope}</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
<scope>${cxf.scope}</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
<scope>${cxf.scope}</scope>
</dependency>
Could include CXF libraries but presumably this is not necessary and that JBoss EAP 6 already has them?, Though, if this is so why do I get the error above NoClassDefFoundError -> Caused by: java.lang.ClassNotFoundException?
Thank you!
Finally I've solved it.
First of all, thank willome response.
By the nature of the services architecture (implemented with Apache CXF) I preferred to solve using CXF.
JBoss EAP 6 embed a full version of CXF framework, with the particularity that is "divided" into modules and the key has been to identify exactly the modules included in the application.
The good thing about all this is that the war now are very light, and you can NOT include the vast majority of frameworks / libraries ... in my case I went from one war of 30MB to final 5MB.
Then finally I added the file to the application jboss-deployment-structure.xml, with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.jboss.ws.cxf.jbossws-cxf-client" services="import" />
<module name="org.apache.cxf.impl">
<imports>
<include path="META-INF"/>
<include path="META-INF/cxf"/>
</imports>
</module>
<!-- ... -->
</dependencies>
</deployment>
</jboss-deployment-structure>
And I kept the scope "provided" in my pom.xm for CXF framework.
Your CXF libraries scope is <cxf.scope>provided</cxf.scope>. I am not sure if JBoss EAP 6 is embedding CXF-jaxrs (the REST part of CXF - you should inspect the jboss version of CXF 2.4.x-redhat-1). I think it uses Rest Easy instead. So it will not find org/apache/cxf/jaxws/JaxWsProxyFactoryBean.
Change the scope of cxf-rt-frontend-jaxws from provided to compile.
See https://access.redhat.com/site/articles/112673 to get the list of all embedded libs inside Jboss EAP 6.x
I am migrating project from jBoss-eap-5.1 to jboss-eap-6.0. I have defined jersey jars in the modules directory of jboss as follows:
com
|_jersey
|_jersey-core
|_jersey-client
|_jersey-server
|_jersey-servlet
In my project .pom file i defined the jars as follows:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.10</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>${jersey-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
However, when I try to deploy, I get the following error on ServletContainer class:
13:03:29,908 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.subunit."ApiEar-2.0.0-SNAPSHOT.ear"."ApiService-2.
0.0-SNAPSHOT.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."ApiEar-2.0.0-SNAPSHOT.ear"."ApiService-2.0.0-SNAPSHOT.war".POST_MODULE
: JBAS018733: Failed to process phase POST_MODULE of subdeployment "ApiService-2.0.0-SNAPSHOT.war" of deployment "ApiEar-2.0.0-SNAPSHOT.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:123) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_32-ea]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_32-ea]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_32-ea]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer from [Modu
le "deployment.ApiEar-2.0.0-SNAPSHOT.ear.ApiService-2.0.0-SNAPSHOT.war:main" from Service Module Loader]
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:295)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scanWebDeployment(JaxrsScanningProcessor.java:160)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:109)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]
... 5 more
Initially, I was getting this error when I did not define jersey-servlet, but I did some searching, and presumably, jersey-servlet.jar is the one that contains that class. However, that did solve the error.
I have solved the issue by adding this dependencies into my manifest.mf file. In my .pom file I added the build plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Dependencies>com.jersey.jersey-server,com.jersey.jersey-client,com.jersey.jersey-json</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
that added references to the needed .jar files in my manifest file
Not an answer, but I believe this was implemented in jersey in version 10. That is when big overhaul of library happened
I migrating project on jboss as 7 from jersey version 1.9 to 1.17 and I get the following exception:
12:05:48,573 WARN [org.jboss.as.ee] (MSC service thread 1-10) JBAS011006: Not installing optional component com.sun.jersey.server.impl.container.servlet.Include due to except
ion: java.lang.ClassNotFoundException: com.sun.jersey.server.impl.container.servlet.Include from [Module "deployment.ApiEar-2.0.0-SNAPSHOT.ear.ApiService-2.0.0-SNAPSHOT.war:ma
in" from Service Module Loader]
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.performLoadClassChecked(ConcurrentClassLoader.java:423)
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.6.0_32-ea]
at java.lang.Class.forName(Class.java:247) [rt.jar:1.6.0_32-ea]
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-redhat-1.jar:7.1.2.Final-
redhat-1]
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$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_32-ea]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_32-ea]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_32-ea]
code runs fine under 1.9. Here are my dependencies:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.9.1</version>
</dependency>
what could cause such an exception?
I think your problem is related to the fact that Jersey was changed quite a bit from version 1.9 to 1.10; namely there was a big change to Servlet functionality. You can read more here: Jersey 1.10 released
As far as your problem goes, I think you simply missing some dependencies. I know I had to add the following to my .pom file:
<!-- Jersey 1.17 dependencies -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>${jersey-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>
<!-- end Jersey 1.17 dependencies -->