Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: maven Application dosen't work , error: Servlet.init() for servlet

  1. #1
    Member
    Join Date
    Jul 2013
    Posts
    46
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default maven Application dosen't work , error: Servlet.init() for servlet

    Hallo,

    i wrote yesterday a web application and it works very well, today i tried to make the same appliction but with maven, so every time i run the the project i get the following error:
    HTML Code:
    description The server encountered an internal error () that prevented it from fulfilling this request.
    
    exception
    
    javax.servlet.ServletException: Servlet.init() for servlet Jersey Web Application threw exception
    	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    	java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	java.lang.Thread.run(Unknown Source)
    root cause
    
    com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
    	com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99)
    	com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1331)
    	com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:168)
    	com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:774)
    	com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:770)
    	com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
    	com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:770)
    	com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:765)
    	com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:489)
    	com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:319)
    	com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
    	com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
    	com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
    	com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557)
    	javax.servlet.GenericServlet.init(GenericServlet.java:160)
    	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    	java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	java.lang.Thread.run(Unknown Source)
    note The full stack trace of the root cause is available in the Apache Tomcat/7.0.12 logs.
    the pom.xml
      <dependencies>
      	<dependency>
      		<groupId>org.apache.poi</groupId>
      		<artifactId>poi</artifactId>
      		<version>3.9</version>
      	</dependency>
      	      <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1</version>
          </dependency>
          <dependency>
    	<groupId>org.json</groupId>
    	<artifactId>json</artifactId>
    	<version>20090211</version>
    </dependency>
    <dependency>
    	<groupId>org.apache.poi</groupId>
    	<artifactId>poi-ooxml</artifactId>
    	<version>3.10-beta1</version>
    </dependency>
    <dependency>
    	<groupId>javax.ws.rs</groupId>
    	<artifactId>jsr311-api</artifactId>
    	<version>1.1-ea</version>
    </dependency>
       <dependency>
                	<groupId>asm</groupId>
                	<artifactId>asm</artifactId>
                	<version>3.1</version>
       </dependency>
       <dependency>
    	<groupId>com.sun.jersey</groupId>
    	<artifactId>jersey-bundle</artifactId>
    	<version>1.17.1</version>
    </dependency>
     <dependency>
    	<groupId>javax.ws.rs</groupId>
    	<artifactId>javax.ws.rs-api</artifactId>
    	<version>2.0-m03</version>
    </dependency>
    <dependency>
    	<groupId>org.apache.axis</groupId>
    	<artifactId>axis</artifactId>
    	<version>1.4</version>
    </dependency>
                <dependency>
    	<groupId>asm</groupId>
    	<artifactId>asm-all</artifactId>
    	<version>2.2</version>
    </dependency>
                <dependency>
    	<groupId>com.sun.jersey</groupId>
    	<artifactId>jersey-core</artifactId>
    	<version>1.17.1</version>
    </dependency>
                <dependency>
    	<groupId>org.glassfish.jersey.containers</groupId>
    	<artifactId>jersey-container-servlet</artifactId>
    	<version>2.0-m04</version>
    </dependency>
                <dependency>
    	<groupId>com.sun.jersey</groupId>
    	<artifactId>jersey-servlet</artifactId>
    	<version>1.17.1</version>
    </dependency>
     
                <dependency>
    	<groupId>com.sun.jersey</groupId>
    	<artifactId>jersey-server</artifactId>
    	<version>1.17.1</version>
    </dependency>
                <dependency>
    	<groupId>org.glassfish.jersey.core</groupId>
    	<artifactId>jersey-common</artifactId>
    	<version>2.0-m01</version>
    </dependency>
                <dependency>
    	<groupId>org.glassfish.jersey.containers</groupId>
    	<artifactId>jersey-container-servlet-core</artifactId>
    	<version>2.0</version>
    </dependency>
                <dependency>
    	<groupId>com.sun.jersey</groupId>
    	<artifactId>jersey-bundle</artifactId>
    	<version>1.17.1</version>
    </dependency>
      <dependency>
    		<groupId>com.sun.jersey</groupId>
    		<artifactId>jersey-json</artifactId>
    		<version>1.8</version>
    	</dependency>
    	<dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-servlet-api</artifactId>
        <version>7.0.26</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.4</version>
      </dependency>
      <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.6.4</version>
      </dependency>
      </dependencies>
      <repositories>
    		<repository>
    			<id>maven2-repository.java.net</id>
    			<name>Java.net Repository for Maven</name>
    			<url>http://download.java.net/maven/2/</url>
    			<layout>default</layout>
    		</repository>
    	</repositories>
     
    	<build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                        <showDeprecation>true</showDeprecation>
                        <showWarnings>true</showWarnings>
                        <executable>${env.JAVA_7_HOME}/bin/javac</executable>
                        <fork>true</fork>
                    </configuration>
                </plugin>
                <plugin>
    			<groupId>org.apache.maven.plugins</groupId>
    			<artifactId>maven-war-plugin</artifactId>
    			<configuration>
    				<webResources>
    					<resource>
    						<directory>${basedir}/src/main/java</directory>
    						<targetPath>WEB-INF/classes</targetPath>
    						<includes>
    							<include>**/*.properties</include>
    							<include>**/*.xml</include>
    							<include>**/*.css</include>
    							<include>**/*.html</include>
    						</includes>
    					</resource>
    				</webResources>
    			</configuration>
    		</plugin>
            </plugins>
        </build>

    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_2_5.xsd" version="2.5">
     
      <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>pal.restfulservice</param-value>
            </init-param>
     
        <load-on-startup>1</load-on-startup>
      </servlet>
     
      <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/maven/*</url-pattern>
      </servlet-mapping>
     
      <session-config>
        <session-timeout>30</session-timeout>
      </session-config>
    </web-app>

    i don't have any idea why that happend, but i thing there are some type of conflict in pom.xml in dependencies, but i am not sure

    any idea?


  2. #2
    Junior Member
    Join Date
    May 2011
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: maven Application dosen't work , error: Servlet.init() for servlet

    Hello, from what I can find online this seems to be a problem finding the java file itself: java - Running Jersey Servlet on Jetty - Error: The ResourceConfig instance does not contain any root resource classes - Stack Overflow

    edit: you could also try http://stackoverflow.com/questions/4...source-classes

Similar Threads

  1. send and receive byte array form servlet to another servlet via url
    By diga88 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: June 11th, 2013, 09:40 PM
  2. Call service() from init() in servlet
    By krupam790 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 10th, 2013, 09:00 PM
  3. servlet init param
    By abani in forum Java Servlet
    Replies: 2
    Last Post: November 16th, 2011, 09:19 AM
  4. collecting information/moving from servlet to servlet
    By CBird in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 1st, 2011, 07:04 PM