Discussion:
[jboss-user] [JBoss Web Services] - Re: JBossWS + CXF + Spring + Maven triggers "java.lang.NoClassDefFoundError: javax/servlet/ServletException"
Jim Ma
2013-02-18 10:51:14 UTC
Permalink
Jim Ma [https://community.jboss.org/people/jim.ma] created the discussion

"Re: JBossWS + CXF + Spring + Maven triggers "java.lang.NoClassDefFoundError: javax/servlet/ServletException""

To view the discussion, visit: https://community.jboss.org/message/798139#798139

--------------------------------------------------------------
JBossWS-CXF can install the spring as modules in AS7, you don't need to include them in maven dependency. Can you try to install the spring module to  AS7 under jbossws-cxf-bin-dist with:
ant -Djboss.bind.address=your-address -Djbossws-integration.target=jboss711 -Djboss711.home=$AS7_HOME -Dspring=true deploy-jboss711

to see if that helps ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/798139#798139]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
stephen b
2013-02-23 21:30:19 UTC
Permalink
stephen b [https://community.jboss.org/people/slbanal] created the discussion

"Re: JBossWS + CXF + Spring + Maven triggers "java.lang.NoClassDefFoundError: javax/servlet/ServletException""

To view the discussion, visit: https://community.jboss.org/message/799214#799214

--------------------------------------------------------------
I tried that but the problem still persist. The problem only happens if I install JBossWS-CXF and create a jbossws-cxf.xml file under WEB-INF directory.

I set log level to TRACE and I saw these lines seems to have caused the issue:

+08:22:38,986 TRACE [org.jboss.modules] (http--127.0.0.1-8083-1) Finding class javax.servlet.ServletException from Module "org.jboss.ws.jaxws-client:main" from local module loader @13f7281 (roots: /Users/stephen/Programs/jboss-as-7.1.1.Final/modules)+
+08:22:38,987 TRACE [org.jboss.modules] (http--127.0.0.1-8083-1) Class javax.servlet.ServletException not found from Module "org.jboss.ws.jaxws-client:main" from local module loader @13f7281 (roots: /Users/stephen/Programs/jboss-as-7.1.1.Final/modules)+

Any clues as to what is the issue? I attached the complete log file.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799214#799214]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
stephen b
2013-02-24 05:04:45 UTC
Permalink
stephen b [https://community.jboss.org/people/slbanal] created the discussion

"Re: JBossWS + CXF + Spring + Maven triggers "java.lang.NoClassDefFoundError: javax/servlet/ServletException""

To view the discussion, visit: https://community.jboss.org/message/799219#799219

--------------------------------------------------------------
At last I figured out the issue!

It looks like JBossWS-CXF jax-ws-client module have some issues in its dependencies thus causing the stack to throw a "+javax.servlet.ServletException"+ due to some missing dependency to "javax.servlet.api" module. I did  the following steps to diagnose and fix the issue:

1. I fixed the module dependency issue of "+org.jboss.ws.jaxws-client" module in JBoss. I modified file JBOSS_HOME/+modules/org/jboss/ws/jaxws-client/main/module.xml and added line under <dependencies/> section.
       <module name="javax.servlet.api" />

    After this fix, JBossWS-CXF is now throwing the correct error. Example stack trace below:

     15:54:14,958 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/jboss-as-helloworld-ws].[HelloWorldService]] (http--127.0.0.1-8083-1) Servlet.service() for servlet                HelloWorldService threw exception: javax.servlet.ServletException: JBWS024029: Cannot obtain destination for /jboss-as-helloworld-ws/hello-world
                  at org.jboss.wsf.stack.cxf.RequestHandlerImpl.findDestination(RequestHandlerImpl.java:168)
                  at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:85)
                  at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:156)
                  at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)

2. I changed my  jbossws-cxf.xml and fixed the jaxws endpoint address

  From:

+    <jaxws:endpoint implementor="#HelloWorldService"+
+        address="/hello-world">+
+    </jaxws:endpoint>+

  To:

   <jaxws:endpoint implementor="#HelloWorldService"
        address="*/jboss-as-helloworld-ws*/hello-world">
    </jaxws:endpoint>


I don't understand why +org.jboss.ws.jaxws-clientI+ module doesn't have a dependency on javax.servlet.api dependency if it is throwing a ServletException.
Could this be a bug that I should report?

