java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory [duplicate] - eclipse

This question already has answers here:
java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
(5 answers)
Closed 6 years ago.
Seem to have a problem starting my Java app:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/juli/logging/LogFactory at
org.apache.catalina.util.LifecycleBase.(LifecycleBase.java:37)
Caused by: java.lang.ClassNotFoundException:
org.apache.juli.logging.LogFactory at
java.net.URLClassLoader$1.run(URLClassLoader.java:366) at
java.net.URLClassLoader$1.run(URLClassLoader.java:355) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:354) at
java.lang.ClassLoader.loadClass(ClassLoader.java:423) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at
java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 1 more
Tried the solution here:
java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
But I see tomcat-juli.jar already. Also I'm using Tomcat 7. What might be wrong?

Your vm does not find the class org/apache/juli/logging/LogFactory check if this class is present in the tomcat-juli.jar that you use (unzip it and search the file), if it's not present download the library from apache web site else if it's present put the tomcat-juli.jar in a path (the lib directory) that Tomcat use to load classes. If your Tomcat does not find it you can copy the jar in the lib directory of the JRE that you are using.

I ran into this problem when using tomcat-embed-core::7.0.47, from Maven. I'm not sure why they didn't add tomcat-util as a runtime dependency, so I added my own runtime dependency to my own project.
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util</artifactId>
<version><!-- version from tomcat-embed-core --></version>
<scope>runtime</scope>
</dependency>

This happened to me because I was using a Tomcat 5.5 catalina.sh file with a Tomcat 7 installation. Using the catalina.sh that came with the Tomcat 7 install fixed the problem.

If you are using jsvc to run tomcat as tomcat (run /etc/init.d/tomcat as root), edit /etc/init.d/tomcat and add $CATALINA_HOME/bin/tomcat-juli.jar to CLASSPATH.

I had the same problem, What helped me was:
Right click on the project.
Click 'Properties'
Go to 'Java Build Path'
And then: 'Libraries'
In there, Click: Add External Jars
Add: ''Path/To/Tomcat/Bin/tomcat-juli.jar
Done .

In our case, the wrong version of the Sysdeo Tomcat plugin for Eclipse 3.5 was being used. The fix:
Use tomcatPluginV33 instead of tomcatPluginV321 (extract to C:\eclipse\dropins)
Ensure that DevloaderTomcat7.jar was placed in the tomcat lib folder
In Window > Preferences > Tomcat, set the Tomcat version to 7.x
This problem may have been unique to our environment; but, I'll record it here anyway, for posterity's sake.

On Ubuntu 14.04 LTS
/usr/share# mv /opt/tomcat/apache-tomcat-7.0.56/ tomcat7
fixed the issue for me. There was a symbolic link there to /opt. Inside that opt directory there where ../../java links that would not point to /usr/share/java since the files physically were in /opt

Related

java.lang.NoClassDefFoundError: org/jfree/data/xy/XYDataset

I am using eclipse e4 rcp application and am trying to use JfreeChart in it. So I have added the jcommon-1.0.16.jar,jfreechart-1.0.14.jar, jfreechart-1.0.14-experimental.jar and jfreechart-1.0.14-swt.jar in external jar file in Build path. I am getting the following error when I am running the application
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: org/jfree/data/xy/XYDataset
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:344)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
.............
Caused by: java.lang.ClassNotFoundException: org.jfree.data.xy.XYDataset cannot be found by com.xyz.project_1.0.0.qualifier
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
Can anyone please suggest how to proceed?
There might be another jar that is missing. You need to check whether all jars are present in the Eclipse build path of your project.
Are you running the application from outside Eclipse IDE, on the command line?
If yes, then set classpath
SET CLASSPATH=pathtojar1;pathtojar2
before you execute your program.
Or specify classpath on the command itself
java -cp pathtojar1;pathtojar2;yourClassesFolderOrYourJar [ yourclassname or -jar yourjarname]

"no J3D in java.library.path" in Maven Eclipse

The error I'm getting is well discussed here, but I still can't seem to get a grip on what I'm doing wrong.
I'm trying to run a simple code with java3d. I added the jard to the Maven Dependencies and they are showing up. No errors are displayed and everything seems fine.
But when I'm trying to compile the code, all of a sudden the message
Exception in thread "main" java.lang.UnsatisfiedLinkError: no J3D in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at javax.media.j3d.MasterControl$22.run(MasterControl.java:889)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:886)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:229)
at de.act.gui.Skelett3D.main(Skelett3D.java:15)
appears.
Apparently I'm just missing some trivial error. Since the question has been asked so many times, the answer should be somewhere.
I added the Jars via the pom.xml with
<dependency>
<groupId>java3d</groupId>
<artifactId>j3d-core-utils</artifactId>
<version>1.3.1</version>
</dependency>
You are missing a native library (i.e. a dll or so file).
I do not know how to correctly reference that from maven (apparently there is something like a NAR that you can built, but I have not researched that yet).
A quick solution for eclipse is to add the dll as a native dependency to your Maven Dependencies library in eclipse:
In the "Libraries" tab in "Java Build Path" in the project properties, expand "Maven Dependencies" and edit "Native library location" to point to the directory containing your native library.
If the above solution is not working try to manually install maven and j3d, or reinstall it.
a missing file is sometimes a really bad sign, because sometimes if 1 file is missing maybe you haven't installed propertly and other files will be missing later on so i suggest you reinstalling.

How to resolve javax/mail/MessagingException?

