I am running an embedded container 7.0.26 that loads the web application
classes and external JARS using the method 
http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/loader/WebappLoader.html#addRepository%28java.lang.String%29
WebappLoader#addRepository(java.lang.String) . One of the external JARs is
spring-web with version 3.1. That JAR file provides the class 
http://static.springsource.org/spring/docs/3.1.0.M2/javadoc-api/org/springframework/web/SpringServletContainerInitializer.html
SpringServletContainerInitializer  annotated with @HandlesTypes to load
implementations of 
http://static.springsource.org/spring/docs/3.1.0.M2/javadoc-api/org/springframework/web/WebApplicationInitializer.html
WebApplicationInitializer  for web apps that don't provide a web.xml.

In my application I provide an implementation of WebApplicationInitializer.
This is found if I add my compiled class files as JAR file using
WebappLoader#addRepository(java.lang.String) - the web application gets
configured correctly. However, adding the classes directory instead will not
resolve the class. This sounds like some kind of class loading issue to me.

As a side-note the web application is loaded just fine when you provide a
web.xml (Servlet compatibility < 3.0). All classes can be resolved and used.
You can have a look at the 
https://github.com/bmuschko/gradle-tomcat-plugin/blob/master/plugin/src/main/groovy/org/gradle/api/plugins/tomcat/TomcatRun.groovy#L70
source code here .

I had posted this issue as a 
https://issues.apache.org/bugzilla/show_bug.cgi?id=52853 bug . As a response
I got a comment to set the context's JarScanner field scanAllDirectories to
true after the context's creation.

context.getJarScanner().setScanAllDirectories(true);

Unfortunately, that didn't fix the problem for me. Does anybody else have an
idea how to make this work?

--
View this message in context: 
http://tomcat.10.n6.nabble.com/HandlesTypes-not-resolving-classes-when-added-as-repository-directory-tp4565554p4565554.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to