[jboss-user] [EJB 3.0] - Re: Deploying a simple HelloWorld EJB3 under JBoss

balde do-not-reply at jboss.com
Fri Mar 30 11:36:29 EDT 2007


I re-installed JBoss 4.0.5 with the installer and option EJB3. I'm getting the error:
javax.naming.NameNotFoundException: org.os.ejb3.Hello not bound
Seams like the reflection lookup doesn't work like it should be for EJB3.
- my Interface:
package org.os.ejb3;
  | public interface Hello {
  | 	public String hello();
  | }
  | 
- My Bean:
package org.os.ejb3;
  | 
  | import javax.ejb.Remote;
  | import javax.ejb.Stateless;
  | 
  | 
  | @Stateless
  | @Remote(Hello.class)
  | public class HelloBean implements Hello {
  | 
  | 	public String hello() {
  | 		return "Hi there this is JBoss server side";
  | 	}
  | 
  | }
  | 

-my deployment descriptor:
<?xml version="1.0" encoding="UTF-8"?>
  | <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" 
  | 		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  | 		xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/ejb-jar_3_0.xsd"
  | 		version="3.0">
  | 
  | 	<enterprise-beans>
  | 	</enterprise-beans>
  | 		
  | </ejb-jar>

- my client:
package org.os.ejb3;
  | 
  | import javax.naming.Context;
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | 
  | public class HelloClient {
  | 
  | 	/**
  | 	 * @param args
  | 	 */
  | 	public static void main(String[] args) {
  | 		System.out.println("STARTING HelloClient ... ");
  | 		
  | 		try {
  | 			Context ctx = new InitialContext();
  | 			
  | 			Hello h = (Hello)ctx.lookup("org.os.ejb3.Hello");
  | 			String s = h.hello();
  | 			
  | 			System.out.println("HelloClient -- received from server > " + s);
  | 			
  | 		} catch (NamingException e) {
  | 			e.printStackTrace();
  | 		}
  | 		
  | 	}
  | 
  | }
  | 

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

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



More information about the jboss-user mailing list