-
1. Re: Why does jbossall-client.jar cause
waynebaylor Aug 16, 2007 3:01 PM (in response to leo_ni)you can't look the ejbs up with JNDI?
-
2. Re: Why does jbossall-client.jar cause
leo_ni Aug 16, 2007 4:02 PM (in response to leo_ni)I can look up EJB via JNDI by using jbossall-client.jar, but the problem is when I inlcude this paritcular jar in web-inf/lib in the war file from inside web container, JBOSS 4.2.1.GA failed to deploy the war file with some "java.lang.IncompatibleClassChangeError" log infomation. the whole war deployment stopped after a successful EJB call (ejb call succeeded with good data back).
-
3. Re: Why does jbossall-client.jar cause
waynebaylor Aug 16, 2007 5:12 PM (in response to leo_ni)the jbossall-client.jar is for use in an external client. you're probably getting that error because jboss has already loaded the class and you're trying to load it again.
what exactly are you using that jboss doesn't provide by default? -
4. Re: Why does jbossall-client.jar cause
leo_ni Aug 16, 2007 6:03 PM (in response to leo_ni)yes, you are right, when I use jbossall-client.jar in an external client, it is fine. actually I need to use some EJB lookup-specific jar/jars (e.g. jnp-client.jar, jboss-je22.jar, etc.) within my web application. I tried to use some other jars combination instead of use the big jbossall-client.jar, but it ended up giving me the same error especially if I use jnp-client.jar.
I thought the default classloading sequence for a web application is web libraries first, then tomcat libraries and jboss libraries. So before my war is deployed, everything is fine with JBoss, when JBOSS is trying to deploy my war file in a isolated web application scope, it gets jbossall-client.jar loaded first, which might contains some implementation classes with different version of dependencies classes from server side version of dependencies classes I guess. then there is conflicts. That's my thoughts about the issue, but I don't how to fix it. -
5. Re: Why does jbossall-client.jar cause
waynebaylor Aug 16, 2007 8:43 PM (in response to leo_ni)can you be more specific about what you're using in jnp-client.jar, etc..
you shouldn't need to use those within your web application. -
6. Re: Why does jbossall-client.jar cause
leo_ni Aug 17, 2007 1:09 PM (in response to leo_ni)I use JBOSS "jnp://ip:1099" as Context.PROVIDER_URL to look up EJB remote instance and with "org.jboss.naming:org.jnp.interfaces" for env setting of "java.naming.factory.url.pkgs", that's why I need jnp-client.jar, which is also included in jbossall-client.jar.
If I don't use these jars, how to look up EJB remote instance by ejb jndi name. Is there any other protocol or setting that can be used for looking up EJB from JBOSS application server container? what's your idea? -
7. Re: Why does jbossall-client.jar cause
waynebaylor Aug 17, 2007 1:50 PM (in response to leo_ni)fortunately you don't need the jnp-client.jar to do that. try this:
Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces"); p.put(Context.PROVIDER_URL, "192.168.bl.ah:1099"); Context ctx = new InitialContext(p); MyRemote bean = (MyRemote)ctx.lookup("the jndi name");
if you are looking up a bean from the same server, then you can just do:Context ctx = new InitialContext(); MyRemote bean = (MyRemote)ctx.lookup("the jndi name");
-
8. Re: Why does jbossall-client.jar cause
leo_ni Aug 17, 2007 4:10 PM (in response to leo_ni)Is that becasuse I am using Context.INITIAL_CONTEXT_FACTORY with vaule of "org.jboss.security.jndi.JndiLoginInitialContextFactory", so if I dropped off jbossall-client.jar (including the classes from jnp-client.jar), it gave me error like the following:
javax.ejb.CreateException,java.rmi.RemoteException javax.ejb.EJBException: Invalid invocation, check your deployment packaging ....... -
9. Re: Why does jbossall-client.jar cause
leo_ni Aug 17, 2007 4:28 PM (in response to leo_ni)Also, just as you suggested, I removed Context.PROVIDER_URL setting for InitialContext's parameter 'coz it's looking up EJB from inside the server, and the codes arejust like the following:
Properties env1 = new Properties();
env1.setProperty(Context.SECURITY_PRINCIPAL,"u01");
env1.setProperty(Context.SECURITY_CREDENTIALS,"u01");
env1.put.Context.INITIAL_CONTEXT_FACTORY,"org.jboss.security.jndi.JndiLoginInitialContextFactory");
Context initial = new InitialContext(env1);
it still gave me error like:
Caused by: java.lang.ClassCastException: $Proxy83
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212) -
10. Re: Why does jbossall-client.jar cause
waynebaylor Aug 17, 2007 5:56 PM (in response to leo_ni)could you post the code used to do the lookup and the casting of the returned object?
-
11. Re: Why does jbossall-client.jar cause
leo_ni Aug 17, 2007 6:10 PM (in response to leo_ni)//Code:
Properties env = new Properties();
env.put(Context.PROVIDER_URL, url);
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.security.jndi.JndiLoginInitialContextFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
env.put(Context.SECURITY_PRINCIPAL,"u01");
env.put(Context.SECURITY_CREDENTIALS,"u01");
Context initial = new InitialContext(env);
Object objref = initial.lookup(jndiName);
MyEjbHome home = (MyEjbHome) PortableRemoteObject.narrow(objref, EjbHomeClass);
Object MyEjbRemote= home.create(); -
12. Re: Why does jbossall-client.jar cause
waynebaylor Aug 19, 2007 12:18 PM (in response to leo_ni)is EjbHomeClass the same as MyEjbHome.class?
-
13. Re: Why does jbossall-client.jar cause
leo_ni Aug 20, 2007 1:17 PM (in response to leo_ni)yes, EjbHomeClass is the same as MyEjbHome.class
-
14. Re: Why does jbossall-client.jar cause
waynebaylor Aug 20, 2007 1:55 PM (in response to leo_ni)i found this post which may cover your problem:
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3885650#3885650