Hi,
The ClassCastException is probably because of a class loader issue :
never tested from the same JVM than the Jboss running Nuxeo ...
Anyway, if you reach the CoreSession via simple EJB3 lookup, the Nuxeo
Runtime won't be initialized so most LazyLoading feature won't be
available (and DocumentModel is lazy).
If you want to use java API from outside of Nuxeo, you should consider
using NuxeoClient (that is used inside Apogee and Nuxeo Shell).
NuxeoClient will deploy and initialize the Runtime environment to have
full and easy access to Nuxeo API, without having to do JNDI lookups.
You can see a RCP sample code here :
https://svn.nuxeo.org/nuxeo/nuxeo-rcp/trunk/nuxeo-apogee-rcp/samples/org.nuxeo.ecm.rcp.sample1/src/org/nuxeo/ecm/rcp/samples/sample1/Sample.java
If Bogdan has some time, he may send you a sandboxed sample code about
NuxeoClient.
Hope this helps.
Tiry
Sanjay Dalal a écrit :
Hi,
Using Nuxeo 5.2 M4 with JBoss 4.2.3 GA.
I am trying to connect to Nuxeo repository using code similar to
http://svn.nuxeo.org/nuxeo/sandbox/nuxeo-remoting-sample/ but from a war
file (JAX-RS resource). However, I get ClassCastException while trying to
cast jndi retrieved object (proxy) in the following code.
private static CoreSession getSession()
throws NamingException {
String beanRemoteLocation = "nuxeo/DocumentManagerBean/remote";
javax.naming.Context ctx = getInitialContext();
Object proxy = ctx.lookup(beanRemoteLocation);
CoreSession session = (CoreSession) proxy; //classcastexception
return session;
}
My war (a JAX-RS resource) also packages nuxeo-core-apis.jar (snapshot
1.5). Nuxeo.ear (which also happens to package the same core apis jar) is
deployed on the same server (successfully). Please provide pointer to a
working sample code and packaging directions that uses Java (local or
remote) APIs to connect to the Nuxeo Repository. Note that my war will
always be colocated with Nuxeo.ear in the same JVM.
thanks,
sanjay
CollectionSpace - UC Berkeley
thanks,
sanjay
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm