kieker-monitoring / kieker

Kieker's main repository
Apache License 2.0
70 stars 41 forks source link

[KIEKER-1302] Java EE Example: Log4J Exception when starting under Eclipse #2820

Closed rju closed 3 days ago

rju commented 3 days ago

JIRA Issue: KIEKER-1302 Java EE Example: Log4J Exception when starting under Eclipse Original Reporter: Jan Waller


Setting:

The logging is not visible and a log4j error is shown.

rju commented 3 days ago

author Jan Waller -- Mon, 26 Nov 2012 16:14:26 +0100

What steps are needed to start Jetty in Eclipse?
We could provide a ready runconfig

rju commented 3 days ago

author André van Hoorn -- Mon, 26 Nov 2012 16:17:31 +0100

Replying to [jwa|comment:1]:
> What steps are needed to start Jetty in Eclipse?

1. Create a new (Java) project and use the example's jetty directory instead of the default location
2. Run start.jar as Java application

> We could provide a ready runconfig

I wouldn't see this as a recommended way to start the example ...

rju commented 3 days ago

author Jan Waller -- Mon, 26 Nov 2012 16:56:13 +0100

Output on the console is:

2012-11-26 16:48:34.025:INFO:oejs.Server:jetty-7.6.7.v20120910
2012-11-26 16:48:34.041:INFO:oejdp.ScanningAppProvider:Deployment monitor C:\Temp\JavaEEServletContainerExample\jetty-hightide-jpetstore\webapps at interval 1
2012-11-26 16:48:34.056:INFO:oejd.DeploymentManager:Deployable added: C:\Temp\JavaEEServletContainerExample\jetty-hightide-jpetstore\webapps\jpetstore
log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by 
log4j:ERROR [sun.misc.Launcher$AppClassLoader7361b0bc] whereas object of type 
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [WebAppClassLoader=JPetStore3907b408].
log4j:ERROR Could not instantiate appender named "stdout".
2012-11-26 16:48:35.461:INFO:jpetstore:Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
2012-11-26 16:48:36.898:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/jpetstore,file:/C:/Temp/JavaEEServletContainerExample/jetty-hightide-jpetstore/webapps/jpetstore/},C:\Temp\JavaEEServletContainerExample\jetty-hightide-jpetstore\webapps\jpetstore
2012-11-26 16:48:37.008:INFO:oejd.DeploymentManager:Deployable added: C:\Temp\JavaEEServletContainerExample\jetty-hightide-jpetstore\webapps\root
2012-11-26 16:48:37.304:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/C:/Temp/JavaEEServletContainerExample/jetty-hightide-jpetstore/webapps/root/},C:\Temp\JavaEEServletContainerExample\jetty-hightide-jpetstore\webapps\root
2012-11-26 16:48:37.320:INFO:oejdp.ScanningAppProvider:Deployment monitor C:\Temp\JavaEEServletContainerExample\jetty-hightide-jpetstore\contexts at interval 1
2012-11-26 16:48:37.320:INFO:oejd.DeploymentManager:Deployable added: C:\Temp\JavaEEServletContainerExample\jetty-hightide-jpetstore\contexts\hightide.xml
2012-11-26 16:48:37.335:INFO:oejsh.ContextHandler:started o.e.j.s.h.ContextHandler{/,file:/C:/Temp/JavaEEServletContainerExample/jetty-hightide-jpetstore/root}
2012-11-26 16:48:37.413:INFO:oejs.AbstractConnector:Started SelectChannelConnector0.0.0.0:8080
rju commented 3 days ago

author nils-christian -- Tue, 28 May 2013 17:06:18 +0200

A class loader problem as far as I can see. The log4j components are loaded multiple times as they seem to be contained in one of the other jar files as well. For some reason this does only effect Eclipse as it seems.

Potential workaround: Put the jar into another directory (instead in WEB-INF\lib) and include it manually within Eclipse. I was able to start the java.jar via command line and within Eclipse.

However, I still doubt that everything is initialized correctly in both cases.

rju commented 3 days ago

author nils-christian -- Thu, 21 Aug 2014 12:59:11 +0200

I am not sure whether this is still a valid issue after merging livedemo-integration back into the master:

1. The live demo has to be compiled via a script outside Jetty's directory before it could be used from Jetty.
1. After I compiled the live demo with said script, I wasn't able to reconstruct the main issue.

rju commented 3 days ago

author nils-christian -- Mon, 23 Feb 2015 16:52:31 +0100

Not reproducible.