Trying to invoke EJB services from WebLogic client

Latest response

Hi,

trying to invoke EJB services on JBoss EAP 6.1 from a client running on WebLogic Portal 10.3.4, the console shows this error:

javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.NoSuchFieldError: TRACE]
at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:51)
at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:152)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.(InitialContext.java:197)
at it.sistinf.ServiziInfortunato.delegate.ServiceLocator.getContext(ServiceLocator.java:78)
at it.sistinf.ServiziInfortunato.delegate.ServiceLocator.getEJBObject(ServiceLocator.java:51)
at it.sistinf.ServiziInfortunato.delegate.ResourceDelegate.create(ResourceDelegate.java:67)
at it.sistinf.ServiziInfortunato.delegate.ResourceDelegate.check(ResourceDelegate.java:35)
at it.sistinf.ServiziInfortunato.delegate.ResourceDelegate.(ResourceDelegate.java:24)
at it.sistinf.ServiziInfortunato.filters.UserValidationFilter.doFilter(UserValidationFilter.java:371)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
Caused by: java.lang.NoSuchFieldError: TRACE
at org.jboss.logging.Log4jLogger.translate(Log4jLogger.java:60)
at org.jboss.logging.Log4jLogger.isEnabled(Log4jLogger.java:35)
at org.jboss.logging.Logger.isTraceEnabled(Logger.java:95)
at org.jboss.naming.remote.client.InitialContextFactory.mergeWithDefaults(InitialContextFactory.java:316)
at org.jboss.naming.remote.client.InitialContextFactory.createEndpoint(InitialContextFactory.java:219)
at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateEndpoint(InitialContextFactory.java:207)
at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:170)
at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:146)
... 22 more

I already tried changing the log4j library inside the project, substituting many versions, from 1.2.14 to 1.2.17, but the problem seems to persist.
Any ideas?

Here the config properties:

Properties properties = new Properties();
properties.put("java.naming.factory.initial","org.jboss.naming.remote.client.InitialContextFactory");
properties.put("java.naming.factory.url.pkgs","org.jboss.ejb.client.naming");
properties.put("jboss.naming.client.ejb.context", true);
properties.put("java.naming.provider.url", "remote://x.x.x.x:4447");
InitialContext context = new InitialContext(properties);

Responses

Sounds like you have a rogue log4j JAR somewhere which doesn't yet have the TRACE field. I'd do a search for log4j JAR's (check the endorsed directory for the JDK too) and remove any older ones.

Thank you for your answer! I found the issue was entirely client-side, since WLP 10.3.4 uses a native log4j version 1.2.8, which doesn't have the TRACE field. To resolve I had to add to the WL deployement-descriptor the following lines:

<wls:prefer-application-packages>
   <wls:package-name>org.apache.log4j.*</wls:package-name>
</wls:prefer-application-packages>

besides including the log4j-1.2.17.jar in the WL project.

Glad it worked :)