-->
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.  [ 13 posts ] 
Author Message
 Post subject: java.lang.NoSuchFieldError: LONG
PostPosted: Fri Mar 11, 2016 4:40 pm 
Newbie

Joined: Fri Mar 11, 2016 4:18 pm
Posts: 7
I am getting the following error in my application while using hibernate,

java.lang.NoSuchFieldError: LONG

Below is the code that is causing the issue,

Code:
import org.hibernate.Hibernate;

final SQLQuery query = session.createSQLQuery(someQuery).addScalar("someColumn", Hibernate.LONG);


Following is the hibernate dependency list,

Code:
hibernate : 3.2.6.ga
hibernate-annotations : 3.3.0
hibernate-annotations : 3.5.6-Final
hibernate-commons-annotations : 3.2.0.Final
hibernate-core : 3.5.6-Final
hibernate-ehcache : 3.6.0.Final
hibernate-entitymanager : 3.3.0
hibernate-jpa-2.0-api : 1.0.0.Final


Couldn't add the entire list as it is a very big application. But can you give me some hints that I need to look into. Also, FYI I had removed one of the duplicate hibernate-annotations and hibernate-core jars but still the issue persisted.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Sat Mar 12, 2016 1:41 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You have duplicate dependencies for both Hibernate 3.2.6.ga and 3.5.6-Final so you need to remove hibernate : 3.2.6.ga and hibernate-annotations : 3.3.0


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Sat Mar 12, 2016 1:53 am 
Newbie

Joined: Fri Mar 11, 2016 4:18 pm
Posts: 7
Hi mihalcea_vlad,

I had done the same thing knowing there were duplicate dependencies but the issue is still present. Below is the current jar files in my application,

Code:
hibernate-annotations-3.5.6-Final.jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-core-3.5.6-Final.jar
hibernate-ehcache-3.6.0.Final.jar
hibernate-entitymanager-3.3.0.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar


Is there any other cause for this issue like external jar or should I add the application startup log for hibernate?


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Sat Mar 12, 2016 7:32 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Like always, you need the application log to know what went wrong.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Sat Mar 12, 2016 12:30 pm 
Newbie

Joined: Fri Mar 11, 2016 4:18 pm
Posts: 7
Hi mihalcea_vlad,

Currently, I do not have permission to add any attachment in the threads. Also, one thing I noticed after looking closely in the server logs is that there are other application in the server using
Code:
hibernate-core : 3.6.0-Final JAR
in their context. Would it interfere with this application context if they are deployed in the same server?
As from what I know
Code:
hibernate-core : 3.6.0-Final JAR does not have
org.hibernate.Hibernate CLASS

If yes, then how do I resolve it?

Thanks you so much in advance for replying in the thread!
Also please let me know if you want any specific information form the server logs that I can add in the thread.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Sat Mar 12, 2016 3:43 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
The org.hibernate.Hibernate class exists even in 5.1.0. As for your problem, since you can't attach the logs, you can only debug it through Hibernate code and see why it's not working then.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Sun Mar 13, 2016 3:30 am 
Newbie

Joined: Fri Mar 11, 2016 4:18 pm
Posts: 7
Quote:
Here is the log file encryted as a ZIP,
*removed*

Password,
*removed*


Please let me know if you face any issues while accessing the log file.


Last edited by vivek_nadar on Mon Mar 14, 2016 9:29 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Sun Mar 13, 2016 8:49 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Try replacing Hibernate.LONG with org.hibernate.type.LongType.INSTANCE


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Mon Mar 14, 2016 12:51 pm 
Newbie

Joined: Fri Mar 11, 2016 4:18 pm
Posts: 7
Hi mihalcea_vlad,

I am getting the following error now,

Quote:
java.lang.NoSuchFieldError: INSTANCE


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Wed Mar 23, 2016 4:08 pm 
Newbie

Joined: Fri Mar 11, 2016 4:18 pm
Posts: 7
Can someone give any hints in here as to the possible root cause, I am really stuck here!


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Thu Mar 24, 2016 2:24 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Try without the second parameter:

Code:
final SQLQuery query = session.createSQLQuery(someQuery).addScalar("someColumn");


Maybe Hibernate can figure out the type for you too.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Thu Mar 24, 2016 7:39 am 
Newbie

Joined: Fri Mar 11, 2016 4:18 pm
Posts: 7
Thank you mihalcea_vlad it worked!


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchFieldError: LONG
PostPosted: Thu Mar 24, 2016 8:03 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You're welcome!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 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.