I am using Sun Java System Application Server Platform Edition 9.0_01 (build b02-p01)
I've got realm.class and a loginModule.class which use some entities to pull information. from the database. Everything is packaged in a single jar. Here are the pertinent parts of the realm class (sorry, for the terrible formatting):
public class Realm extends com.sun.appserv.security.AppservRealm{
EntityManagerFactory emf;
EntityManager em;
public void init (Properties props) throws BadRealmException, NoSuchRealmException{
String jaasCtx = props.getProperty(AppservRealm.JAAS_CONTEXT_PARAM);
this.setProperty(AppservRealm.JAAS_CONTEXT_PARAM, jaasCtx);
try{
emf = Persistence.createEntityManagerFactory("corenapRealm");
em = emf.createEntityManager();
}catch(Exception e){
log("Persistence context unavailable: " + e.getMessage());
throw new BadRealmException("Creation of persistence manager failed");
}
}
}
my persistence.xml looks like this:
<persistence version="1.0" xmlns="
http://java.sun.com/xml/ns/persistence" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="corenapRealm" transaction-type="JTA">
<jta-data-source>jdbc/corenapRealm</jta-data-source>
<properties/>
</persistence-unit>
</persistence>
When I restart the domain I get these errors (I'll spare you the stack traces unless you ask):
5) Persistence context unavailable: Exception [TOPLINK-7060] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: Cannot acquire data source [jdbc/corenapRealm].
Internal Exception: javax.naming.CommunicationException: Can't find SerialContextProvider [Root exception is java.lang.RuntimeException: org.omg.
4) Unexcpected Exception in createORB.
org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 202 completed: No
3) (OBJ_ADAPTER) Error in connecting servant to ORB"
org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 202 completed: No
2) (COMM_FAILURE) Unable to create IIOP listener on the specified host/port: all interfaces/3820"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216 completed: No
1) The log message is null. java.lang.NullPointerException at com.sun.enterprise.server.ondemand.ServiceGroup.preInvoke(ServiceGroup.java
The JNDI name in 5) is the database connection, which I can find in the JNDI browser. I am guessing that this is an order of operations issue, and these services are not available at the time the realm is loaded :(. But would like to know for sure before I give up.
thanks for the help
[Message sent by forum member 'loren_' (loren_)]
http://forums.java.net/jive/thread.jspa?messageID=236504