ankit.pandey3 -8 Junior Poster in Training

Hi Friends,
I have tomcat 7 and eclipse.
My problem is when I start tomcat without war file it starts successfully but when I am Adding my war file by right clicking on Tomcat Server in eclipse, it gives in following exception :

java.lang.RuntimeException: Unable to scan WEB-INF for JAX-RS annotations, you must manually register your classes/resources
    at org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap.createDeployment(ConfigurationBootstrap.java:177)
    at org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap.createDeployment(ListenerBootstrap.java:32)
    at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:27)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Unable to scan directory of protocol: jndi
    at org.scannotation.archiveiterator.IteratorFactory.create(IteratorFactory.java:39)
    at org.scannotation.AnnotationDB.scanArchives(AnnotationDB.java:323)
    at org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap.createDeployment(ConfigurationBootstrap.java:163)
    ... 12 more
Dec 11, 2014 12:04:20 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Dec 11, 2014 12:04:20 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/extBlueDartInterface] startup failed due to previous errors
Dec 11, 2014 12:04:20 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: 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)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5035)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5687)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Can anyone please tell me what I am doing wrong ??
It's urgent. Please reply ASAP.

Thanks in advance
Ankit Pandey

Dani AI

Generated

— short diagnosis and practical fixes.

This error usually means RESTEasy's auto-scanner (which uses Scannotation) hit a classpath entry it cannot handle (a URL with the "jndi" protocol when Eclipse/Tomcat are serving the module directly), so scanning fails and RESTEasy aborts with the "you must manually register" message. This commonly shows up when running a Tomcat server from Eclipse with the WTP "serve modules without publishing" behavior. (mkyong.com)

Fast, low-risk workarounds

  • Disable RESTEasy auto-scanning and register resources/providers explicitly via web.xml context params (or an Application subclass). This avoids any archive scanning code entirely. Example (web.xml snippet):

    <context-param>
      <param-name>resteasy.scan</param-name>
      <param-value>false</param-value>
    </context-param>
    <context-param>
      <param-name>resteasy.resources</param-name>
      <param-value>com.example.MyResource,com.example.OtherResource</param-value>
    </context-param>

    Preferably, with Servlet 3+ create an Application class or use resteasy-servlet-initializer and return the resource set programmatically. RESTEasy documents both approaches and notes the scan flags are legacy when using Servlet 3.0 initializers. (docs.jboss.org)

Tomcat/Eclipse and library fixes to try

  • If you need hot-deploy from Eclipse, turn off "Serve modules without publishing" in the Tomcat server editor (or publish a real WAR) so class/resource URLs are normal file/jar URLs rather than workspace/jndi-backed URLs. The WTP loader can produce nonstandard resource protocols that Scannotation chokes on. (stackoverflow.com)
  • Verify WEB-INF/lib for duplicate or corrupt JARs (scannotation, resteasy-multipart, etc.). Some reported fixes came from swapping problem JAR versions or disabling problematic providers (see reported resteasy multipart/scannotation issues). (mkyong.com)

If the quick fixes do not help, capture the full Catalina log, list WEB-INF/lib contents, and try deploying the same WAR to a standalone Tomcat outside Eclipse — that will quickly show whether the problem is deployment-mode (Eclipse/WTP) or a library/version issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.