eclipse-packaging / packages

Eclipse IDE product definitions.
Eclipse Public License 2.0
4 stars 11 forks source link

Eclipse and Tomcat Deployment: Always have to clean Projects after changing code #62

Closed felix-wiemann closed 5 months ago

felix-wiemann commented 12 months ago

I develop webapps using eclipse and tomcat and for over a year and different eclipse versions i got some seriously annoying issues while developing: When tomcat is running and i change code, even just one line and no matter what kind of changes, i have to stop tomcat, clean all projects deployed to the tomcat and start it again. If i don't clean my projects tomcat refuses to start giving tons of errors like this:

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/MyApp]]
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:926)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/MyApp]]
    at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
    ... 21 more
Caused by: java.lang.NoClassDefFoundError: Logger
    at java.base/java.lang.Class.getDeclaredFields0(Native Method)
    at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3297)
    at java.base/java.lang.Class.getDeclaredFields(Class.java:2371)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:104)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:269)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:89)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:332)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:989)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    ... 27 more
Caused by: java.lang.ClassNotFoundException: Logger
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1412)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)
    ... 40 more

It always refers to a class "Logger" which probably belongs to Log4j, which i am using in all of my apps. Of course the dependencies are properly defined in my project (no general compile errors are shown), thats why everything works again after cleaning. All the libs im using, including log4j, are situated in my project under WebContent/WEB-INF/lib and all appear in my build path settings unter Web App Libraries. However i haven't found anything to this problem on the net and it is bugging me although i tried using different eclipse versions and also recreated my workspace.

Does anyone have an idea what to do about this?

jonahgraham commented 12 months ago

Thanks @felix-wiemann for taking the time to create a bug report.

I am not sure which project to direct this too. @nitind any thoughts?

nitind commented 12 months ago

As was mentioned in the original StackOverflow, https://stackoverflow.com/questions/77103716/eclipse-and-tomcat-deployment-always-have-to-clean-projects-after-changing-code, it's very odd that the NCDFE mentions an unqualified class name. There's nothing like Lombok involved that could expect to be in place that works fine on a full deployment but drops the ball when hotswapping, right?

felix-wiemann commented 12 months ago

@nitind No, i never used something like Lombok. The only plugin i installed myself is sonarlint, but the problem also occured without it. My current eclipse version is 06-23. My OS is windows 10.

merks commented 5 months ago

I don't see anything "org.eclipse" on the stack so I have no idea where an issue needs to be opened.

WebTools has a bunch of subprojects listed here:

https://projects.eclipse.org/projects/webtools

image

For each subproject you can find information about it:

image

Including the github repo where it is located and where an issue can be opened:

https://github.com/eclipse-webservices/webservices

This problem cannot be addressed by the Eclipse Packaging Project itself.