-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 posts ] 
Author Message
 Post subject: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Wed Sep 14, 2016 9:53 am 
Newbie

Joined: Wed Sep 14, 2016 9:43 am
Posts: 8
I am seeing this when updating from 4.3 to 5.2.

Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Map;
at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:71)
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:55)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:257)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:231)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:238)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
at com.mckesson.apg.hpm.utils.HibernateUtil.setDatabaseOneFactory(HibernateUtil.java:405)
at com.mckesson.apg.hpm.utils.HPMAppParametersFactory.getStoredParameters(HPMAppParametersFactory.java:114)
at com.mckesson.apg.hpm.utils.HPMAppParametersFactory.build(HPMAppParametersFactory.java:76)
at com.mckesson.apg.hpm.app.HPMJavaAppRunner.main(HPMJavaAppRunner.java:254)

There isn't a getProperties in org.hibernate.engine.spi.SessionFactoryImplementor. I don't see in the migration notes any mention of what the change I would need to make is but it appears to me like the hibernate code itself has an incorrect call.

Thoughts??

Thanks,
Bob


Top
 Profile  
 
 Post subject: Re: buildSessionFactory getting exception
PostPosted: Wed Sep 14, 2016 10:11 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
The getProperties() method is inherited from JPA EntityManager#getProperties which is avalable in Java EE 7 (JPA 2.1) and 6 (JPA 2.0).

Only if you're using Java EE 5 (JPA 1.0) and you have the 1.0 jar on your classpath will you run into such an issue.


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Wed Sep 14, 2016 10:18 am 
Newbie

Joined: Wed Sep 14, 2016 9:43 am
Posts: 8
I have hibernate-jpa-2.1-api-1.0.0.Final.jar and am using Java 8. This is the jar that is in the required directory for the distribution.


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Wed Sep 14, 2016 11:04 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Maybe you also have an old version of Hibernate lingering on the class path. You can figure it out during debugging.


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Wed Sep 14, 2016 11:16 am 
Newbie

Joined: Wed Sep 14, 2016 9:43 am
Posts: 8
Nope, I just checked and I point to the directory where the new version lives. I don't see it referenced directly as I reference the directory with a * so it gets all the jar files we use and I have removed the old jar files from the system.

This is very strange.

Thank you for your help.


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Wed Sep 14, 2016 12:07 pm 
Newbie

Joined: Wed Sep 14, 2016 9:43 am
Posts: 8
For an experiment I tried using the 5.0.1 and 5.1.1 releases. Neither one worked but I got a different error:

Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.Session.createQuery(Ljava/lang/String;)Lorg/hibernate/query/Query;
at com.mckesson.apg.hpm.dao.UserDAO.getByLogonId(UserDAO.java:132)
at com.mckesson.apg.hpm.rest.HPMJobMgr.createDetachedJob(HPMJobMgr.java:202)
at com.mckesson.apg.hpm.app.HPMJavaAppRunner.main(HPMJavaAppRunner.java:291)

So given this I would assume that I must have an old version of something that is needed. I'm not sure what that would be but given what you have said and what it looks like I have some incompatibility somewhere.

Thank you,
Bob


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Wed Sep 14, 2016 2:10 pm 
Newbie

Joined: Wed Sep 14, 2016 9:43 am
Posts: 8
Sorry to ask this but I'm still not getting anywhere, but based on what you have said it's apparent that I must have a old version of something. Would you mind looking at the jar files we do include to see if you see anything that is out of date with what Hibernate 5.2 expects.

