Tomcat – Unable to have Tomcat call a method of JBOSS Service

apache-2.2javatomcat

I am building a simple test application, which has GWT client as front end. I am using JBOSS as my application server and there are remote services running on JBOSS. Eclipse is my development environment.

While I try and call a simple hello method of JBOSS remote interface through eclipse it works fine the JNDI lookup works fine and the method of remote interface gets invoked properly.

While I deploy the business layer on JBOSS and keep the GWT application running from Eclipse and at that time also JNDI lookup works fine and the method of remote interface gets invoked properly.

In the third case I deploy the web application on Tomcate and business layer on JBOSS, in that case the JNDI lookup works fine but the problem is when I try to invoke the method of remote interface I get following error.

Following is my simple code.

=================== Code ===================================

try {
GreetingServiceBI bi = (GreetingServiceBI)
ServiceLocator.getInstance().getRemoteService(GreetingServiceBI.class);

System.out.println("BI Initialized.");

System.out.println(bi.getClass().toString());

msg = bi.sayHi(input);

System.out.println("BI said Hi");

} catch (NamingException e) {
e.printStackTrace();
}

The exception which I get while running this code from Tomcat I get the Message
BI Initialized
Class $Proxy2
After that I get error from Tomcat Log

================== Exception =======================================
Oct 21, 2010 3:24:53 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String com.client.GreetingService.greetServer(java.lang.String) throws java.lang.IllegalArgumentException' threw an unexpected exception: java.lang.reflect.UndeclaredThrowableException
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:188)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy7.sayHi(Unknown Source)
at com.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
… 17 more
Caused by: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.ejb3.security.client.SecurityActions.createSecurityContext(SecurityActions.java:657)
at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:59)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
at $Proxy8.invoke(Unknown Source)
at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:261)
at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101)
… 24 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.jboss.security.SecurityContextFactory.createSecurityContext(SecurityContextFactory.java:117)
at org.jboss.security.SecurityContextFactory.createSecurityContext(SecurityContextFactory.java:76)
at org.jboss.ejb3.security.client.SecurityActions$1.run(SecurityActions.java:662)
… 34 more
Caused by: java.lang.NoClassDefFoundError: javax/security/jacc/PolicyContextException
at org.jboss.security.plugins.JBossSecurityContext.(JBossSecurityContext.java:82)
… 41 more
Caused by: java.lang.ClassNotFoundException: javax.security.jacc.PolicyContextException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
… 42 more

======================================
I think that this is configuration issue but I am not able to figure out.

I am in middle of a production cycle and I am stuck up.

Thanks in Advance.

Best Answer

Root exception is java.lang.ClassNotFoundException: javax.security.jacc.PolicyContextException

This class is found in JEE jars like in this list.

Suggest you try to download and put client.jar or jacc-1_0.jar in TOMCAT_HOME/lib if Tomcat6 or in TOMCAT_HOME/server/lib if Tomcat 5.5

Related Topic