szquadri / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

java.lang.ClassNotFoundException with 1.52.0 #432

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using JavaMelody 1.52.0 on CentOS 6.5 with Oracle jdk1.7.0_55 and Tomcat 
6.0.30 we do get the following exception:

org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet app threw exception
java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceProvider

Switching back to JavaMelody 1.45.0 everything works fine.

I'm not able to drill down the problem, but can provide some additional 
information on the webapp. It uses spring and hibernate.

Any ideas?

Original issue reported on code.google.com by juergen....@gmail.com on 3 Sep 2014 at 10:59

GoogleCodeExporter commented 9 years ago
Additional Information: JavaMelody is installed in Tomcat/lib

Original comment by juergen....@gmail.com on 4 Sep 2014 at 7:34

GoogleCodeExporter commented 9 years ago
Additional Information:

Full stack-trace:

Sep 05, 2014 10:46:42 AM org.apache.catalina.startup.Catalina start
Information: Server startup in 32859 ms
Sep 05, 2014 10:55:07 AM org.apache.catalina.core.StandardWrapperValve invoke
Schwerwiegend: Servlet.service() for servlet app threw exception
java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceProvider
        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:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        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:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1634)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)
        at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.loadResolverClasses(PersistenceProviderResolverHolder.java:135)
        at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.<init>(PersistenceProviderResolverHolder.java:115)
        at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader.getPersistenceProviders(PersistenceProviderResolverHolder.java:73)
        at javax.persistence.Persistence.getProviders(Persistence.java:60)
        at javax.persistence.Persistence.access$000(Persistence.java:16)
        at javax.persistence.Persistence$1.isLoaded(Persistence.java:76)
        at org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:61)
        at org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:131)
        at org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:46)
        at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:1242)
        at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:448)
        at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:397)
        at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:361)
        at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:313)
        at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:139)
        at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:86)
        at org.springframework.webflow.validation.ValidationHelper.invokeValidatorDefaultValidateMethod(ValidationHelper.java:247)
        at org.springframework.webflow.validation.ValidationHelper.validate(ValidationHelper.java:111)
        at org.springframework.webflow.mvc.view.AbstractMvcView.validate(AbstractMvcView.java:634)
        at org.springframework.webflow.mvc.view.AbstractMvcView.processUserEvent(AbstractMvcView.java:224)
        at org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:226)
        at org.springframework.webflow.engine.ViewState.resume(ViewState.java:196)
        at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
        at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:261)
        at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
        at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
        at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at de.kvb.common.websecurity.PreventCachingFilter.doFilter(PreventCachingFilter.java:86)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at de.kvb.common.web.menu.MenuHandlerFilter.doFilter(MenuHandlerFilter.java:85)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
        at de.kvb.elw.web.security.SpringSecurityArgusIntegrationFilter.doFilter(SpringSecurityArgusIntegrationFilter.java:86)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
        at de.kvb.elw.web.security.AntiSamyFilter.doFilter(AntiSamyFilter.java:73)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at de.kvb.argus.agent.ArgusAgent.process(ArgusAgent.java:174)
        at de.kvb.argus.agent.ArgusAgent.doFilter(ArgusAgent.java:157)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at de.kvb.edoku.aadummy.ArgusAgentDummyUserFilter.doFilter(ArgusAgentDummyUserFilter.java:83)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:202)
        at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:180)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:554)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:647)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:745)

Jars in WEB-INF/lib:

