-
1. Re: Where can i find the javaee.jar?
wdfink Oct 21, 2011 2:08 AM (in response to hsch)I would start with the JBoss quickstart examples for AS7, can be found on the download page http://www.jboss.org/jbossas/downloads/
Also the Getting started is helpful https://docs.jboss.org/author/display/AS7/Getting+Started+Developing+Applications+Guide
But remember that the full EJB3 functionality is not available until AS7.1, I don't look in the example whether you need this for this example.
-
2. Re: Where can i find the javaee.jar?
hsch Oct 21, 2011 4:38 AM (in response to wdfink)Thank you for your answer.
i still have the problem, that i cannot find the right jar. there are so many jars and i cannot find any xxx-client-xxx.jar.
My Client looks like that:
public static void main(String[] args) { // TODO Auto-generated method stub TestClient client = new TestClient(); try { client.runTest(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void runTest() throws Exception{ Properties props = new Properties(); props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming"); // props.setProperty("java.naming.provider.url", "127.0.0.1:1099"); props.setProperty("java.naming.provider.url", "localhost:1099"); InitialContext ctx = new InitialContext(props); SimpleBean bean = (SimpleBean) ctx.lookup("ejb/SimpleBeanJNDI"); String result = bean.sayHello("blabla"); System.out.println(result); }
My Server EJB lokks like that:
Interface "SimpleBean":
package de.test.ejb; import javax.ejb.Remote; @Remote public interface SimpleBean { public String sayHello(String name); }
And this is the "SimplebeanImpl":
package de.test.ejb; import javax.ejb.Stateless; @Stateless(name="Example", mappedName="ejb/SimpleBeanJNDI") public class SimpleBeanImpl implements SimpleBean { @Override public String sayHello(String name) { // TODO Auto-generated method stub return "Hallo " + name + "!"; } }
I think, this piece of code is correct and i am only missing the right jar-file in my build path. Can you say me what is name of the jar in JBoss AS 7? There are many jars in modules, but i do not know which to take. I tried a lot, but i get an error at every try.
My EJB, which i deployed in JBoss, shows no error. Only the Client.
Please help me.
Best regards
hsch
-
3. Re: Where can i find the javaee.jar?
hsch Oct 21, 2011 4:58 AM (in response to hsch)Aside from the fact that i does not found the right jars for my client project, i found another discussion. I think, this is my problem, too, isn't it?! Please correct me, if i am on the wrong way.
http://community.jboss.org/thread/173385?tstart=0
So, i think, i am using JNDI lookup in my EJB and Client Application and it is still not supported in JBoss AS 7.0.2 (which i am using)?
Best Regards
hsch
-
4. Re: Where can i find the javaee.jar?
jaikiran Oct 21, 2011 5:17 AM (in response to hsch)hsch hsch wrote:
So, i think, i am using JNDI lookup in my EJB and Client Application and it is still not supported in JBoss AS 7.0.2 (which i am using)?
That's correct, it's not available in the released versions. It's a work in progress in AS7 upstream and the plan is to have it available in a upcoming release.
-
5. Re: Where can i find the javaee.jar?
hsch Oct 21, 2011 5:52 AM (in response to jaikiran)ok, thank you for your reply.
But can you help me with my problem?
I get this Exception:
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory] at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.init(Unknown Source) at javax.naming.InitialContext.<init>(Unknown Source) at de.test.ejb.TestClient.runTest(TestClient.java:40) at de.test.ejb.TestClient.main(TestClient.java:18) Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source) ... 6 more
That means that i am missing the right class respectively right jar. Can you say me, which jar i have to add to my classpath in eclipse? I know, i will get a new exception (NameNotFoundException, i think), but i would like to know where i can find the right jar in the jboss directory. there are so many jars and i just does not find the correct jar!!
-
6. Re: Where can i find the javaee.jar?
jaikiran Oct 21, 2011 6:04 AM (in response to hsch)JNDI in AS7 is not based on JNP project. So those jars are not available. Access to JNDI from a remote client isn't yet available.
-
7. Re: Where can i find the javaee.jar?
hsch Oct 21, 2011 6:11 AM (in response to jaikiran)ah ok. Again, Thank you for your help.
Best regards
hsch