After upgrade to 4 Hibernate started crashing when using the JDBC poolmanager I am using. Turns out that it does not implement JNDI getNameParser(). Hibernate does not do a null check there. After a little tweak it was working again.
@Override public Object locate(String jndiName) { InitialContext initialContext = buildInitialContext(); Name name = null; try { name = parseName( jndiName, initialContext ); }
catch(JndiException je) { if(je.getMessage().indexOf("implemented") == -1) throw je; }
try { if(name != null) return initialContext.lookup(name); else return initialContext.lookup(jndiName); }
catch ( NamingException e ) { throw new JndiException( "Unable to lookup JNDI name [" + jndiName + "]", e ); }
finally { cleanUp( initialContext ); }
}
private Name parseName(String jndiName, Context context) { try { NameParser np = context.getNameParser( "" ); if(np == null) throw new JndiException("NameParser not implemented", null); return np.parse( jndiName ); }
catch ( InvalidNameException e ) { throw new JndiNameException( "JNDI name [" + jndiName + "] was not valid", e ); }
catch ( NamingException e ) { throw new JndiException( "Error parsing JNDI name [" + jndiName + "]", e ); }
}
(I could have added an extra Exception, but I did not want to create an extra dependency for me to patch)
|