org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap: java.lang.NoClassDefFoundError: javax/servlet/ServletContext

JBoss Issue Tracker | Sandeep DAS | 3 years ago
  1. 0

    JBOSS throwing Exception when trying to Restfull Webservices using JAXRS

    Stack Overflow | 3 years ago | henrycharles
    java.lang.ClassNotFoundException: javax.servlet.ServletContext from [Module "org.scannotation.scannotation:main" from local module loader @a9c09e (roots: D:\jboss-as-web-7.0.0.Final\modules)]
  2. 0

    I have developed a sample RestEasy Hello World Example for my self assessment, but when i try to run this project using JBOSS7.0 i see a printed stack trace of error mentioned below: 12:54:44,145 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/resteasy]] (MSC service thread 1-6) Exception sending context initialized event to listener instance of class org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap: java.lang.NoClassDefFoundError: javax/servlet/ServletContext at org.scannotation.WarUrlFinder.findWebInfClassesPath(WarUrlFinder.java:56) [scannotation-1.0.3.jar:] at org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap.getScanningUrls(ListenerBootstrap.java:64) [resteasy-jaxrs-2.2.1.GA.jar:] at org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap.createDeployment(ConfigurationBootstrap.java:147) [resteasy-jaxrs-2.2.1.GA.jar:] at org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap.createDeployment(ListenerBootstrap.java:32) [resteasy-jaxrs-2.2.1.GA.jar:] at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:27) [resteasy-jaxrs-2.2.1.GA.jar:] at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765) at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_18] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_18] at java.lang.Thread.run(Thread.java:619) [:1.6.0_18] Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext from [Module "org.scannotation.scannotation:main" from local module loader @a9c09e (roots: D:\jboss-as-web-7.0.0.Final\modules)] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101) 12:54:44,175 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-6) Context [/resteasy] startup failed due to previous errors 12:54:44,183 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/resteasy]] (MSC service thread 1-6) Exception sending context destroyed event to listener instance of class org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap: java.lang.NullPointerException at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextDestroyed(ResteasyBootstrap.java:37) [resteasy-jaxrs-2.2.1.GA.jar:] at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3465) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3970) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3888) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765) at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_18] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_18] at java.lang.Thread.run(Thread.java:619) [:1.6.0_18] The code which i have written for my program is as follows: Maven -> 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>com.javacodegeeks</groupId> <artifactId>resteasy</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>resteasy JEE5 Webapp</name> <url>http://maven.apache.org</url> <repositories> <repository> <id>org.jboss.resteasy</id> <url>http://repository.jboss.org/maven2/</url> </repository> </repositories> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> <version>3.0.1.Final</version> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxb-provider</artifactId> <version>2.0-beta-2</version> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jettison-provider</artifactId> <version>2.0-beta-2</version> </dependency> <dependency> <groupId>org.jboss.spec.javax.servlet</groupId> <artifactId>jboss-servlet-api_3.0_spec</artifactId> <version>1.0.0.Final</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> <finalName>resteasy</finalName> </build> </project> web.xml <web-app id="WebApp_ID" version="2.4" 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://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Restful Web Application</display-name> <!-- Auto scan REST service --> <context-param> <param-name>resteasy.scan</param-name> <param-value>true</param-value> </context-param> <!-- this need same with resteasy servlet url-pattern --> <context-param> <param-name>resteasy.servlet.mapping.prefix</param-name> <param-value>/rest</param-value> </context-param> <listener> <listener-class> org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap </listener-class> </listener> <servlet> <servlet-name>resteasy-servlet</servlet-name> <servlet-class> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher </servlet-class> </servlet> <servlet-mapping> <servlet-name>resteasy-servlet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> </web-app> MessageDriven.java package com.sandeep.resteasy; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; @Path("/message") public class MessageDriven { @GET @Path("/{param}") public Response printMessage(@PathParam("param") String msg) { String result = "Restful example : " + msg; return Response.status(200).entity(result).build(); } } Please suggest me with possible solution or let me know if i have coded wrongly in the above mentioned xml and java files.

    JBoss Issue Tracker | 3 years ago | Sandeep DAS
    org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
  3. 0

    I have developed a sample RestEasy Hello World Example for my self assessment, but when i try to run this project using JBOSS7.0 i see a printed stack trace of error mentioned below: 12:54:44,145 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/resteasy]] (MSC service thread 1-6) Exception sending context initialized event to listener instance of class org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap: java.lang.NoClassDefFoundError: javax/servlet/ServletContext at org.scannotation.WarUrlFinder.findWebInfClassesPath(WarUrlFinder.java:56) [scannotation-1.0.3.jar:] at org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap.getScanningUrls(ListenerBootstrap.java:64) [resteasy-jaxrs-2.2.1.GA.jar:] at org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap.createDeployment(ConfigurationBootstrap.java:147) [resteasy-jaxrs-2.2.1.GA.jar:] at org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap.createDeployment(ListenerBootstrap.java:32) [resteasy-jaxrs-2.2.1.GA.jar:] at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:27) [resteasy-jaxrs-2.2.1.GA.jar:] at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765) at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_18] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_18] at java.lang.Thread.run(Thread.java:619) [:1.6.0_18] Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext from [Module "org.scannotation.scannotation:main" from local module loader @a9c09e (roots: D:\jboss-as-web-7.0.0.Final\modules)] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101) 12:54:44,175 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-6) Context [/resteasy] startup failed due to previous errors 12:54:44,183 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/resteasy]] (MSC service thread 1-6) Exception sending context destroyed event to listener instance of class org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap: java.lang.NullPointerException at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextDestroyed(ResteasyBootstrap.java:37) [resteasy-jaxrs-2.2.1.GA.jar:] at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3465) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3970) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3888) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765) at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_18] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_18] at java.lang.Thread.run(Thread.java:619) [:1.6.0_18] The code which i have written for my program is as follows: Maven -> 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>com.javacodegeeks</groupId> <artifactId>resteasy</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>resteasy JEE5 Webapp</name> <url>http://maven.apache.org</url> <repositories> <repository> <id>org.jboss.resteasy</id> <url>http://repository.jboss.org/maven2/</url> </repository> </repositories> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> <version>3.0.1.Final</version> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxb-provider</artifactId> <version>2.0-beta-2</version> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jettison-provider</artifactId> <version>2.0-beta-2</version> </dependency> <dependency> <groupId>org.jboss.spec.javax.servlet</groupId> <artifactId>jboss-servlet-api_3.0_spec</artifactId> <version>1.0.0.Final</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> <finalName>resteasy</finalName> </build> </project> web.xml <web-app id="WebApp_ID" version="2.4" 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://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Restful Web Application</display-name> <!-- Auto scan REST service --> <context-param> <param-name>resteasy.scan</param-name> <param-value>true</param-value> </context-param> <!-- this need same with resteasy servlet url-pattern --> <context-param> <param-name>resteasy.servlet.mapping.prefix</param-name> <param-value>/rest</param-value> </context-param> <listener> <listener-class> org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap </listener-class> </listener> <servlet> <servlet-name>resteasy-servlet</servlet-name> <servlet-class> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher </servlet-class> </servlet> <servlet-mapping> <servlet-name>resteasy-servlet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> </web-app> MessageDriven.java package com.sandeep.resteasy; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; @Path("/message") public class MessageDriven { @GET @Path("/{param}") public Response printMessage(@PathParam("param") String msg) { String result = "Restful example : " + msg; return Response.status(200).entity(result).build(); } } Please suggest me with possible solution or let me know if i have coded wrongly in the above mentioned xml and java files.

    JBoss Issue Tracker | 3 years ago | Sandeep DAS
    org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    db:: 4.45::Dependencies exclusions ignored in jboss-deployment-structure.xml in 7.0.2.Final fj

    hivmr.com | 7 months ago
    javax.el.ELException: java.lang.reflect.InvocationTargetException
  6. 0

    unable to deploy geoserver.war in jboss 7.0

    GitHub | 2 years ago | sbalasub
    org.geoserver.GeoserverInitStartupListener: java.lang.NoClassDefFoundError: com/sun/imageio/spi/FileImageInputStreamSpi

  1. Andreas Häber 9 times, last 2 weeks ago
  2. Reich 8 times, last 2 weeks ago
  3. andyglick 1 times, last 2 months ago
  4. Cafecanudo 3 times, last 2 months ago
  5. pbabcsany 2 times, last 2 months ago
3 more registered users
75 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.ClassNotFoundException

    javax.servlet.ServletContext from [Module "org.scannotation.scannotation:main" from local module loader @a9c09e (roots: D:\jboss-as-web-7.0.0.Final\modules)]

    at org.jboss.modules.ModuleClassLoader.findClass()
  2. JBoss Modules
    ConcurrentClassLoader.loadClass
    1. org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
    2. org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)
    3. org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
    4. org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)
    5. org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)
    5 frames