0 Replies Latest reply on Oct 15, 2005 6:20 PM by Guilherme Melo e Maranhão

    Exception at lookup (java.lang.LinkageError: loader constrai

    Guilherme Melo e Maranhão Newbie

      Hi guys,

      this is my a ejb 2.1 problem:.
      that's my client accessing a stateless session bean:

      Properties properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      properties.put(Context.PROVIDER_URL, "localhost:1099");
      try{
      InitialContext context = new InitialContext(properties);
      Object ref = context.lookup("java:comp/env/Logar");
      LogarHome home = (LogarHome)PortableRemoteObject.narrow(ref, LogarHome.class);
      LogarRemote logarRemote = home.create();
      logarRemote.autenticarBancario(login, senha);
      }
      catch (Exception e){

      }

      When line Object ref = context.lookup("java:comp/env/Logar"); is executed, this exception is thrown:

      java.lang.LinkageError: loader constraints violated when linking javax/ejb/Handle class
      java.lang.Class.getDeclaredFields0(Native Method)
      java.lang.Class.privateGetDeclaredFields(Class.java:2232)
      java.lang.Class.getDeclaredField(Class.java:1852)
      java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1555)
      java.io.ObjectStreamClass.access$600(ObjectStreamClass.java:47)
      java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:381)
      java.security.AccessController.doPrivileged(Native Method)
      java.io.ObjectStreamClass.(ObjectStreamClass.java:373)
      java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:268)
      java.io.ObjectStreamClass.initProxy(ObjectStreamClass.java:464)
      java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1502)
      java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1457)
      java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
      java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      java.rmi.MarshalledObject.get(MarshalledObject.java:135)
      org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:57)
      org.jnp.interfaces.NamingContext.lookup(NamingContext.java:637)
      org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      javax.naming.InitialContext.lookup(InitialContext.java:351)
      sistemaBancario.cliente.struts.logar.LogarAction.autenticarUsuario(LogarAction.java:68)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
      org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
      org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
      org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
      org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
      org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)

      Does anybody know what is happening? Am I missing any jboss lib in my classpath?

      The version of jboss i am using is 4.0.3RC2.

      Thanks, Guilherme

      java.lang.LinkageError: loader constraints violated when linking javax/ejb/Handle class