activation-1.1.jar el-api-2.2.jar javassist-3.20.0-GA.jar logback-classic-1.0.13.jar
antlr-2.7.7.jar esapi-2.1.0.jar javax.annotation-api-1.2.jar logback-core-1.0.13.jar
aqapi.jar flexInterface.jar javax.inject-2.2.0-b10.jar mail-1.4.jar
asm-all-repackaged-2.2.0-b10.jar geronimo-jta_1.1_spec-1.1.1.jar javax.ws.rs-api-2.0.jar mck-apg-hpm.jar
axiom-api-1.2.11.jar guava-14.0.1.jar jaxb-api-2.2.7.jar mck-cs-java-jersey-ssl.jar
axiom-impl-1.2.11.jar hibernate-commons-annotations-5.0.1.Final.jar jaxrpc.jar mck-cs-jwt-auth.jar
axis2-adb-1.5.5.jar hibernate-core-5.2.2.Final.jar jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar mck-cs-ks-client-int.jar
axis2-kernel-1.6.0.jar hibernate-jpa-2.1-api-1.0.0.Final.jar jboss-logging-3.3.0.Final.jar mck-hpm-token.jar
axis2-transport-http-1.6.0.jar hk2-api-2.2.0-b10.jar jboss-logging-annotations-1.2.0.Beta1.jar neethi-2.0.5.jar
axis2-transport-local-1.6.0.jar hk2-locator-2.2.0-b10.jar jboss-transaction-api_1.2_spec-1.0.0.Final.jar ojdbc6.jar
bcprov-jdk15on-147.jar hk2-utils-2.2.0-b10.jar jersey-client.jar org.osgi.core-4.2.0.jar
calibro-logging.jar httpclient-4.0.3.jar jersey-common.jar osgi-resource-locator-1.0.1.jar
cdi-api-1.1.jar httpcore-4.3.jar jersey-container-servlet-core.jar persistence-api-1.0.jar
cglib-2.2.0-b10.jar httpmime-4.3.jar jersey-container-servlet.jar poi-3.13-20150929.jar
classmate-1.3.0.jar jackson-all-1.7.9.jar jersey-media-json-jackson-2.7.jar poi-ooxml-3.13-20150929.jar
commons-cli-1.2.jar jackson-annotations-2.2.3.jar jersey-server.jar poi-ooxml-schemas-3.13-20150929.jar
commons-codec-1.7.jar jackson-core-2.2.3.jar jms.jar slf4j-api-1.6.4.jar
commons-collections-3.1.jar jackson-databind-2.2.3.jar joda-time-2.1.jar sqljdbc4.jar
commons-httpclient-3.1.jar jackson-jaxrs-base-2.2.3.jar jsr250-api-1.0.jar validation-api-1.1.0.Final.jar
commons-io-1.4.jar jackson-jaxrs-json-provider-2.2.3.jar junit.jar wsdl4j-1.6.2.jar
commons-logging-1.1.1.jar jackson-module-jaxb-annotations-2.2.3.jar log4j-1.2.15.jar xmlbeans-2.3.0.jar
dom4j-1.6.1.jar jandex-2.0.0.Final.jar logback-access-1.0.13.jar XmlSchema-1.4.7.jar

Thank you,
Bob


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Wed Sep 14, 2016 2:45 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Try removing:

Code:
hibernate-commons-annotations-5.0.1.Final.jar


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Wed Sep 14, 2016 2:54 pm 
Newbie

Joined: Wed Sep 14, 2016 9:43 am
Posts: 8
Well, it did something different. :) Looks like I need that jar though.

Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ClassLoaderDelegate
at org.hibernate.boot.internal.MetadataBuilderImpl.<init>(MetadataBuilderImpl.java:127)
at org.hibernate.boot.MetadataSources.getMetadataBuilder(MetadataSources.java:135)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:654)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
at com.mckesson.apg.hpm.utils.HibernateUtil.setDatabaseOneFactory(HibernateUtil.java:405)
at com.mckesson.apg.hpm.utils.HPMAppParametersFactory.getStoredParameters(HPMAppParametersFactory.java:114)
at com.mckesson.apg.hpm.utils.HPMAppParametersFactory.build(HPMAppParametersFactory.java:76)
at com.mckesson.apg.hpm.app.HPMJavaAppRunner.main(HPMJavaAppRunner.java:254)
Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.ClassLoaderDelegate
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Wed Sep 14, 2016 3:36 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
All the Hibernate annotations are bundled in the hibernate-core, so you should not need that library. But if you do, it's a deployment smell indeed. Try figuring out why it fails when you remove it, and who needs t.


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Thu Sep 15, 2016 9:19 am 
Newbie

Joined: Wed Sep 14, 2016 9:43 am
Posts: 8
Still can't quite find what is going on but I have a question about your last response. If Hibernate annotations is not needed then why is it in the required directory in the distribution? I assumed that all the jars in that directory are required to make this work, that is why they are in the required directory.


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Thu Sep 15, 2016 10:33 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
What do you mean by "the required directory in the distribution"?

You can choose any Hibernate dependency you want from Maven Central.


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Thu Sep 15, 2016 10:48 am 
Newbie

Joined: Wed Sep 14, 2016 9:43 am
Posts: 8
I go to hibernate.org, click on Hibernate ORM and then download the 5.2.2 release. Inside that zipped distribution is a required directory containing what I think are all the jars I need to use for this release.

http://hibernate.org/orm/


Top
 Profile  
 
 Post subject: Re: NoSuchMethodError: SessionFactoryImplementor.getProperties()
PostPosted: Thu Sep 15, 2016 10:56 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You're right. I checked the library and it's fine. I don't know why you have that issue.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.