[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2947?page=c...
]
Pete Grazaitis commented on HHH-2947:
-------------------------------------
Based on the comments in the posts the issue is related to having the Hibernate jar loaded
onto the boot classpath. This results in a null value when calling the getClassLoader.
I received this error because I had set my User Library in Eclipse to be a "System
Library", which places it into the boot classpath. Changing your User Library in
Eclipse via the User Library Manager from System Library to standard library will resolve
this issue.
Thanks,
-Pete
NPE on initialization of Hibernate
----------------------------------
Key: HHH-2947
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2947
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Reporter: Jörg Heinicke
Priority: Minor
There seems to be a rare case when Hibernate fails with a NPE on initialization:
http://forum.springframework.org/showthread.php?t=46034
The actual stacktrace is
Caused by: java.lang.ExceptionInInitializerError
at org.hibernate.cfg.Configuration.reset(Configuration.java:168)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:187)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:191)
...
Caused by: java.lang.NullPointerException
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:144)
at org.hibernate.cfg.Environment.<clinit>(Environment.java:524)
... 26 more
I don't know exactly which Hibernate version the user used but there seems to be only
one potential null pointer in the whole method and this is still in line 144 in the latest
code:
stream = Environment.class.getClassLoader().getResourceAsStream( stripped );
Class.getClassLoader() is allowed to return null following the Java API:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#getClassLoad....
So you might consider handling this particular case in which it can happen, when
Environment.class gets loaded by the bootstrap classloader.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira