I debugged through Hibernate Search source. This method is the culprit:
private SessionFactory getSessionFactory() {
try {
Context initialContext;
if ( jndiProperties.isEmpty() ) {
*initialContext = new InitialContext();*
}
else {
initialContext = new InitialContext(
jndiProperties );
}
return ( SessionFactory ) initialContext.lookup(
sessionFactoryJndiName
);
}
catch ( Exception e ) {
throw new UnsupportedOperationException(
"In order for this operation to work
the SessionFactory must be bound
to JNDI"
);
}
}
An exception is thrown on the bolded line.
In my code I have this:
@Produces
@ExtensionManaged
@ConversationScoped
@PersistenceUnit(unitName = UNIT_NAME)
EntityManagerFactory conversationEMF;
I printed all names in JNDI tree, I found conversationEMF bound. I set it in
persistence.xml:
<property name="hibernate.session_factory_name" value="conversationEMF"/>
So this should work except the InitialContext() is throwing an exception.
Any ideas?
I can go the manual route and register the MBEAN myself like you suggested.
But I would rather not and use what's offered because I'll other needed
functionality that I would rather not implement myself. Thanks!
--
View this message in context:
http://openejb.979440.n4.nabble.com/Tomee-Hibernate-Session-JNDI-tp4655576p4655630.html
Sent from the OpenEJB User mailing list archive at Nabble.com.