[jboss-user] [EJB 3.0] - Remote Not bound -- Help me !
Sukar1205
do-not-reply at jboss.com
Thu Sep 20 10:11:13 EDT 2007
I am testing a customerBean class through a client class but its giving me remote not bound. I checked the JNDI tree and remote is NOT UNDER customerBean. a little help would be great to get this program running. All I am trying to do is add a customer in a table.
Here is the code for client ....
|
| public class Client {
|
| /** Creates a new instance of Client */
| public static void main(String[] args) throws Exception
| {
| Connection conn;
| // Step 1: Load the JDBC driver.
| Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
| System.out.println("Driver Loaded.");
| // Step 2: Establish the connection to the database.
| String url = "jdbc:sqlserver://localhost:1433;database=kc";
| conn = DriverManager.getConnection(url, "sa", "hi");
| System.out.println("Got Connection.");
|
| Client c = new Client();
| CustomerRemote r = c.lookupCustomerBean();
| TempCustomer first = new TempCustomer();
| first.setId(20);
| first.setName("aaaa");
| r.addCustomer(first);
| }
|
This is the lookupCustomerBean function which where it gives me remote not bound
| private CustomerRemote lookupCustomerBean() {
| try {
| Hashtable props = new Hashtable();
| props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
| props.put("java.naming.provider.url", "localhost");
| Context c = new InitialContext(props);
| //HERE IS THE PROBLEM !!
| return (CustomerRemote)c.lookup("CustomerBean/remote");
| }
| catch(NamingException ne) {
| Logger.getLogger(getClass().getName()).log(Level.SEVERE,"exception caught", ne);
| throw new RuntimeException(ne);
| }
| }
|
Please some one tell me what is wrong with this code. why is remote not under customerBean.
Thanks in advance,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086705#4086705
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086705
More information about the jboss-user
mailing list