-->
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.  [ 9 posts ] 
Author Message
 Post subject: IllegalStateException using latest tools
PostPosted: Tue Nov 22, 2005 6:51 pm 
Newbie

Joined: Thu Mar 24, 2005 6:24 pm
Posts: 8
Hibernate/Hibernate Tools version: 3.1 11-22 nightly build


I'm trying to use the bleeding edge hibernate tools to pick up the fix for hbm2java generation of minimal/full constructors. When I run hbm2java I get the following message.

Code:
java.lang.IllegalStateException: 3.1.0 beta1 found when settin g version


Perhaps there's some version mismatch as things are moving to beta 2?

Thanks,
-Dan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 4:07 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
make sure you are using the hibernate.jar that is distributed w/ whatever version on hibernate-tools.jar that you are using. if this holds true, post the actual stack trace.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 8:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that exception is not thrown by hibernate

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 10:12 am 
Newbie

Joined: Thu Mar 24, 2005 6:24 pm
Posts: 8
Thanks for the quick response, both of you.

Quote:
make sure you are using the hibernate.jar that is distributed w/ whatever version on hibernate-tools.jar that you are using. if this holds true, post the actual stack trace.

I am using the hibernate3.jar that came w/ the tools. Alas, there is no stack trace - just this.

Code:
BUILD FAILED
Z:\ems\src\dao\nodedao\build.xml:158: The following error occurred while executing this line:
Z:\ems\src\dao\nodedao\build.xml:183: java.lang.IllegalStateException: 3.1.0 beta1 found when settin
g version


Line 183 of my Ant build file is the call to the hibernatetool task.


Quote:
that exception is not thrown by hibernate

Doing some code diving, I must disagree. It looks like it's coming from line 223 of org.hibernate.tool.hbm2x.TemplateHelper.

Code:
    public void putInContext(String key, Object value) {
       log.trace("putInContext " + key + "=" + value);
        if(value == null) throw new IllegalStateException("value must not be null for " + key);
        Object replaced = getContext().put(key, value);
        if(replaced!=null) throw new IllegalStateException(replaced + " found when setting " + key);
    }


It would seem to indicated that the version is being added to the Context twice. The setupContext() method on the same class adds it - but I wasn't able to determine if it's being added somewhere else, or perhaps if that method is being called 2x.

Thanks,
-Dan


Top
 Profile  
 
 Post subject: workaround
PostPosted: Wed Nov 23, 2005 11:00 am 
Newbie

Joined: Thu Mar 24, 2005 6:24 pm
Posts: 8
I built the hibernate-tools.jar from CVS, commenting out the line (89) in setupContext() that puts the version in the Context, and got things working. So when is beta 2 coming out? ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 8:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well if you had run ant with -debug you would have received a stack trace.

and the exception occurs for a reason! somehow there is more than on e version property being set - that is not allowed and does not happen in the unit tests thus something is probably making this happen in your environment ... do you have a version property somewhere ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 12:29 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
... and post the build file too.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 11:48 am 
Newbie

Joined: Thu Mar 24, 2005 6:24 pm
Posts: 8
I got the same behavior from a downloaded nightly build, so it's nothing in my particular build file (which was vanilla from CVS anyway).

Also, the comment at the top of my generated code (from my custom generator) is:
Code:
// Generated Nov 23, 2005 3:33:20 PM by Hibernate Tools $version

So now there is no version being set. I believe this indicates that it's not picking up a "second" version property from my environment.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 12:10 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that it contains $version indicates to me that version is somehow set to null which should not happen.

Please provide a failing test...

_________________
Max
Don't forget to rate


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