
You're trying to write some code to connect to FileNet P8 Content Engine. Code builds, but you get obscure errors.
The amazing thing about this is that it has nothing to do with "ORB initialization".
You can get this error from using
the wrong java compiler!.
Solution: Use the full path to the compiler:
"C:\Program Files\IBM\WebSphere\AppServer\java\bin\javac.exe"
I am posting this in the hopes it will save some poor soul from losing hours of his or her life.
com.filenet.api.exception.EngineRuntimeException: API_UNEXPECTED_JNDI_ERROR:
An unexpected error occured accessing JNDI.
at com.filenet.apiimpl.util.SessionLocator.locateEJBByPath(SessionLocator.java:797)
at com.filenet.apiimpl.util.SessionLocator.findEJBSessionByPath(SessionLocator.java:732)
at com.filenet.apiimpl.util.SessionLocator.createNewSession(SessionLocator.java:533)
at com.filenet.apiimpl.util.SessionLocator.getSession(SessionLocator.java:149)
at com.filenet.apiimpl.core.IndependentObjectImpl.
getObject(IndependentObjectImpl.java:153)
at com.filenet.apiimpl.core.IndependentObjectImpl.refresh(IndependentObjectImpl.java:161)
at com.filenet.api.core.Factory$Domain.fetchInstance(Factory.java:1543)
at Test.main(Test.java:36)
Caused by: javax.naming.NamingException: Failed to initialize the ORB
[Root exception is java.lang.ClassCastException: com.sun.corba.se.impl.orb.ORBImpl]
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:314)
at com.ibm.ws.naming.util.WsnInitCtxFactory.
getInitialContextInternal(WsnInitCtxFactory.java:383)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:113)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:428)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:144)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.filenet.apiimpl.util.SessionLocator.locateEJBByPath(SessionLocator.java:786)
... 7 more
Caused by: java.lang.ClassCastException: com.sun.corba.se.impl.orb.ORBImpl
at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:85)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:174)
at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:97)
at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:73)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:386)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:305)
... 13 more
The code below, compiled with the wrong java compiler, will result in the above horror:
import com.filenet.api.core.*;
import javax.security.auth.Subject;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Iterator;
import java.util.ArrayList;
import com.filenet.api.collection.ObjectStoreSet;
import com.filenet.api.util.UserContext;
public class Test
{
public static void main(String[] args) throws Exception {
try {
String uri = "iiop://localhost:2809/FileNet/Engine";
Connection conn = Factory.Connection.getConnection(uri);
UserContext uc = UserContext.get();
uc.pushSubject(UserContext.createSubject(conn,"Administrator", "filenet", "FileNetP8"));
Domain domain = Factory.Domain.fetchInstance(conn, "P8DEVEL", null);
System.out.println("Domain name: " + domain.get_Name());
ObjectStore os = Factory.ObjectStore.fetchInstance(domain, "objstore01", null);
System.out.println("Object store name: " + os.get_Name());
} catch (Exception e) {
e.printStackTrace();
}
}
}