1 Reply Latest reply on Jul 4, 2005 9:28 PM by Ovidiu Feodorov

    How to do a scoped deployment that contains aspects?

    Ovidiu Feodorov Master

      Is there any documentation on how to do a scoped .SAR deployment that contains aspects?

      I am trying to do a scoped .sar deployment that contains in root a jms-aop.xml file and a modified version of jboss-remoting.jar. I deploy the SAR into a JBoss 4.0.2 instance that already contains the standard default/deploy/jboss-aop.deployer AOP deployer and AspectManager instances.

      The aspects seem to load correctly, but when I am trying make a remote invocation on the scoped Connector, I get this:

      19:04:52,546 DEBUG [ServerThread] failed to process invocation.
      java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.remoting.InvokerLocator
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:198)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:475)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:377)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:219)
       at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:558)
       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
       at org.jboss.aop.metadata.SimpleMetaData.readExternal(SimpleMetaData.java:228)
       at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1686)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1644)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
       at org.jboss.aop.joinpoint.MethodInvocation.readExternal(MethodInvocation.java:232)
       at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1686)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1644)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
       at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:73)
       at org.jboss.invocation.unified.marshall.InvocationUnMarshaller.read(InvocationUnMarshaller.java:32)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:231)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:277)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:168)
      


      It seems logical, the AOP deployment's UCL cannot load remoting classes, which are scoped.

      So, in order to get this running, I tried to include everything AOP in the same class loading domain, but it doesn't work: AspectManager.instance().getContainer("myname") returns null.

      This is my jboss-service.xml deployment descriptor:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <server>
      
       <loader-repository>jboss.messaging:name=loader-repository</loader-repository>
      
       <mbean code="org.jboss.jms.server.ServerPeer"
       name="jboss.messaging:service=ServerPeer"
       xmbean-dd="xmdesc/ServerPeer-xmbean.xml">
       <depends optional-attribute-name="Connector">jboss.messaging:dependency=remoting,service=Connector,transport=socket</depends>
       </mbean>
      
       <mbean code="org.jboss.aop.deployment.AspectManagerService"
       name="jboss.messaging:dependency=aop,service=AspectManager">
       <attribute name="EnableTransformer">false</attribute>
       <attribute name="SuppressTransformationErrors">true</attribute>
       <attribute name="Optimized">true</attribute>
       <attribute name="Verbose">false</attribute>
       </mbean>
      
       <mbean code="org.jboss.aop.deployment.AspectDeployer"
       name="jboss.messaging:dependency=aop,service=AspectDeployer">
       </mbean>
      
       <mbean code="org.jboss.remoting.transport.Connector"
       xmbean-dd="org/jboss/remoting/transport/Connector.xml"
       name="jboss.messaging:dependency=remoting,service=Connector,transport=socket"
       display-name="Socket transport Connector">
       <attribute name="Configuration">
       <config>
       <invoker transport="socket">
       <attribute name="dataType" isParam="true">invocation</attribute>
       <attribute name="marshaller" isParam="true">org.jboss.invocation.unified.marshall.InvocationMarshaller</attribute>
       <attribute name="unmarshaller" isParam="true">org.jboss.invocation.unified.marshall.InvocationUnMarshaller</attribute>
       <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
       <attribute name="serverBindPort">4447</attribute>
       </invoker>
       <handlers>
       <handler subsystem="placeholder">org.jboss.jms.client.remoting.ServerInvocationHandlerImpl</handler>
       </handlers>
       </config>
       </attribute>
       <depends>jboss.messaging:dependency=remoting,service=NetworkRegistry</depends>
       <depends>jboss.messaging:dependency=aop,service=AspectDeployer</depends>
       </mbean>
      
       <mbean code="org.jboss.remoting.network.NetworkRegistry"
       name="jboss.messaging:dependency=remoting,service=NetworkRegistry"/>
      
      </server>
      



      The sar archive contains jms-aop.xml, jboss-remoting.jar and jboss-aop.jar.



        • 1. Re: How to do a scoped deployment that contains aspects?
          Ovidiu Feodorov Master

          The scoped AspectDeployer and AspectManager deploy correctly, as I previously said.

          The problem comes from the fact that there is no way (or I don't now of any) to defer the deployment of an embedded -aop.xml file until all services from that deployment unit are started. Because of that, my jms-aop.xml will be deployed by the jboss-aop.deployer "jboss.aop:service=AspectDeployer" and my aspects will go to "jboss.aop:service=AspectManager", because my own AspectDeployer will be only registered with the MainDeployer AFTER jms-aop.xml finds its deployer.

          My solution was to create a helper service (AspectLoader) and use it to explicitely deploy aspects with my AspectDeployer. jms-aop.xml also gets deployed by "jboss.aop:service=AspectDeployer", but that's secondary, since I won't look up my aspects there.

          I would have attached a working example, if forums permitted that.

          IF you know a more elegant solution, please let me know.