[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2947) NPE on initialization of Hibernate

Diego Pires Plentz (JIRA) noreply at atlassian.com
Sat Dec 8 20:52:56 EST 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29112 ] 

Diego Pires Plentz commented on HHH-2947:
-----------------------------------------

Based on user reply (http://forum.springframework.org/showpost.php?p=150610&postcount=7), you could be right. It's just strange that nobody has reported it before.

> 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#getClassLoader().
> 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the hibernate-issues mailing list