I am using eclipse indigo to run my tomcat server, when I am launching tomcat server, the tomcat server successfully up and running, but with error shown in the console.
ERROR - ContextLoader[177]: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'com.huahsin68.MyBoc' defined in class path resource [my-spring.xml]: Class that bean class [com.huahsin68.MyBocImp] depends on not found; nested exception is java.lang.NoClassDefFoundError: javax/mail/MessagingException
java.lang.NoClassDefFoundError: javax/mail/MessagingException
It seems like the MessagingException wasn't found. I have check in the Java Build Path > Libraries, I notice that javax.mail_1.4.0.v200105080615.jar was there. This jar file is locate under eclipse > plugins folder. Is there anything solution to rectify this problem?
THanks #!
With Maven, you can add the following dependency:
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.5</version>
</dependency>
Try the following:
Download the java mail jars from: http://www.oracle.com/technetwork/java/javamail/index-138643.html
Add the jars to your WEB-INF/lib folder
Add the jars to Java Build Path > Libraries
That should do it.
For gradle/android users, in build.gradle (Module app):
compile 'javax.mail:mail:1.4.1'
I had a similar problem, running tomcat stand-alone (that is, not through Eclipse). I copied mail-1.4.jar to my tomcat/lib directory. This worked for me.
For those conning late in this ..
I got the same error resolved by adding below jar.
geronimo-javamail_1.4_mail-1.8.3.jar

Problem running a GWT 2.4 App on Tomcat

I have a problem running my gwt2.4rc1 application in a tomcat. The problem occurs when I try to make a requestfactory call. Then I get the exception at the bottom.
When I run GWT in development mode everything works fine. The gwt-dev. jar is in the lib folder of my webapp. I am using maven for dependency management. Could there be a problem with my configuration? I already had the error with gwt2.4 beta. If there are any other information required to solve this problem I am glad to provide them.
Regards,
Arne
SEVERE: Unexpected error
com.google.web.bindery.requestfactory.server.UnexpectedException: Unexpected checked exception
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.die(ServiceLayerDecorator.java:216)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:242)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.resolveRequestFactory(ServiceLayerCache.java:198)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:201)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:125)
at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:261)
at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:175)
at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81)
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:162)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:203)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.NoClassDefFoundError: com/google/gwt/dev/util/StringKey
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2804)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1144)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1639)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1517)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.validateProxy(RequestFactoryInterfaceValidator.java:1594)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.validateEntityProxy(RequestFactoryInterfaceValidator.java:828)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.maybeCheckProxyType(RequestFactoryInterfaceValidator.java:1540)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.getDomainType(RequestFactoryInterfaceValidator.java:1374)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.createDomainMethod(RequestFactoryInterfaceValidator.java:1192)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.checkClientMethodInDomain(RequestFactoryInterfaceValidator.java:1079)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.validateRequestContext(RequestFactoryInterfaceValidator.java:909)
at com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.validateRequestFactory(RequestFactoryInterfaceValidator.java:964)
at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.resolveRequestFactory(ResolverServiceLayer.java:187)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233)
... 32 more
Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.util.StringKey
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1672)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1517)
... 57 more
There's a fix for this on its way over from RC to trunk. In the mean time, remove gwt-servlet from your dependencies and use requestfactory-servlet.jar instead.
I've always understood gwt-dev.jar to be the compiler and other development tools. If you believe that, there should be no dependency on it from your own code, and there is no reason for it to be in the WEB-INF/lib folder of your war file.
I see from this question that at least one other contributer to SO feels the same way, but the belief doesn't appear to be universal.
I'll update this answer if I can find anything one way or the other in the GWT docs.
Update:
The closest thing I could find was Organize Projects which shows gwt-dev as a referenced library not present in WEB-INF/lib. I can't find anything official that says either that you can or can't deploy it to your web server. In an old book GWT In Action (Hanson, 2007), page 551 says
You should never deploy the gwt-user.jar and gwt-dev.jar files to your server,
because they will interfere with your server; these JAR files contain their own
Tomcat server code, which is used when you're testing in hosted mode.
This is clearly out of date, since hosted mode isn't called that anymore and uses an embedded Jetty server rather than Tomcat, but that's the basis for my belief.
Ok I made it working :)
I used the gwt version compiled from here:
http://code.google.com/p/google-web-toolkit/source/browse/#svn%2Freleases%2F2.4
I did put gwt-servlet.jar and requestfactory-servlet.jar as dependencies in my project. The problem in the other thread occured because I used my own group-id for the compiled jars, so these were not used by gin and the gwt-maven-plugin. No everything works fine :)
Thanks for the help though!!

Tomcat 7 Start up problem in Eclispse for maven project

I m getting this intermittent problem in eclipse, when i try to run a maven project in tomcat
Details are as follows :
Eclipse version : 3.6
Maven version : 2.2.1
Tomcat version : 7
Error log :
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1362)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1208)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3712)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Deleting and Recreating the server solves the problem, but still i would like to know why this error is created.
This error usually occurs when Spring misses a jar file on the classpath. The main reason for this is that Eclipse not always deploys a project correctly to its Tomcat server. Instead of deleting the server, you can also clean the server and redeploy the application.
Thanks for your reply. Well my problem was fixed by doing a mvn eclipse:clean eclipse:eclipse
I encountered the same error
I added my spring library in deployment assembly and build path of the project.
I think your server did not detect the library and restarting it made the server check for the build paths.