stefano bertozzi [http://community.jboss.org/people/bertoz84] created the discussion
"EJB - JBOSS - JNDI HELP!!!" To view the discussion, visit: http://community.jboss.org/message/593474#593474 -------------------------------------------------------------- Hello, i'm new!!! I'm approacing for the first time with JBoss and EJB; currently i'm running JBOSS 6.0 final, EJB 3.0 ( i chose this when i created my project - i don't want to use EJB 3.1 for now ), Eclipse Helios. Everything should be configured, i hope. That's what i have done till now: Created a +CalculatorBean+ and his interface +CalculatorRemote+ under the package +mycalcBean+; Created a +CalculatorClient+ under the package +mycalcClient+; both in the same EJB project +MyProjectEJB3.0.+ The client is a Java simple main that looks up for my bean and use a couple of his methods and runs as a Java application. I have to set environment properties in my client and pass +env+ to my context.lookup: *+ Hashtable<String, String> env = new Hashtable<String, String>();+* *+ env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");+* *+ env.put(Context.PROVIDER_URL, "localhost:1099");+* *+ env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");+* + InitialContext ctx = new InitialContext(*env*);+ + Object obj = ctx.lookup(CalculatorBean.class.getSimpleName() + "/remote"/*"CalculatorBean/remote"*/);+ or i get the NOINITIALCONTEXT error. Why i need to do this when a lot of tutorials don't? Moreover i would prefer to use @EJB to look for my bean. I have read a lot of things that tell about the jndi.properties file. Well, that's my file under JBOSS_HOME\server\default\conf: *# DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING* *#* *java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory* *java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces* I also tryed to put this file in the path where i have my client and in the CLASSPATH of my JDK. Nothing worked. Why my client can't read this default conf file? One last question: if i change position to my client, putting it into a different project ( for example: +MyProjectEJB3.0Client+ ) the compiler doesn't see the +import project.mycalcBean.*+ How to do that? thank you for your understanding and help!!! -------------------------------------------------------------- Reply to this message by going to Community [http://community.jboss.org/message/593474#593474] Start a new discussion in JNDI and Naming at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]
_______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
