[jboss-dev-forums] [Design of POJO Server] - Doing a lookup for ProfileService

bytor99999 do-not-reply at jboss.com
Mon Apr 16 18:11:47 EDT 2007


So we have a cactus test that is running an object that gets an InitialContext, and does a lookup for ProfileService. But it gives a classcast exception when casting to ProfileService. It appears the object in the JNDI tree is of type AOPProxy.

I had tried a test of deploying an EJB that also does a lookup and had to include a number of jar files to get past that, but in the end it has a ClassDefNotFoundError looking for a SecurityContext class.


  | <error message="AOPProxy$0" type="org.apache.cactus.internal.client.ServletExceptionWrapper">
  | java.lang.ClassCastException: AOPProxy$0
  | 	at org.jboss.on.plugins.jboss.ProfileJBossServerComponent.initialize(ProfileJBossServerComponent.java:70)
  | 	at org.jboss.on.plugins.jboss.JBossServerTest.testInitialize(JBossServerTest.java:32)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
  | 	at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
  | 	at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
  | 	at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
  | 	at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
  | 	at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
  | 	at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
  | 	at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
  | 	at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
  | 	at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
  | 	at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
  | 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  | 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
  | 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:86)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
  | 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  | 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
  | 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  | 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
  | 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  | 	at java.lang.Thread.run(Thread.java:595)
  | 



Here is the code


  |       InitialContext initialContext = null;
  |       try
  |       {
  |          initialContext = new InitialContext();
  |       }
  |       catch (NamingException e)
  |       {
  |          e.printStackTrace();
  |       }
  | 
  |       try
  |       {
  |          profileService = (ProfileService)initialContext.lookup("ProfileService");
  |       }
  |       catch (NamingException e)
  |       {
  |          e.printStackTrace();
  |       }
  | 

Here is the exception I got in my EJB test


  | Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/security/SecurityContext
  | 	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
  | 	at $Proxy0.testProfileService(Unknown Source)
  | 	at org.jboss.ejb.MainTestClass.main(MainTestClass.java:20)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
  | 

I am guessing that there is some security behind getting the ProfileService, which makes sense since we wouldn't want any Joe Programmer/Hacker creating an app that deletes all the deployments in an App Server.

But what do you need to include in your apps to get the ProfileService.

Thanks

Mark Spritzler

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037761#4037761

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037761



More information about the jboss-dev-forums mailing list