I've have trouble deploying an application that runs fine within eclipse, but generates the following error when creating a runnable jar (using the option: extract required libraries into generated JAR):
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NoSuchMethodError: org.apache.log4j.spi.LoggingEvent.getTimeStamp()J)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(开发者_如何学PythonUnknown Source)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
I'm using log4j-1.2.16.jar and it's included in the generated jar.
I'm not sure where to troubleshoot, I've tried to find other (older) instances of org.apache.log4j.spi.LoggingEvent in other jars that are included, but so far I did not find any.
It says, that there is not method org.apache.log4j.spi.LoggingEvent.getTimeStamp() Find again your classes, that are on class path and you should find class org.apache.log4j.spi.LoggingEvent twice. One with method one without method.
I'm using log4j-1.2.16.jar and it's included in the generated jar.
Java class loaders are not designed to deal with a Jar inside a Jar. It is possible to put the resources (classes etc.) of a Jar into another Jar (I think using a tool called 'FatJar' in Eclipse), but that might break the EULA.
The usual way to include a Jar on the run-time class path of an application is to add a manifest file that specifies a relative path to the Jar.
精彩评论