I am facing issue in connecting to databse!!!
I have added the ojdbc14.jar but somehow it is not capturing the jar.
SEVERE: Servlet.service() for servlet [MyJaxApp] in context with path [/develop-without-web.xml] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver] with root cause
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at MyResource.fun(MyResource.java:33)
Related
I am using Eclipse and I have configured all the jars required for Spring Framework, it don't show any compilation error. But, when I run my main function(Test Class) it populates me this error. Am I missing something here? Please help me, could not find the actual solution to solve this problem.
Feb 27, 2017 1:15:20 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/expression/PropertyAccessor
at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:481)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:398)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.javatpoint.Test.main(Test.java:14)
Caused by: java.lang.ClassNotFoundException: org.springframework.expression.PropertyAccessor
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
Some dependencies are not required at compile time but just at runtime.
The missing class is contained in the spring-expression jar. You can download it and add it to Eclipse too.
this issue drives me crazy
recently i configured hibernate to work with infinispan 8.1
and just worked fine in debug mode with eclipse
the problem when tried to deploy my application war on apache tomcat6
i get this exception
Caused by: org.hibernate.cache.CacheException: Unable to start region factory
at org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:415)
at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:49)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:28)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:20)
at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:46)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:234)
... 86 more
Caused by: org.infinispan.commons.CacheConfigurationException: Unable to instantiate class org.infinispan.remoting.transport.jgroups.JGroupsTransport
at org.infinispan.commons.util.Util.loadClass(Util.java:103)
at org.infinispan.commons.util.Util.getInstance(Util.java:258)
at org.infinispan.configuration.global.TransportConfigurationBuilder.defaultTransport(TransportConfigurationBuilder.java:207)
at org.infinispan.configuration.parsing.Parser72.parseJGroups(Parser72.java:405)
at org.infinispan.configuration.parsing.Parser72.readElement(Parser72.java:93)
at org.infinispan.configuration.parsing.ParserRegistry.parseElement(ParserRegistry.java:151)
at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:131)
at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:118)
at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:105)
at org.hibernate.cache.infinispan.InfinispanRegionFactory.parseWithOverridenClassLoader(InfinispanRegionFactory.java:518)
at org.hibernate.cache.infinispan.InfinispanRegionFactory.access$000(InfinispanRegionFactory.java:81)
at org.hibernate.cache.infinispan.InfinispanRegionFactory$1.doWork(InfinispanRegionFactory.java:484)
at org.hibernate.cache.infinispan.InfinispanRegionFactory$1.doWork(InfinispanRegionFactory.java:470)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.workWithClassLoader(ClassLoaderServiceImpl.java:342)
at org.hibernate.cache.infinispan.InfinispanRegionFactory.createCacheManager(InfinispanRegionFactory.java:469)
at org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:380)
... 91 more
Caused by: java.lang.ClassNotFoundException: org.infinispan.remoting.transport.jgroups.JGroupsTransport
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.infinispan.commons.util.Util.loadClassStrict(Util.java:158)
at org.infinispan.commons.util.Util.loadClass(Util.java:101)
... 106 more
This exception clearly shows that jar is not present on class path. For web project see if that jar is present inside lib folder of your war.
My tomcat logs get flooded with this whenever I redeploy an app.
2015-11-25 08:09:16 SEVERE org.apache.catalina.core.StandardContext listenerStop: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:117)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5014)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5659)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1028)
at org.apache.catalina.startup.HostConfig.undeploy(HostConfig.java:1478)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1406)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1626)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:328)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1374)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextCleanupListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
... 16 more
What causes it?
I think it is a duplication of some of:
java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener issue
java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener
Tomcat & Spring Web - Class Not Found Exception org.springframework.web.context.ContextLoaderListener
http://www.mkyong.com/spring/spring-error-classnotfoundexception-org-springframework-web-context-contextloaderlistener/
http://forum.spring.io/forum/spring-projects/web-services/52595-classnotfoundexception-org-springframework-web-con-text-contextloaderlistener
I created my first axis2 webservice and I got following error when I try to invoke the web service through my client which is created using stub.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/wsdl/WSDLException
at com.test.first.TestStub.populateAxisService(TestStub.java:41)
at com.test.first.TestStub.<init>(TestStub.java:88)
at com.test.first.TestStub.<init>(TestStub.java:77)
at com.test.first.TestStub.<init>(TestStub.java:126)
at com.test.first.TestStub.<init>(TestStub.java:118)
at com.test.first.TestTest.main(TestTest.java:11)
Caused by: java.lang.ClassNotFoundException: javax.wsdl.WSDLException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Laun``cher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 6 more
What could be the root cause for this exception?
Note: I have included wsdl4j and log4j libraries.
Likely a classpath issue? Can't find javax.wsdl.WSDLException. Ensure this is available.
I am using java youtube api , I have this exception when i am just trying to do the first line of the connection
YouTubeService service = new YouTubeService("");
I am getting this
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: com/google/gdata/client/media/MediaService
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
java.lang.ClassLoader.defineClass(ClassLoader.java:615)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2820)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1150)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
tst.Main.doGet(Main.java:197)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
tst.Main.service(Main.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ClassNotFoundException: com.google.gdata.client.media.MediaService
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
java.lang.ClassLoader.defineClass(ClassLoader.java:615)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2820)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1150)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
tst.Main.doGet(Main.java:197)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
tst.Main.service(Main.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.21 logs.
I put the gdata-youtube .... etc in WEB-INF/lib
also I tried to put the same in the java build path and its the same
so whats the problem ?
you are missing dependent libraries. Add the core and media libraries as well -
gdata-client-X.X.jar
gdata-youtube-X.X.jar
gdata-core-X.X.jar
gdata-media-X.X.jar