I've examined the issue more closely. The class (interface) is loaded twice, once by WebappClassLoader and once by Launcher$AppClassLoader, both from StandardContext.listenerStart() line: 4853
The WebappClassLoader one is reached via regular method calls, the other through reflection: MapperRegistry.getMapper(Class<T>, SqlSession) line: 40 Configuration.getMapper(Class<T>, SqlSession) line: 639 SqlSessionManager.getMapper(Class<T>) line: 215 MyBatisDbSessionManager.getMapper(Class<T>) line: 84 ProcessTasksService(BasisRestService).initializeAfterBootstrap() line: 57 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 498 Delegate.invoke(Object, Object[]) line: 88 BootstrapCompleteSignal(SynchronousSignal<T>).callHandler(SignalHandler, T) line: 22 BootstrapCompleteSignal(Signal<T>).invokeSignalHandlers(T) line: 109 BootstrapCompleteSignal(Signal<T>).raise(T) line: 131 BootstrapCompleteSignal(Signal<T>).raise() line: 93 AnubIsContainer.bootstrap(String) line: 230 AnubIsContainer.bootstrap() line: 156 MySystemPropertiesHelper.contextInitialized(ServletContextEvent) line: 14 StandardContext.listenerStart() line: 4853 StandardContext.startInternal() line: 5314 StandardContext(LifecycleBase).start() line: 145 ContainerBase$StartChild.call() line: 1408 ContainerBase$StartChild.call() line: 1398 FutureTask<V>.run() line: 266 ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1142 ThreadPoolExecutor$Worker.run() line: 617 Thread.run() line: 745 Does the reflection cause the other classloader to be used? Tom On 21-1-2017 09:43, Tom Eugelink wrote:
I'm very close at getting the embedded Tomcat running from an Eclipse Maven project; the (hopefully final) issue I'm now facing is the fact that a class is being loaded by the WebappClassloader and in another execution path via the launcher classloader, which makes them two different classes and things go awry. Tomcat of course is being started by Eclipse with a full classpath, and I 'forward' that classpath to the webapp. If I do not do that, the webapp won't find anything that is on that startup classpath, so apparently Tomcat's classloading setup completely ignores the initial classpath and replaces it with its own structure. Ok, but somehow they do get mixed up, otherwise I would not run into the situation described above. So I was thinking that I could try and figure out why one class is being loaded by the launcher, but I foresee a long and windy path, with a lot of different situations where this loading goes wrong. So instead of trying to solve the conflict at webapp level, I could move in another direction: in normal (non embedded) Tomcat installations you are allowed to put shared jars in Tomcat's lib folder. These are then accessible by all webapps. Is it possible to have embedded Tomcat make its classpath available to the webapps, or configure the classes-directories and jars resources at Tomcat level? Tom --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org