Hi Adam,
I did a step back, installed a fresh full configuration , did configure AOP etc and rerun http://localhost:8080/shotoku-test/servlet for a start.
Now when I run the test(s) below I had to provide in the shokotu-test.war all the jar files required to resolve down to MBean shotoku:service=svn (the commons, javasvn.jar, shokotu-base and shokotu-svn), otherwise class not found exception happened. For me that sounds logical, because these sequences are running in the Servlet and not the EJB. So I can't understand why you don't require them - question here are you providing these classes on a lower level classloader directly, e.g. on the extension or system classloader (CLASSPATH) variable ?
My first test was without inject (to exclude potential probelms here)
------------------------------------------------------------------------------
Test 1: Without Inject, the code looks like
...
PrintWriter pw = response.getWriter();
ContentManager.setup();
test = ContentManager.getContentManager(null,"shotoku-test");
pw.write("Depends test: " + test + "");
...
Resulted in the following exception
20:55:37,711 ERROR [[shotokuServlet]] Servlet.service() for servlet shotokuServlet threw exception
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.jboss.shotoku.ContentManager.setup(ContentManager.java:433)
at org.jboss.shotoku.test.servlet.ShotokuServlet.service(ShotokuServlet.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Error creating MBeanProxy: shotoku:service=svn
at org.jboss.shotoku.svn.SvnTools.getService(SvnTools.java:90)
at org.jboss.shotoku.svn.SvnContentManager.(SvnContentManager.java:73)
... 24 more
Caused by: java.lang.RuntimeException: Error creating MBeanProxy: shotoku:service=svn
at org.jboss.mx.util.MBeanProxyExt.init(MBeanProxyExt.java:365)
at org.jboss.mx.util.MBeanProxyExt.(MBeanProxyExt.java:65)
at org.jboss.mx.util.MBeanProxyExt.create(MBeanProxyExt.java:344)
at org.jboss.mx.util.MBeanProxyExt.create(MBeanProxyExt.java:308)
at org.jboss.mx.util.MBeanProxyExt.create(MBeanProxyExt.java:283)
at org.jboss.shotoku.svn.SvnTools.getService(SvnTools.java:81)
... 25 more
Caused by: javax.management.InstanceNotFoundException: shotoku:service=svn is not registered.
at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:508)
at org.jboss.mx.server.MBeanServerImpl.getMBeanInfo(MBeanServerImpl.java:651)
at org.jboss.mx.util.MBeanProxyExt.init(MBeanProxyExt.java:357)
... 30 more
So it looks like he can't find the service deployed in EAR file, the startup file doesn't show a error and the console looks also alright (Question here, is the service selfregistering when it starts or do I need to add it to a config file ?)
20:52:31,182 INFO [EARDeployer] Init J2EE application: file:/F:/DEV/JBoss/jboss-4.0.3SP1/server/default/deploy/00shotoku.ear/
20:52:42,729 INFO [JaccHelper] Initialising JACC Context for deployment: shotoku-svn.ejb3
20:52:43,590 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=org.jboss.shotoku.svn.service.SvnServiceTimer, class=org.jboss.shotoku.svn.servic
r, type=STATELESS
20:52:44,962 INFO [JaccHelper] org.jboss.shotoku.svn.service.SvnServiceTimer has no @SecurityDomain - skipping JACC configuration
20:52:45,032 INFO [Ejb3Deployment] found EJB3 service bean: org.jboss.shotoku.svn.service.SvnServiceImpl
20:52:45,593 INFO [JaccHelper] org.jboss.shotoku.svn.service.SvnServiceImpl has no @SecurityDomain - skipping JACC configuration
20:52:45,663 INFO [JaccHelper] JACC Policy Configuration for deployment has been put in service
20:52:45,663 INFO [Ejb3Deployment] EJB3 deployment time took: 2964
20:52:46,294 INFO [ProxyDeployer] no declared remote bindings for : org.jboss.shotoku.svn.service.SvnServiceTimer
20:52:47,005 INFO [ProxyDeployer] no declared remote bindings for : org.jboss.shotoku.svn.service.SvnServiceImpl
20:52:47,105 INFO [EJB3Deployer] Deployed: file:/F:/DEV/JBoss/jboss-4.0.3SP1/server/default/deploy/00shotoku.ear/shotoku-svn.ejb3
20:52:47,145 INFO [EARDeployer] Started J2EE application: file:/F:/DEV/JBoss/jboss-4.0.3SP1/server/default/deploy/00shotoku.ear/
20:52:47,446 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
20:52:48,117 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
20:52:48,247 INFO [JkMain] Jk running ID=0 time=0/281 config=null
20:52:48,267 INFO [Server] JBoss (MX MicroKernel) [4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200510231751)] Started in 3m:3s:614ms
------------------------------------------------------------------------------
Test 2: With Inject
So I run the servlet with
public class ShotokuServlet extends HttpServlet {
@Inject(prefix="shotoku-test")
ContentManager test;
But here I got the strange error
21:58:44,025 ERROR [[shotokuServlet]] Servlet.service() for servlet shotokuServlet threw exception
java.lang.NoClassDefFoundError: org/jboss/shotoku/ContentManager
at org.jboss.shotoku.aop.InjectAspect.access(InjectAspect.java:52)
at org.jboss.aop.advice.org.jboss.shotoku.aop.InjectAspect0.invoke(InjectAspect0.java)
at org.jboss.aop.joinpoint.FieldReadInvocation.invokeNext(FieldReadInvocation.java:48)
at org.jboss.shotoku.test.servlet.ShotokuServlet.test_r_$aop(ShotokuServlet.java)
at org.jboss.shotoku.test.servlet.ShotokuServlet.service(ShotokuServlet.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
Now what is the classloader of the aop classes, because the shotoku-base is in the servlet war as well as in the ear available) ?
If you can give a some light to this I would really appreciate it ?
Regards Felix