Thanks
Stephen
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799219#799219]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Alessio Soldano
2013-02-25 06:51:05 UTC
Permalink
Alessio Soldano [https://community.jboss.org/people/asoldano] created the discussion

"Re: JBossWS + CXF + Spring + Maven triggers "java.lang.NoClassDefFoundError: javax/servlet/ServletException""

To view the discussion, visit: https://community.jboss.org/message/799286#799286

--------------------------------------------------------------
mmh... weird, do you perhaps have the servlet api jar included in your deployment?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799286#799286]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
stephen b
2013-02-25 08:26:49 UTC
Permalink
stephen b [https://community.jboss.org/people/slbanal] created the discussion

"Re: JBossWS + CXF + Spring + Maven triggers "java.lang.NoClassDefFoundError: javax/servlet/ServletException""

To view the discussion, visit: https://community.jboss.org/message/799304#799304

--------------------------------------------------------------
Hi Alesion,

Here are the files in my war file. Does Spring library affect CXF? The code depends on both context and web spring libraries due to context loader configured in applicationContext.xml.

     0 Mon Feb 25 19:22:32 EST 2013 META-INF/
   126 Mon Feb 25 19:22:30 EST 2013 META-INF/MANIFEST.MF
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/classes/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/classes/org/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/classes/org/jboss/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/classes/org/jboss/as/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/classes/org/jboss/as/quickstarts/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/classes/org/jboss/as/quickstarts/wshelloworld/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/classes/org/myapp/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/classes/org/myapp/service/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/classes/org/myapp/service/connection/
     0 Mon Feb 25 19:22:30 EST 2013 WEB-INF/lib/
  1481 Sun Feb 24 18:35:56 EST 2013 WEB-INF/applicationContext.xml
  2777 Mon Feb 25 19:22:28 EST 2013 WEB-INF/classes/HelloService.wsdl
   620 Mon Feb 25 19:22:28 EST 2013 WEB-INF/classes/org/jboss/as/quickstarts/wshelloworld/HelloWorldService.class
  3104 Mon Feb 25 19:22:28 EST 2013 WEB-INF/classes/org/jboss/as/quickstarts/wshelloworld/HelloWorldServiceImpl.class
   762 Mon Feb 25 19:22:28 EST 2013 WEB-INF/classes/org/myapp/service/connection/Connection.class
   311 Sat Feb 23 13:24:38 EST 2013 WEB-INF/faces-config.xml
  2253 Sun Feb 24 20:41:06 EST 2013 WEB-INF/jbossws-cxf.xml
  4467 Sun Feb 26 01:15:56 EST 2012 WEB-INF/lib/aopalliance-1.0.jar
60686 Thu Dec 30 22:16:34 EST 2010 WEB-INF/lib/commons-logging-1.1.1.jar
321190 Sat Feb 16 14:38:12 EST 2013 WEB-INF/lib/spring-aop-3.0.5.RELEASE.jar
53082 Sat Feb 16 14:38:10 EST 2013 WEB-INF/lib/spring-asm-3.0.5.RELEASE.jar
555410 Sat Feb 16 14:38:20 EST 2013 WEB-INF/lib/spring-beans-3.0.5.RELEASE.jar
668861 Sat Feb 16 14:38:24 EST 2013 WEB-INF/lib/spring-context-3.0.5.RELEASE.jar
382442 Sat Feb 16 14:38:12 EST 2013 WEB-INF/lib/spring-core-3.0.5.RELEASE.jar
169752 Sat Feb 16 14:38:14 EST 2013 WEB-INF/lib/spring-expression-3.0.5.RELEASE.jar
395587 Sat Feb 16 14:38:24 EST 2013 WEB-INF/lib/spring-web-3.0.5.RELEASE.jar
  1673 Sun Feb 24 17:50:20 EST 2013 WEB-INF/web.xml
     0 Mon Feb 25 19:22:32 EST 2013 META-INF/maven/
     0 Mon Feb 25 19:22:32 EST 2013 META-INF/maven/org.jboss.as.quickstarts/
     0 Mon Feb 25 19:22:32 EST 2013 META-INF/maven/org.jboss.as.quickstarts/jboss-as-helloworld-ws/
16173 Mon Feb 25 19:22:18 EST 2013 META-INF/maven/org.jboss.as.quickstarts/jboss-as-helloworld-ws/pom.xml
   140 Mon Feb 25 19:22:32 EST 2013 META-INF/maven/org.jboss.as.quickstarts/jboss-as-helloworld-ws/pom.properties
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799304#799304]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Alessio Soldano
2013-02-25 14:19:27 UTC
Permalink
Alessio Soldano [https://community.jboss.org/people/asoldano] created the discussion

"Re: JBossWS + CXF + Spring + Maven triggers "java.lang.NoClassDefFoundError: javax/servlet/ServletException""

To view the discussion, visit: https://community.jboss.org/message/799374#799374

--------------------------------------------------------------
Hi Stephen,
I've checked and this is actually a bug, see https://issues.jboss.org/browse/JBWS-3602 https://issues.jboss.org/browse/JBWS-3602 .
Thanks for the report!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799374#799374]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
stephen b
2013-02-26 07:50:48 UTC
Permalink
stephen b [https://community.jboss.org/people/slbanal] created the discussion

"Re: JBossWS + CXF + Spring + Maven triggers "java.lang.NoClassDefFoundError: javax/servlet/ServletException""

To view the discussion, visit: https://community.jboss.org/message/799526#799526

--------------------------------------------------------------
Thanks Allesio.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799526#799526]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Loading...