JPA console issue
Answered
I am running into a strange problem with the JPA Console.
I'll try something simple like:
select a from User as a
and will get:
[2018-02-23 09:03:04] org/drools/core/impl/InternalKnowledgeBase
[2018-02-23 09:03:04] java.lang.ClassNotFoundException: org.drools.core.impl.InternalKnowledgeBase
[2018-02-23 09:03:04] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[2018-02-23 09:03:04] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[2018-02-23 09:03:04] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
[2018-02-23 09:03:04] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[2018-02-23 09:03:04] at java.lang.Class.getDeclaredMethods0(Native Method)
[2018-02-23 09:03:04] at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
[2018-02-23 09:03:04] at java.lang.Class.getDeclaredMethods(Class.java:1975)
[2018-02-23 09:03:04] at org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredMethodProperties(JavaXClass.java:112)
[2018-02-23 09:03:04] at org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredProperties(JavaXClass.java:129)
[2018-02-23 09:03:04] at org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredProperties(JavaXClass.java:121)
[2018-02-23 09:03:04] at org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:251)
[2018-02-23 09:03:04] at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:211)
[2018-02-23 09:03:04] at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:717)
[2018-02-23 09:03:04] at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:245)
[2018-02-23 09:03:04] at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:222)
[2018-02-23 09:03:04] at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
[2018-02-23 09:03:04] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847)
[2018-02-23 09:03:04] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874)
[2018-02-23 09:03:04] at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
[2018-02-23 09:03:04] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
[2018-02-23 09:03:04] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
[2018-02-23 09:03:04] at com.intellij.jpa.remote.impl.JpaFacadeImpl.createEntityManagerFactory(JpaFacadeImpl.java:16)
[2018-02-23 09:03:04] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2018-02-23 09:03:04] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[2018-02-23 09:03:04] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2018-02-23 09:03:04] at java.lang.reflect.Method.invoke(Method.java:498)
[2018-02-23 09:03:04] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
[2018-02-23 09:03:04] at sun.rmi.transport.Transport$1.run(Transport.java:200)
[2018-02-23 09:03:04] at sun.rmi.transport.Transport$1.run(Transport.java:197)
[2018-02-23 09:03:04] at java.security.AccessController.doPrivileged(Native Method)
[2018-02-23 09:03:04] at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
[2018-02-23 09:03:04] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
[2018-02-23 09:03:04] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
[2018-02-23 09:03:04] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
[2018-02-23 09:03:04] at java.security.AccessController.doPrivileged(Native Method)
[2018-02-23 09:03:04] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
[2018-02-23 09:03:04] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2018-02-23 09:03:04] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2018-02-23 09:03:04] at java.lang.Thread.run(Thread.java:748) (no stack trace)
so,, my persistence.xml file only speaks to Hibernate, and these classes have nothing to do with drools ( which is actually used in other parts of the application )
really stuck..
Please sign in to leave a comment.
Looks like JPA configuration issue. Looking at the stacktrace the problem seems that when the JPA configures and creates the entity manager and for this is looking at the source code containing hibernate annotations it fails to find in the classpath the mentioned "InternalKnowledgeBase" class that is probably used in your source code (e.g. in some entities). Try to include the Drools library with this class to the dependencies for this module. This should add it to the classpath for IDE JPA console.
Thanks so much for your suggestion. I'm confused, since the actual application is active and running without errors when I try to use the JPA console. The Drools library is included in the application. Further, the class that uses the Drools library is not related to database access, and it is not called out in persistence.xml or anywhere else that I can tell. Is this something that I should contact Jetbrains on directly?
To run JPA console IDE needs to configure the hibernate. For this it calls hibernate code which it turn fails when processing its entities (I'm not JPA expert and can not tell exactly but it seen that the process fails when hibernate is trying to discover declared properties). You could get more information on the related hibernate forums or Stackoverflow.
>The Drools library is included in the application.
Please confirm that the library which contains "org/drools/core/impl/InternalKnowledgeBase" class is added to the module where you have Hibernate configuration with the scope Compile.
Please add "#com.intellij.execution.rmi.RemoteProcessSupport" line into Help | Debug Log Settings... dialog, reproduce the issue and post the latest content of the idea.log file (Help | Show Log in...) here. We will check the classpath.