activation-1.1.jar
antisamy-1.4.5.jar
antlr-2.7.6.jar
aopalliance-1.0.jar
argus-agent-4.2.2572.jar
argus-agent-dummy-4.20.40.jar
argus-client-4.2.2572.jar
argus-common-4.2.2572.jar
argus-server-api-4.2.2572.jar
argus-wrapper-api-1.0.2.jar
argus-wrapper-argus4-1.0.2.jar
argus-wsdldoc-4.2.2572.jar
aspectjrt-1.6.8.jar
aspectjweaver-1.6.8.jar
batik-css-1.7.jar
batik-ext-1.7.jar
batik-util-1.7.jar
c3p0-0.9.1.2.jar
cglib-nodep-2.1_3.jar
common-configuration-2.1.4.jar
common-db-1.1.0.jar
commons-beanutils-1.7.0.jar
commons-beanutils-core-1.8.0.jar
commons-codec-1.5.jar
commons-collections-3.2.1.jar
commons-configuration-1.6.jar
commons-digester-1.6.jar
common-security-1.0.3.jar
commons-fileupload-1.2.1.jar
commons-httpclient-3.1.jar
commons-io-1.4.jar
commons-lang-2.6.jar
commons-lang3-3.1.jar
commons-logging-1.0.4.jar
commons-pool-1.3.jar
commons-validator-1.3.0.jar
common-tools-2.14.2.jar
common-webfilter-1.5.0.jar
com.oracle.jms-1.3.jar
com.springsource.javax.jms-1.1.0.jar
displaytag-1.1.jar
dom4j-1.6.1.jar
ehcache-core-2.3.1.jar
ehcache-spring-annotations-1.1.2.jar
elw-common-3.2.1.jar
elw-core-3.2.1.jar
elw-db-3.2.1.jar
elw-evaluation-zs-3.2.1.jar
flyway-core-2.2.1.jar
genAr-core-0.4.12.jar
glue-4.1.2.jar
hibernate-annotations-3.5.6-Final.jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-core-3.5.6-Final.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
hibernate-validator-4.2.0.Final.jar
itext-1.3.jar
jackson-core-asl-1.9.9.jar
jackson-mapper-asl-1.9.9.jar
javassist-3.8.0.GA.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.11.jar
jaxws-api-2.1.jar
jaxws-rt-2.1.7.jar
jcl-over-slf4j-1.5.8.jar
joda-time-1.5.2.jar
js-1.6R5.jar
jstl-1.1.2.jar
jta-1.0.1B.jar
log4j-1.2.14.jar
logkit-1.0.1.jar
mail-1.4.jar
mimepull-1.3.jar
nekohtml-1.9.15.jar
ognl-2.6.9.jar
ojdbc6-11.2.0.3.jar
oro-2.0.8.jar
poi-3.9.jar
poi-ooxml-3.9.jar
poi-ooxml-schemas-3.9.jar
prevent-caching-filter-1.0.0.jar
quartz-1.8.6.jar
resolver-20050927.jar
saaj-api-1.3.jar
saaj-impl-1.3.3.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6.jar
snakeyaml-1.10.jar
spring-aop-3.0.7.RELEASE.jar
spring-asm-3.0.7.RELEASE.jar
spring-aspects-3.0.7.RELEASE.jar
spring-batch-core-1.1.3.RELEASE-A.jar
spring-batch-infrastructure-1.1.3.RELEASE-A.jar
spring-beans-3.0.7.RELEASE.jar
spring-binding-2.3.0.RELEASE.jar
spring-context-3.0.7.RELEASE.jar
spring-context-support-3.0.7.RELEASE.jar
spring-core-3.0.7.RELEASE.jar
spring-expression-3.0.7.RELEASE.jar
spring-integration-adapter-1.0.4.RELEASE.jar
spring-integration-core-1.0.4.RELEASE.jar
spring-integration-jms-1.0.4.RELEASE.jar
spring-integration-mail-1.0.4.RELEASE.jar
spring-integration-stream-1.0.4.RELEASE.jar
spring-jdbc-3.0.7.RELEASE.jar
spring-jms-2.5.6.jar
spring-js-2.3.0.RELEASE.jar
spring-js-resources-2.3.0.RELEASE.jar
spring-orm-3.0.7.RELEASE.jar
spring-oxm-3.1.2.RELEASE.jar
spring-security-acl-3.0.7.RELEASE.jar
spring-security-config-3.0.7.RELEASE.jar
spring-security-core-3.0.7.RELEASE.jar
spring-security-taglibs-3.0.7.RELEASE.jar
spring-security-web-3.0.7.RELEASE.jar
spring-tx-3.0.7.RELEASE.jar
spring-web-3.0.7.RELEASE.jar
spring-webflow-2.3.0.RELEASE.jar
spring-webmvc-3.0.7.RELEASE.jar
standard-1.1.2.jar
stax-api-1.0.1.jar
stax-api-1.0.jar
stax-ex-1.2.jar
streambuffer-0.9.jar
tiles-api-2.2.2.jar
tiles-core-2.2.2.jar
tiles-jsp-2.2.2.jar
tiles-servlet-2.2.2.jar
tiles-template-2.2.2.jar
validation-api-1.0.0.GA.jar
wstx-asl-3.2.3.jar
xercesImpl-2.8.1.jar
xml-apis-1.0.b2.jar
xml-apis-ext-1.3.04.jar
xmlbeans-2.3.0.jar

JavaMelody configuration:

  <filter>
    <filter-name>monitoring</filter-name>
    <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
    <init-param>
      <param-name>allowed-addr-pattern</param-name>
      <param-value>172\.31\..*|192\.168\..*</param-value>
    </init-param>
    <init-param>
      <param-name>storage-directory</param-name>
      <param-value>${catalina.base}/javamelody-data</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>monitoring</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <listener>
    <listener-class>net.bull.javamelody.SessionListener</listener-class>
  </listener>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Monitoring</web-resource-name>
      <url-pattern>/monitoring</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>manager</role-name>
    </auth-constraint>
  </security-constraint>
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>JavaMelody Monitoring</realm-name>
  </login-config>
  <security-role>
    <role-name>manager</role-name>
  </security-role>

Original comment by juergen....@gmail.com on 5 Sep 2014 at 1:04

GoogleCodeExporter commented 9 years ago
OK, it's hibernate-validator.
This issue is similar to issue 396, in which hibernate validator calls all JPA 
persistence providers even if JPA is not used anywhere:
https://code.google.com/p/javamelody/issues/detail?id=396

And a JPA persistence provider is declared in javamelody since 1.50.0. To load 
the class of that persistence provider, Tomcat needs to load the 
javax.persistence.spi.PersistenceProvider class, with the same classloader.

Probably, the solution is either:
- move javamelody jar files to WEB-INF/lib of your webapp, as recommended by 
the javamelody user guide,
- or copy the jar file of the JPA api to tomcat/lib. For example, copy the 
WEB-INF/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar file of your webapp to 
tomcat/lib. Note that tomcat/lib is not recommended and not as well supported 
by javamelody.

This will be the documentation in this case.

Original comment by evernat@free.fr on 7 Sep 2014 at 10:51