-
1. Re: ejb 'not bound'
adrian.brock May 8, 2003 6:23 PM (in response to sysuser1)Post the lookup code.
Regards,
Adrian -
2. Re: ejb 'not bound'
sysuser1 May 8, 2003 7:08 PM (in response to sysuser1)Lookup code below - you can see all of the other lookups I've tried commented out - the current one is the only one that doesn't generate an error & seems to connect
THANKS much
package edu.stanford.scil.conductor.ejb.util;
import org.apache.log4j.*;
import javax.naming.*;
import java.rmi.*;
import java.sql.*;
import javax.sql.*;
public class Util
{
private static Category logger = Category.getInstance(Util.class.getName());
private static final String dataSourceName = "java:/PostgresDS";
// private static final String dataSourceName = "jdbc/PostgresDS";
// private static final String dataSourceName = "java:/jdbc/PostgresDS";
// private static final String dataSourceName = "java:comp/env/jdbc/PostgresDS";
/** returns a JDBC Connection the the database used by the Conductor app */
public static Connection getConnection()
throws SQLException, RemoteException
{
logger.info("get datasource");
DataSource ds = getDataSource(dataSourceName);
return ds.getConnection();
}
private static DataSource getDataSource(String dsName)
throws RemoteException
{
DataSource ds = null;
try
{
Context ic = new InitialContext();
ds = (DataSource) ic.lookup(dsName);
} catch (NamingException e)
{
logger.error(e.toString());
throw new RemoteException(e.getMessage());
}
return ds;
}
} -
3. Re: ejb 'not bound'
jonlee May 8, 2003 7:23 PM (in response to sysuser1)The problem seems to be manifesting on the servlet side of things so I think Adrian was asking about the servlet look-up. In particular, what is the look-up code for finding BookingManager? Your servlet can't seem to find the reference you provide in the JNDI repository.
-
4. Re: ejb 'not bound'
sysuser1 May 9, 2003 1:29 PM (in response to sysuser1)Pardon my ignorance but I hope that the below is what you are referring to - I inherited this project from someone else & am not too savvy in this domain (if that wasn't obvious...)
The app was originally deployed to Oracle App Server so I changed these 2 lines below:
THANKS!
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
// env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
// env.put(Context.PROVIDER_URL, "ormi://localhost:23891/current-workspace-app");
env.put(Context.PROVIDER_URL, "ormi://localhost/conductor");
Context ctx = new InitialContext(env);
BookingManagerHome bookingManagerHome = (BookingManagerHome)ctx.lookup("BookingManager");
BookingManager bookingManager;
bookingManager = bookingManagerHome.create();
Date rangeStart = dFormat.parse("2002.08.20 12:00:00");
Date rangeEnd = dFormat.parse("2002.09.20 16:00:00");
RoomHome roomHome = (RoomHome)ctx.lookup("Room");
Room room = roomHome.findByName("Classroom 120"); -
5. Re: ejb 'not bound'
jonlee May 9, 2003 8:49 PM (in response to sysuser1)Your JNDI binding for BookingManager is ejb/BookingManager. But you are looking for "BookingManager". Have you tried searching the JNDI space for "ejb/BookingManager"? Or "java:/ejb/BookingManager"?