8 Replies Latest reply on Aug 21, 2008 3:55 PM by mstruk

    vfsmemory url problem

    starksm64

      One of the appclient jbossas test regressions is due to the following error resulting from a vfs url of the form:
      vfsmemory://5c4o0b-m9hkak-fk2sx83e-1-fk2t2t85-1z/classes/

      2265 [main] WARN org.jboss.kernel.plugins.dependency.AbstractKernelController - Broken callback: ClassSingleCallbackItem@563a3d{name=class org.jboss.classloading.spi.dependency.Module whenRequired=ControllerState@7e33de{Configured} dependentState=ControllerState@7f4790{Installed} attributeName=addModule owner=AbstractKernelControllerContext@6f84d8{ metadata=AbstractBeanMetaData@5e8a8f{name=ClassLoading bean=org.jboss.classloading.spi.dependency.ClassLoading properties= constructor=null autowireCandidate=true installCallbacks=[method=addModule] uninstallCallbacks=[method=removeModule]}name=ClassLoading target=org.jboss.classloading.spi.dependency.ClassLoading@f6e3e9 state=Installed depends=AbstractDependencyInfo@335332{idependOn=[]}} signature=org.jboss.classloading.spi.dependency.Module}
      java.lang.IllegalArgumentException: Root can not contain '/'
       at org.jboss.virtual.plugins.context.memory.MemoryContextFactory.createRoot(MemoryContextFactory.java:108)
       at org.jboss.virtual.plugins.context.memory.MemoryContextFactory.getVFS(MemoryContextFactory.java:76)
       at org.jboss.virtual.VFS.getVFS(VFS.java:89)
       at org.jboss.virtual.VFS.getRoot(VFS.java:103)
       at org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule.determineVFSRoots(VFSClassLoaderPolicyModule.java:170)
       at org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule.determineCapabilities(VFSClassLoaderPolicyModule.java:98)
       at org.jboss.classloading.spi.dependency.Module.getCapabilities(Module.java:485)
       at org.jboss.classloading.spi.dependency.Module.determinePackageNames(Module.java:544)
       at org.jboss.classloading.spi.dependency.ClassLoadingSpace.join(ClassLoadingSpace.java:213)
       at org.jboss.classloading.spi.dependency.Domain.addModule(Domain.java:151)
       at org.jboss.classloading.spi.dependency.ClassLoading.addModule(ClassLoading.java:58)
       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 org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
       at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
       at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
       at org.jboss.beans.info.plugins.AbstractBeanInfo.invoke(AbstractBeanInfo.java:300)
       at org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext.invoke(AbstractKernelControllerContext.java:279)
       at org.jboss.dependency.plugins.SingleCallbackItem.changeCallback(SingleCallbackItem.java:67)
       at org.jboss.dependency.plugins.AbstractCallbackItem.changeCallback(AbstractCallbackItem.java:79)
       at org.jboss.dependency.plugins.OwnerCallbackItem.changeCallback(OwnerCallbackItem.java:88)
       at org.jboss.dependency.plugins.AbstractController.resolveCallbacks(AbstractController.java:1398)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:908)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1026)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:948)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:738)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:506)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:331)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:309)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)
       at org.jboss.kernel.plugins.deployment.BasicKernelDeployer.deploy(BasicKernelDeployer.java:76)
       at org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.deploy(BasicXMLDeployer.java:88)
       at org.jboss.ejb3.client.ClientLauncher.deploy(ClientLauncher.java:349)
       at org.jboss.ejb3.client.ClientLauncher.launch(ClientLauncher.java:241)
       at org.jboss.ejb3.client.ClientLauncher.launch(ClientLauncher.java:158)
       at org.jboss.ejb3.client.ClientLauncher.launch(ClientLauncher.java:147)
       at org.jboss.test.ee5client.unit.SimpleResourceUnitTestCase.testClientLauncher(SimpleResourceUnitTestCase.java:100)
      


      The appclient is not creating this url, so I'm not sure where its coming from or why this is an invalid vfsmemory url.


        • 1. Re: vfsmemory url problem
          alesj

          And even if you got past this,
          it's still wrong, since /classes/ part is then never used.
          MemoryContextFactory.java:

           public VFSContext createRoot(URL url)
           {
           try
           {
           String rootName = url.getHost();
           MemoryContext ctx = registry.get(rootName);
           if (ctx == null)
           {
           String urlPath = url.getPath();
           if (urlPath != null && urlPath.length() > 0)
           throw new IllegalArgumentException("Root can not contain '/' - " + urlPath);
          
           URL ctxURL = new URL("vfsmemory://" + rootName);
           ctx = new MemoryContext(ctxURL);
           registry.put(rootName, ctx);
           }
           return ctx;
          

          I'll see what can be done.

          • 2. Re: vfsmemory url problem
            alesj

            I think the real problem is in InMemoryClassesDeployer.
            It's the way we create classes VirtualFile.

             public void deploy(VFSDeploymentUnit unit) throws DeploymentException
             {
             try
             {
             URL dynamicClassRoot = new URL("vfsmemory", new GUID().toString(), "");
             MemoryFileFactory.createRoot(dynamicClassRoot);
             URL classesURL = new URL(dynamicClassRoot, "classes");
             VirtualFile classes = MemoryFileFactory.createDirectory(classesURL);
             unit.addAttachment(DYNAMIC_CLASS_URL_KEY, dynamicClassRoot);
             unit.addAttachment(DYNAMIC_CLASS_KEY, classes);
             unit.prependClassPath(classes);
             log.debug("Dynamic class root for " + unit.getName() + " is " + dynamicClassRoot);
            

            It should be a root.

            Otherwise I don't see how we can handle VFS::getRoot call on
            a vfs's in-memory url that's not a root - as in our case.

            We could create new vfs in-memory context for a given non-root url,
            but that would mean memory leakage, since we would have no handle
            to delete that context from memory.

            • 3. Re: vfsmemory url problem
              alesj

               

              "alesj" wrote:
              And even if you got past this,
              it's still wrong, since /classes/ part is then never used.
              MemoryContextFactory.java:
               public VFSContext createRoot(URL url)
               {
               try
               {
               String rootName = url.getHost();
               MemoryContext ctx = registry.get(rootName);
               if (ctx == null)
               {
               String urlPath = url.getPath();
               if (urlPath != null && urlPath.length() > 0)
               throw new IllegalArgumentException("Root can not contain '/' - " + urlPath);
              
               URL ctxURL = new URL("vfsmemory://" + rootName);
               ctx = new MemoryContext(ctxURL);
               registry.put(rootName, ctx);
               }
               return ctx;
              


              I reverted this url path check move.
               public VFSContext createRoot(URL url)
               {
               try
               {
               String urlPath = url.getPath();
               if (urlPath != null && urlPath.length() > 0)
               throw new IllegalArgumentException("Root url cannot contain path - " + urlPath);
              

              It's illegal to pass in url with path,
              when you need root.
              Since with the previous code,
              you wouldn't get what you expected - /classes/ get ignored,
              hence pointing to the wrong VirtualFile,
              if this url was used as VFS.getRoot().

              But now I get vfslink test failures - due to wrong assumption.
              So, Marko, these tests need fixing.

              • 4. Re: vfsmemory url problem
                alesj

                 

                "alesj" wrote:
                I think the real problem is in InMemoryClassesDeployer.
                It's the way we create classes VirtualFile.
                 public void deploy(VFSDeploymentUnit unit) throws DeploymentException
                 {
                 try
                 {
                 URL dynamicClassRoot = new URL("vfsmemory", new GUID().toString(), "");
                 MemoryFileFactory.createRoot(dynamicClassRoot);
                 URL classesURL = new URL(dynamicClassRoot, "classes");
                 VirtualFile classes = MemoryFileFactory.createDirectory(classesURL);
                 unit.addAttachment(DYNAMIC_CLASS_URL_KEY, dynamicClassRoot);
                 unit.addAttachment(DYNAMIC_CLASS_KEY, classes);
                 unit.prependClassPath(classes);
                 log.debug("Dynamic class root for " + unit.getName() + " is " + dynamicClassRoot);
                

                It should be a root.

                This would do the trick
                 public void deploy(VFSDeploymentUnit unit) throws DeploymentException
                 {
                 try
                 {
                 URL dynamicClassRoot = new URL("vfsmemory", new GUID() + "/classes", "");
                 VirtualFile classes = MemoryFileFactory.createRoot(dynamicClassRoot).getRoot();
                 unit.addAttachment(DYNAMIC_CLASS_URL_KEY, dynamicClassRoot);
                 unit.addAttachment(DYNAMIC_CLASS_KEY, classes);
                 unit.prependClassPath(classes);
                 log.debug("Dynamic class root for " + unit.getName() + " is " + dynamicClassRoot);
                

                Dunno why would we want to have classes as a child to guid root?

                The only thing that I see useful is that we might group different
                in-memory deployment's contents under the same guid 'group' root.
                e.g. currently we have 'classes', we might have some other grouping notion

                • 5. Re: vfsmemory url problem
                  starksm64

                  I created JBDEPLOY-75 to track this as its the last appclient related failure in the jbossas testsuite.

                  • 6. Re: vfsmemory url problem
                    alesj

                     

                    "scott.stark@jboss.org" wrote:
                    One of the appclient jbossas test regressions is due to the following error resulting from a vfs url of the form:
                    vfsmemory://5c4o0b-m9hkak-fk2sx83e-1-fk2t2t85-1z/classes/

                    2265 [main] WARN org.jboss.kernel.plugins.dependency.AbstractKernelController - Broken callback: ClassSingleCallbackItem@563a3d{name=class org.jboss.classloading.spi.dependency.Module whenRequired=ControllerState@7e33de{Configured} dependentState=ControllerState@7f4790{Installed} attributeName=addModule owner=AbstractKernelControllerContext@6f84d8{ metadata=AbstractBeanMetaData@5e8a8f{name=ClassLoading bean=org.jboss.classloading.spi.dependency.ClassLoading properties= constructor=null autowireCandidate=true installCallbacks=[method=addModule] uninstallCallbacks=[method=removeModule]}name=ClassLoading target=org.jboss.classloading.spi.dependency.ClassLoading@f6e3e9 state=Installed depends=AbstractDependencyInfo@335332{idependOn=[]}} signature=org.jboss.classloading.spi.dependency.Module}
                    java.lang.IllegalArgumentException: Root can not contain '/'
                     at org.jboss.virtual.plugins.context.memory.MemoryContextFactory.createRoot(MemoryContextFactory.java:108)
                     at org.jboss.virtual.plugins.context.memory.MemoryContextFactory.getVFS(MemoryContextFactory.java:76)
                     at org.jboss.virtual.VFS.getVFS(VFS.java:89)
                     at org.jboss.virtual.VFS.getRoot(VFS.java:103)
                     at org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule.determineVFSRoots(VFSClassLoaderPolicyModule.java:170)
                     at org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule.determineCapabilities(VFSClassLoaderPolicyModule.java:98)
                     at org.jboss.classloading.spi.dependency.Module.getCapabilities(Module.java:485)
                     at org.jboss.classloading.spi.dependency.Module.determinePackageNames(Module.java:544)
                     at org.jboss.classloading.spi.dependency.ClassLoadingSpace.join(ClassLoadingSpace.java:213)
                     at org.jboss.classloading.spi.dependency.Domain.addModule(Domain.java:151)
                     at org.jboss.classloading.spi.dependency.ClassLoading.addModule(ClassLoading.java:58)
                     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 org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
                     at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
                     at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
                     at org.jboss.beans.info.plugins.AbstractBeanInfo.invoke(AbstractBeanInfo.java:300)
                     at org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext.invoke(AbstractKernelControllerContext.java:279)
                     at org.jboss.dependency.plugins.SingleCallbackItem.changeCallback(SingleCallbackItem.java:67)
                     at org.jboss.dependency.plugins.AbstractCallbackItem.changeCallback(AbstractCallbackItem.java:79)
                     at org.jboss.dependency.plugins.OwnerCallbackItem.changeCallback(OwnerCallbackItem.java:88)
                     at org.jboss.dependency.plugins.AbstractController.resolveCallbacks(AbstractController.java:1398)
                     at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:908)
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1026)
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:948)
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:738)
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:506)
                     at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:331)
                     at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:309)
                     at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)
                     at org.jboss.kernel.plugins.deployment.BasicKernelDeployer.deploy(BasicKernelDeployer.java:76)
                     at org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.deploy(BasicXMLDeployer.java:88)
                     at org.jboss.ejb3.client.ClientLauncher.deploy(ClientLauncher.java:349)
                     at org.jboss.ejb3.client.ClientLauncher.launch(ClientLauncher.java:241)
                     at org.jboss.ejb3.client.ClientLauncher.launch(ClientLauncher.java:158)
                     at org.jboss.ejb3.client.ClientLauncher.launch(ClientLauncher.java:147)
                     at org.jboss.test.ee5client.unit.SimpleResourceUnitTestCase.testClientLauncher(SimpleResourceUnitTestCase.java:100)
                    


                    The appclient is not creating this url, so I'm not sure where its coming from or why this is an invalid vfsmemory url.

                    Fixed. ;-)
                    one-test:
                     [delete] Deleting: C:\DOCUME~1\Ales\LOCALS~1\Temp\test.log
                     [junit] Running org.jboss.test.ee5client.unit.SimpleResourceUnitTestCase
                     [junit] 15:51:35,812 WARN [ClientLauncher] FIXME: using an unsupported hack to get metadata
                     [junit] 15:51:38,359 WARN [ClientLauncher] sun.misc.Launcher$AppClassLoader@12498b5 != BaseClassLoader@fd1810{ClientLauncherClassPath:0.0.0$MODULE}
                     [junit] 15:51:38,359 WARN [ClientLauncher] sun.misc.Launcher$AppClassLoader@12498b5 != BaseClassLoader@fd1810{ClientLauncherClassPath:0.0.0$MODULE}
                     [junit] msg = Hello world
                     [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 3,922 sec
                    
                    BUILD SUCCESSFUL
                    


                    Last deployers commit marked with JBDEPLOY-75
                    resolved the issue - I removed the 'classes' path,
                    leaving only guid host name.

                    • 7. Re: vfsmemory url problem
                      alesj

                       

                      "alesj" wrote:

                      Last deployers commit marked with JBDEPLOY-75
                      resolved the issue - I removed the 'classes' path,
                      leaving only guid host name.

                      You need trunk VFS and Deployers-VFS.
                      And this patch:
                      Index: src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java
                      ===================================================================
                      --- src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java (revision 77280)
                      +++ src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java (working copy)
                      @@ -21,7 +21,6 @@
                       */
                       package org.jboss.aop.asintegration.jboss5;
                      
                      -import java.net.MalformedURLException;
                       import java.net.URL;
                       import java.util.Map;
                      
                      @@ -29,7 +28,6 @@
                       import javassist.scopedpool.ScopedClassPool;
                       import javassist.scopedpool.ScopedClassPoolFactory;
                       import javassist.scopedpool.ScopedClassPoolRepository;
                      -
                       import org.jboss.aop.classpool.AOPClassPool;
                       import org.jboss.aop.classpool.AbstractJBossClassPoolFactory;
                       import org.jboss.aop.classpool.ExtraClassPoolFactoryParameters;
                      @@ -75,16 +73,6 @@
                       if (module == null)
                       return null;
                      
                      - try
                      - {
                      - URL tempUrl = module.getDynamicClassRoot();
                      - if (tempUrl == null)
                      - return null;
                      - return new URL(tempUrl, "/classes");
                      - }
                      - catch (MalformedURLException e)
                      - {
                      - throw new RuntimeException(e);
                      - }
                      + return module.getDynamicClassRoot();
                       }
                       }
                      


                      • 8. Re: vfsmemory url problem
                        mstruk

                        I fixed my buggy test :)

                        Didn't cross my mind before to put the file directly on context root - not as a child, but as root itself.

                        URL dynamicClassRoot = new URL("vfsmemory", ".vfslink-test", "");
                        MemoryFileFactory.createRoot(dynamicClassRoot);
                        
                        byte [] fileBytes = prepareFileContent();
                        MemoryFileFactory.putFile(dynamicClassRoot, fileBytes);
                        


                        Cheers,

                        - marko