Grails
  1. Grails
  2. GRAILS-6309

ClassNotFoundException with servlet located in a jar file while using Tomcat 'plug-in'

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2, 1.3.1
    • Fix Version/s: None
    • Component/s: Plugins
    • Labels:
      None
    • Environment:
      OSX & Windows XP

      Description

      Hi guys,

      I've found an issue adding additional sevlets to my grails app when the servlet classes are stored within jar files. I've re-created this issue with both Grails 1.2.2 & 1.3.1.

      It throws a ClassNotFoundException when you run-app (see snippet below). But if I place the source of the servlet in the src/java folder it works fine.

      java.lang.ClassNotFoundException: uk.co.tribal.HelloWorld
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
      at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
      at org.grails.tomcat.ParentDelegatingClassLoader.findClass(TomcatServer.groovy:327)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)

      To recreate extract the attached zip & run grails run-app. You should see an error similar to above. To then see this servlet working remove the jar from the lib folder and copy the servlet source from the src/java.tmp folder to the src/java folder. Following a grails run-app, this will now start successfully without error.

      This appears to be an issue when the Tomcat plug-in is used, as it works find with Jetty.

      Tim..

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Tim
          • Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development