1 Reply Latest reply on Aug 7, 2014 11:50 AM by James Perkins

    Class Not Found Exception

    Ricki Lambert Newbie

      I am getting the following error when I deploy to jboss.

      I appreciate that the error should tell me everything I need to know - The class can not be found therefore I am missing a jar.

      Failed to process phase POST_MODULE of deployment "swipedserver-1.0.war"

        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_11]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_11]

        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_11]

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer from [Module "deployment.swipedserver-1.0.war:main" from Service Module Loader]

        at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:287)

        at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scanWebDeployment(JaxrsScanningProcessor.java:152)

        at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:103)

        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]

        ... 5 more

      Caused by: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer from [Module "deployment.swipedserver-1.0.war:main" from Service Module Loader]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final-redhat-2]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final-redhat-2]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final-redhat-2]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final-redhat-2]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final-redhat-2]

        at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:285)

        ... 8 more

      However, if you look at my pom the values are clearly in there. I have tried with various jersey versions up to the most recent 1.81 however still no joy

      <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>swipedserver</groupId>

        <artifactId>swipedserver</artifactId>

        <version>1.0</version>

        <packaging>war</packaging>

        <build>

        <sourceDirectory>src</sourceDirectory>

        <testSourceDirectory>test</testSourceDirectory>

        <resources>

        <resource>

        <directory>src</directory>

        <excludes>

        <exclude>**/*.java</exclude>

        </excludes>

        </resource>

        <resource>

        <directory>resources</directory>

        <includes>

        <include>**/*.p12</include>

        <include>**/*.properties</include>

        </includes>

        </resource>

        </resources>

        <plugins>

        <plugin>

        <artifactId>maven-compiler-plugin</artifactId>

        <version>3.1</version>

        <configuration>

        <source>1.7</source>

        <target>1.7</target>

        </configuration>

        </plugin>

       

        <plugin>

        <artifactId>maven-war-plugin</artifactId>

        <version>2.3</version>

        <configuration>

        <warSourceDirectory>WebContent</warSourceDirectory>

        <failOnMissingWebXml>false</failOnMissingWebXml>

        </configuration>

        </plugin>

        <plugin>

        <groupId>org.codehaus.mojo</groupId>

        <artifactId>sonar-maven-plugin</artifactId>

        <version>2.1</version>

        </plugin>

        </plugins>

        </build>

        <dependencies>

       

        <dependency>

        <groupId>core</groupId>

        <artifactId>core</artifactId>

        <version>1.0</version>

        </dependency>

        <dependency>

        <groupId>com.sun.jersey</groupId>

        <artifactId>jersey-server</artifactId>

        <version>1.18.1</version>

        </dependency>

       

        <dependency>

        <groupId>asm</groupId>

        <artifactId>asm</artifactId>

        <version>1.5.3</version>

        </dependency>

        <dependency>

        <groupId>com.ninja-squad</groupId>

        <artifactId>DbSetup</artifactId>

        <version>1.3.0</version>

        <scope>test</scope>

        </dependency>

        <dependency>

        <groupId>mysql</groupId>

        <artifactId>mysql-connector-java</artifactId>

        <version>5.1.31</version>

        </dependency>

        <dependency>

        <groupId>log4j</groupId>

        <artifactId>log4j</artifactId>

        <version>1.2.16</version>

        </dependency>

        <dependency>

        <groupId>com.sun.jersey.contribs</groupId>

        <artifactId>jersey-multipart</artifactId>

        <version>1.17.1</version>

        </dependency>

        <dependency>

        <groupId>com.fasterxml.jackson.core</groupId>

        <artifactId>jackson-core</artifactId>

        <version>2.3.0</version>

        </dependency>

       

        </dependencies>

      </project>

      EDIT

      If i change my pom to include

         <configuration> <archive> <manifestEntries> <Dependencies>com.jersey.jersey-server,com.jersey.jersey-client</Dependencies> </manifestEntries> </archive>

      and my manifest to look like

      Manifest-Version: 1.0 Class-Path: jersey-server.jar, jersey-client.jar

      Then i get the following exception - which is a little different

      Caused by: org.jboss.modules.ModuleNotFoundException: com.jersey.jersey-server:main at org.jboss.modules.Module.addPaths(Module.java:1030) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.modules.Module.link(Module.java:1386) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.modules.Module.relinkIfNecessary(Module.java:1414) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:242) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:70) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] ... 5 more