[jboss-user] [EJB 3.0] - JNDI Issue - Deploying EJB3 using Eclipse to JBoss 5

yetti do-not-reply at jboss.com
Mon Apr 6 12:35:00 EDT 2009


Hello,

I've got a question that I think someone can help me with pretty quickly. I've got a stateless session bean that I've created based on this tutorial:

http://www.myeclipseide.com/documentation/quickstarts/ejb3/

My project name is different but the architecture of the project is the same -> a package that contains the bean, an interface, a local and remote. Then I have a simple tester app where I'm trying to call the bean using the remote.

JBoss starts just fine using both the command line as well as starting from within Eclipse. The bean deploys just fine either with a restart of JBoss or a redeploy. Where I am having trouble is running the tester application, specifically getting the JNDI name correct. When I set up the project I did NOT do support for Entity beans/JPA. Below is a snippet of the log from JBoss starting/deploying the bean:

----------------------------------------
11:20:06,218 INFO  [JBossASKernel] Created KernelDeployment for: com.acmeco.serverapp.ftp
11:20:06,234 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=com.acmeco.serverapp.ftp,name=FTPBean,service=EJB3
11:20:06,234 INFO  [JBossASKernel]   with dependencies:
11:20:06,234 INFO  [JBossASKernel]   and demands:
11:20:06,234 INFO  [JBossASKernel] 	jboss.ejb:service=EJBTimerService
11:20:06,234 INFO  [JBossASKernel]   and supplies:
11:20:06,234 INFO  [JBossASKernel] 	Class:com.acmeco.serverapp.ftp.ejb3.FTPBeanLocal
11:20:06,234 INFO  [JBossASKernel] 	jndi:FTPBean/local-com.acmeco.serverapp.ftp.ejb3.FTPBeanLocal
11:20:06,234 INFO  [JBossASKernel] 	jndi:FTPBean/remote-com.acmeco.serverapp.ftp.ejb3.FTPBeanRemote
11:20:06,234 INFO  [JBossASKernel] 	jndi:FTPBean/local
11:20:06,234 INFO  [JBossASKernel] 	jndi:FTPBean/remote
11:20:06,234 INFO  [JBossASKernel] 	Class:com.acmeco.serverapp.ftp.ejb3.FTPBeanRemote
11:20:06,234 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=com.acmeco.serverapp.ftp,name=FTPBean,service=EJB3) to KernelDeployment of: com.acmeco.serverapp.ftp
11:20:06,312 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=com.acmeco.serverapp.ftp,name=FTPBean,service=EJB3
11:20:06,328 INFO  [EJBContainer] STARTED EJB: com.acmeco.serverapp.ftp.ejb3.FTPBean ejbName: FTPBean
11:20:06,406 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

	FTPBean/remote - EJB3.x Default Remote Business Interface
	FTPBean/remote-com.acmeco.serverapp.ftp.ejb3.FTPBeanRemote - EJB3.x Remote Business Interface
	FTPBean/local - EJB3.x Default Local Business Interface
	FTPBean/local-com.acmeco.serverapp.ftp.ejb3.FTPBeanLocal - EJB3.x Local Business Interface
-----------------------------------

Here is the code in the testing client app:


package com.acmeco.serverapp.ftp.ejb3;
  | 
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | 
  | public class FTPBeanTestClient {
  | 
  | 	/**
  | 	 * @param args
  | 	 */
  | 	public static void main(String[] args) {
  | 		// TODO Auto-generated method stub
  | 		try {
  | 			InitialContext ctx = new InitialContext();
  | 			FTPBeanRemote bean = (FTPBeanRemote) ctx.lookup("com.acmeco.serverapp.ftp.ejb3.FTPBean/FTPBean");
  | 			bean.doWork();
  | 		} catch (NamingException e){
  | 			e.printStackTrace(); 
  | 		}
  | 	}
  | 
  | }
  | 

I know I'm doing something dumb with the InitialContext.  

1. What should I be putting into the client app context lookup? 
2. Am I doing something else wrong/dumb?

Thanks in advance,
yetti

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223747#4223747

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223747



More information about the jboss-user mailing list