Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting java.lang.NoClassDefFoundError: net/bull/javamelody/JpaPersistence error when deploying to Tomcat 10 with Java 17 #1220

Closed
jiacheng-0 opened this issue May 16, 2024 · 4 comments

Comments

@jiacheng-0
Copy link

16-May-2024 17:29:23.532 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
16-May-2024 17:29:25.846 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter [javamelody]
  java.lang.NoClassDefFoundError: net/bull/javamelody/JpaPersistence
    at net.bull.javamelody.FilterContext.(FilterContext.java:127)
    at net.bull.javamelody.MonitoringFilter.init(MonitoringFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:263)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:245)
    at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:98)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4301)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4916)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:683)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:658)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:712)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1796)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:293)
    at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:814)
    at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:422)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:376)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:293)
    at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:814)
    at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
    at java.management/com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:472)
    at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1472)
    at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1310)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
    at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1412)
    at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:842)
  Caused by: java.lang.ClassNotFoundException: net.bull.javamelody.JpaPersistence
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1353)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1165)
    ... 51 more

@evernat
Copy link
Member

evernat commented May 16, 2024

It is needed to know more about how to reproduce that. And for example, a simple project using maven would be great to reproduce. At least, we would know if you are using javamelody-core or javamelody-spring-boot-starter and which version exactly.

At the moment, I see in the stacktrace that you deploy using javax.management if I see well and it seems unusual. A war file in the webapps directory would be a more standard test.

@jiacheng-0
Copy link
Author

Hi @evernat , I am actually working on migrating an enterprise application from Java 8 to Java 17 due to Java 8 being out of Long-term support by our vendor. This was the error from that.

I made a test repo here: https://github.com/java-corner/javamelody-java17-test

In my pom.xml, I added these to test whether JpaPersistence class can be found

net.bull.javamelody
javamelody-core
2.1.0

jakarta.persistence jakarta.persistence-api 3.0.0

I tested this and it worked OK.

@evernat
Copy link
Member

evernat commented May 26, 2024

So it cannot be reproduced. I do not think that it is a real issue.

@evernat evernat closed this as completed May 29, 2024
@jiacheng-0
Copy link
Author

@evernat Yes, its because the project I was working was importing individual dependencies instead of using spring-boot-start-data-jpa from the get-go so there was some errors. I fixed it by adding the proper imports for now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants