9 Replies Latest reply on Dec 21, 2005 8:29 AM by talfco

    Inital Test Problem

      I downloaded the code from the subversion repository and got it builded and deployed correctly. Now I wanted to run the tests via the JUnitEETestServlet but always get the following error (the corresponding deploy directory JBoss\app\jboss-4.0.3SPI\server\default\deploy\00shotoku.ear contains the correct shotoku-base.jar && I did also the suggested weaving stuff).

      Any Suggestion what could be wrong ??

      00:23:45,984 ERROR [[JUnitEETestServlet]] Servlet.service() for servlet JUnitEETestServlet threw exception
      java.lang.NoClassDefFoundError: org/jboss/shotoku/exceptions/ResourceAlreadyExists
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
      at java.lang.Class.getMethod0(Class.java:2611)
      at java.lang.Class.getMethod(Class.java:1579)
      at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:99)
      at org.junitee.runner.TestRunner$1.run(TestRunner.java:70)
      at org.junitee.runner.TestRunner.run(TestRunner.java:95)
      at org.junitee.servlet.JUnitEEServlet.runTests(JUnitEEServlet.java:232)
      at org.junitee.servlet.JUnitEEServlet.doGet(JUnitEEServlet.java:203)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      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:
      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)



        • 1. Re: Inital Test Problem

          I found it now:

          The shotoku-test/maven.xml build goal didn't include the

          <ant:copy file="${maven.repo.local}/shotoku/jars/shotoku-base.jar"
          tofile="target/shotoku-test/WEB-INF/lib/shotoku-base.jar" />



          I added it, now I don't get any "class not found" anymore.

          • 2. Re: Inital Test Problem
            adamw

            Hello,
            not bundling shotoku-base.jar in shotoku-test.war is intentional, because it works without it on our configurations - it is sufficient that 00shtoku.ear contains it - I suppose that the ear publishes all jars it contains (this is only my experimental experience :) ).
            I'm wondering why it doesn't work on your AS ... You use the same version as I do (4.0.3SP1), but you have the ear in the "default" configuration - did you use the installer or the packaged version?
            Also, I guess it isn't written anywhere yet, to run the tests you need a "shotoku-test" directory in your svn repository.
            Hope you will manage to run shotoku, if you have any problems/ suggestions etc - please write :).

            --
            Cheers,
            Adam

            • 3. Re: Inital Test Problem

              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

              • 4. Re: Inital Test Problem
                adamw

                Hello,
                I think that the jars that are bundled with an ear are available to web-applications on the "AS" level class loader - but I haven't studied class loaders architecture much yet, so I might be mistaken :). However, bundling these jars in the ear only is enough for me to make the classes visible for servlets.

                Anyway, the service is self-registering. But I noticed you don't have some crucial two lines in your server log, which you should have (marked with (!)):

                10:37:26,692 INFO [ProxyDeployer] no declared remote bindings for : org.jboss.shotoku.svn.service.SvnServiceImpl
                (!) 10:37:34,102 INFO [SvnServiceImpl] Added svn repository: default
                (!) 10:37:34,103 INFO [ContentManager] Added content manager: default, org.jboss.shotoku.svn.SvnContentManager
                10:37:34,111 INFO [EJB3Deployer] Deployed: file:/home/adamw/jboss/jboss-4.0.3SP1/server/all/deploy/00shotoku.ear/shotoku-svn.ejb3
                10:37:34,118 INFO [EARDeployer] Started J2EE application: file:/home/adamw/jboss/jboss-4.0.3SP1/server/all/deploy/00shotoku.ear/
                


                So, can you please check if you have "shotoku.embedded" property set to "false"? (you should have it set so; also, there is no need to call "ContentManager.setup();" in AS mode).

                If you do have it set so, you should see either a log entry informing you about a successfull content manager registration or an error. If you don't, can you please tell me how do you install the AS, which version of EJB3 and AOP are you using (or maybe you are using the installer?). I'll try to reproduce your configuration then.

                --
                Cheers,
                Adam

                • 5. Re: Inital Test Problem

                  Hi Adam,
                  ok so it looks like my EAR gets correctly deployed but the service gets not registered (I think this could be the reason that the classes are not visible, as soon that starts to work I will not need the jar files anymore in the war file).

                  I added some trace output to the create, start etc. method and none of it is dumped to the console, means the service is definitely not called during startup.

                  BT.W. Embedded is set to false and I'm used for the clean installation the 4.0.3SP1 installer and selected "all".

                  The problem looks similar to this one:
                  http://www.jboss.com/index.html?module=bb&op=viewtopic&t=73769. But I checked for the jboss-annotations-ejb3.jar which can be found correctly in the jboss-4.0.3SP1\server\default\deploy\ejb3.deployer.

                  Perhaps the installer has a problem, will try later today to do a installation without using the installer.


                  Bye for now
                  Felix

                  • 6. Re: Inital Test Problem
                    adamw

                    Hello,
                    I've installed the AS using the installer and I had the same exceptions as you do. Here's how to fix that:
                    1. Install the newest version of EJB3 (that's RC3) --> this solves the "service not starting" problem
                    2. In server/default/deploy/ear-deployer.xml, change line 13 to

                    <attribute name="Isolated">false</attribute>
                    --> this solves the "class not found" exceptions.

                    I'll try to provide a deployment option which supports "isolated" configurations in beta.

                    Hope this will help you,
                    Adam

                    • 7. Re: Inital Test Problem

                      Hi Adam,
                      that helped to fix the starting problem - thanks.
                      The status of the Test Servlet is now:
                      Works via svn:// or http:// as long as the servlet uses

                      test = ContentManager.getContentManager(null,"shotoku-test");
                      
                      to initialize.
                      Using
                      @Inject(prefix="shotoku-test")
                      will not initialize the ContentManager. Do I need a newer version of the aop jars ?

                      Cheers Felix
                      B.T.W:As expected I could get rid of the jar files in the war file.


                      • 8. Re: Inital Test Problem
                        adamw

                        Hello,
                        I tested the injects today and everything works fine. Here's how I configure everything:
                        - install jboss as 4.0.3sp1 from the installer, using the "all" configuration
                        - install jboss ejb3 rc3 (with (!) the aop that is provided there - this means deleting the aop-deployer that comes from the installation.
                        - configure the pluggable-instrumentor.jar and AOP as described on the wiki page
                        - edit ear-deployer.xml

                        In the deploy directory, you should have:
                        - 00shotoku.ear
                        - shotoku-aop.aop

                        After configuring it so, injects work. At startup, near the beginning, you should see something like:

                        21:40:04,806 INFO [SocketServerInvoker] Invoker started for locator: InvokerLocator [socket://127.0.0.1:3873/0.0.0.0:3873]
                        21:40:05,220 INFO [AspectDeployer] Deployed AOP: file:/home/adamw/jboss/jboss-test/server/default/deploy/shotoku-aop.aop
                        21:40:05,329 INFO [AspectDeployer] Deployed AOP: file:/home/adamw/jboss/jboss-test/server/default/deploy/ejb3-interceptors-aop.xml
                        21:40:08,283 INFO [WebService] Using RMI server codebase: http://altair:8083/
                        

                        (The 2nd line is significant).

                        How does it look like on your installation?

                        Adam.

                        • 9. Re: Inital Test Problem

                          Upps my fault,

                          when I did update the ejb3 rc3 recently I forgot to enable the weaving once again. Fixed that and everything is now running smoothly.
                          Thanks a lot for the great help.
                          Will provide some stuff in the wiki.

                          Cheers Felix