This content has been marked as final.
Show 3 replies
-
1. Re: JNDI Configuration in JBoss 4.0
carlwilliamb May 17, 2005 5:16 AM (in response to deepc)Hey, I'm also new to JBoss, I have a couple of examples working, and I used this in the jndi.properties file, check if it works for your prog...
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=Your JBoss server ip example: jnp://127.0.0.1:1099 java.naming.factory.url.pkgs=org.jboss.naming.client j2ee.clientName=Your client app name example: ExampleApp
-
2. Re: JNDI Configuration in JBoss 4.0
carlwilliamb May 17, 2005 5:28 AM (in response to deepc)sorry I missread the q, you'll probably also need these:
application.xml
ps. you should replace the display-name, home and remote to your program's names<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE application-client PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN' 'http://java.sun.com/dtd/application-client_1_3.dtd'> <application-client> <display-name>ExampleGUI</display-name> <!-- also the client app name in my case. --> <ejb-ref> <ejb-ref-name>ejb/ExampleRef</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>ExampleHome</home> <!-- home interface (extends EJBHome) --> <remote>Example</remote> <!-- this is an interface (extends EJBObject) --> </ejb-ref> </application-client>
jboss-client.xml<jboss-client> <jndi-name>ExampleGUI</jndi-name> <ejb-ref> <ejb-ref-name>ejb/ExampleRef</ejb-ref-name> <jndi-name>ExampleController</jndi-name> <!-- ejb (implements SessionBean) --> </ejb-ref> </jboss-client>
Manifest.mfManifest-Version: 1.0 Ant-Version: Apache Ant 1.6.2 Created-By: Carl Boshoff main-class: ExampleGUI
I think this everything now, If I remember something else, I'll post here again. -
3. Re: JNDI Configuration in JBoss 4.0
carlwilliamb May 17, 2005 5:31 AM (in response to deepc)to connect to the jboss server you need this:
Context initial = new InitialContext(); Context myEnv = (Context)initial.lookup("java:comp/env"); Object objref = myEnv.lookup("ejb/ExampleRef"); ExampleHome home = (ExampleHome)PortableRemoteObject.narrow(objref, ExampleHome.class); Example example = home.create();