1 2 Previous Next 19 Replies Latest reply on Aug 22, 2007 4:01 PM by rhinosystemsinc

    Why does jbossall-client.jar cause

      Hi,

      Recently I am doing migration from jboss4.0.4GA to jboss4.2.1.GA, but when I included jbossall-client.jar in the web-inf/lib folder of war file, and deployed the war file to jboss, where all the enclosed jars coming from jboss4.2.1.GA/client folder. It failed with "java.lang.IncompatibleClassChangeError" when "sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener"

      I am guessing the new jbossall-client.jar is created based on some dependency classes of diferent version other than server-side jars, and jboss runtime just picked up the classes from the client jar instead of from server-side jars. therefore the above exception came out.

      Does anybody have the same issue and get a solution for that, 'coz I need jbossall-client.jar for calling ejb from tomat web container which is embedded in jboss4.2.1.GA.

      Thanks,
      Leo

        • 1. Re: Why does jbossall-client.jar cause
          waynebaylor

          you can't look the ejbs up with JNDI?

          • 2. Re: Why does jbossall-client.jar cause

            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

              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

                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

                  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

                    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

                      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

                        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

                          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

                            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

                              //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

                                is EjbHomeClass the same as MyEjbHome.class?

                                • 13. Re: Why does jbossall-client.jar cause

                                  yes, EjbHomeClass is the same as MyEjbHome.class

                                  • 14. Re: Why does jbossall-client.jar cause
                                    waynebaylor
                                    1 2 Previous Next