}
}
public void processRequest(ObjectInputStream in, ObjectOutputStream out) {
JNDIResponse res = new JNDIResponse();
JNDIRequest req = null;
try {
req = new JNDIRequest();
req.readExternal(in);
} catch (Throwable e) {
res.setResponseCode(ResponseCodes.JNDI_NAMING_EXCEPTION);
NamingException namingException = new NamingException("Could not read jndi request");
namingException.setRootCause(e);
res.setResult(namingException);
if (logger.isDebugEnabled()){
try {
logger.debug("JNDI REQUEST: "+req+" -- RESPONSE: " + res);
} catch (Exception justInCase) {}
}
try {
res.writeExternal(out);
} catch (java.io.IOException ie) {
logger.fatal("Couldn't write JndiResponse to output stream", ie);
}
}
try {
String name = req.getRequestString();
if (name.startsWith("/")) name = name.substring(1);
Object object = null;
try {
if (req.getModuleId() != null && req.getModuleId().equals("openejb/Deployment")){
object = deploymentsJndiTree.lookup(name);
} else if (req.getModuleId() != null && clientJndiTree != null) {
Context moduleContext = (Context) clientJndiTree.lookup(req.getModuleId());
if (name.startsWith("comp/env/")) {
Context ctx = (Context) moduleContext.lookup("comp");
ctx = (Context) ctx.lookup("env");