6 Replies Latest reply on Dec 4, 2007 12:47 PM by Pete Muir

    A valid empty jboss.xml

    Ales Justin Master

      What should an empty jboss.xml look like, in order not to fail in the following way:

      This is my empty jboss.xml:

      <?xml version="1.0"?>
      <jboss
       xmlns="http://www.jboss.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
       http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
       version="3.0">
      </jboss>
      


      And the output:
      C:\Java\jdk1.5.0_11\bin\java -Didea.launcher.port=7532 -Didea.launcher.bin.path=C:\JetBrains\IDEA6.0\bin -Dfile.encoding=UTF-8 -classpath ... com.intellij.rt.execution.application.AppMain Test
      19:34:04,484 ERROR [AbstractController] Error installing to Parse: name=vfsfile:/C:/projects/seam/examples/booking/resources/META-INF/jboss.xml state=Not Installed mode=Manual requiredState=Parse
      org.jboss.deployers.spi.DeploymentException: The xml is not well formed!
       at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:134)
       at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:86)
       at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:223)
       at org.jboss.deployment.JBossEjbParsingDeployer.createMetaData(JBossEjbParsingDeployer.java:104)
       at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:199)
       at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:162)
       at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
       at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.deploy(MainDeployerImpl.java:386)
       at Test.main(Test.java:62)
       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)
      org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
      
      *** DEPLOYMENTS MISSING DEPLOYERS: Name
      
      vfsfile:/C:/projects/seam/examples/booking/resources/META-INF/jboss.xml
      
      *** DEPLOYMENTS IN ERROR: Name -> Error
      
      vfsfile:/C:/projects/seam/examples/booking/resources/META-INF/jboss.xml -> org.jboss.deployers.spi.DeploymentException: The xml is not well formed!
      
      
      *** CONTEXTS IN ERROR: Name -> Error
      
      vfsfile:/C:/projects/seam/examples/booking/resources/META-INF/jboss.xml -> org.jboss.deployers.spi.DeploymentException: The xml is not well formed!
      
      
       at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:696)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:642)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.deploy(MainDeployerImpl.java:399)
       at Test.main(Test.java:62)
       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)
      
      Process finished with exit code 0
      


      My test:
      import java.io.File;
      import java.util.Collections;
      
      import org.jboss.dependency.plugins.AbstractController;
      import org.jboss.deployers.client.spi.Deployment;
      import org.jboss.deployers.plugins.deployers.DeployersImpl;
      import org.jboss.deployers.plugins.main.MainDeployerImpl;
      import org.jboss.deployers.spi.deployer.Deployer;
      import org.jboss.deployers.spi.deployer.Deployers;
      import org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl;
      import org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder;
      import org.jboss.deployers.vfs.plugins.structure.file.FileStructure;
      import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
      import org.jboss.deployers.vfs.spi.structure.StructureDeployer;
      import org.jboss.deployment.JBossEjbParsingDeployer;
      import org.jboss.virtual.VFS;
      import org.jboss.virtual.VirtualFile;
      
      /**
       * @author alesj
       */
      public class Test
      {
       public static void main(String[] args)
       {
       try
       {
       VFSDeploymentFactory factory = VFSDeploymentFactory.getInstance();
       File file = new File("C:\\projects\\seam\\examples\\booking\\resources\\META-INF\\jboss.xml");
       VirtualFile vf = VFS.getRoot(file.toURL());
       Deployment deployment = factory.createVFSDeployment(vf);
       MainDeployerImpl main = new MainDeployerImpl();
       StructureDeployer fileDeployer = new FileStructure();
       VFSStructuralDeployersImpl structuralDeployers = new VFSStructuralDeployersImpl(Collections.singleton(fileDeployer));
       structuralDeployers.setStructureBuilder(new VFSStructureBuilder());
       main.setStructuralDeployers(structuralDeployers);
       JBossEjbParsingDeployer jbossParser = new JBossEjbParsingDeployer();
       jbossParser.setUseSchemaValidation(false);
       jbossParser.setUseValidation(false);
       Deployer deployer = jbossParser;
       Deployers deployers = new DeployersImpl(new AbstractController(), Collections.singleton(deployer));
       main.setDeployers(deployers);
       main.deploy(deployment);
       }
       catch (Exception e)
       {
       e.printStackTrace();
       }
       }
      }
      


      Otherwise I get a NPE, since there is no JBossMetaData instance in the attachments for Ejb3Deployer.

       [testng] Caused by: java.lang.NullPointerException
       [testng] at org.jboss.ejb3.interceptor.InterceptorInfoRepository.initialise(InterceptorInfoRepository.java:101)
       [testng] at org.jboss.ejb3.Ejb3HandlerFactory$DDFactory.<init>(Ejb3HandlerFactory.java:48)
       [testng] at org.jboss.ejb3.Ejb3HandlerFactory.getInstance(Ejb3HandlerFactory.java:83)
       [testng] at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:431)
       [testng] at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:375)
       [testng] at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:145)


        • 1. Re: A valid empty jboss.xml
          Scott Stark Master

          I don't understand the well formed error. It would seem some error is being swallowed or the schema is trying to be parsed from somewhere invalid rather than mapping to the jaxb model. An empy jboss.xml should parse fine. I added a test to the metadata project which runs as expected with the jboss.xml you show.

          • 2. Re: A valid empty jboss.xml
            Alexey Loubyansky Master

            Something's wrong in the SchemaBinding resolver/initialization. Maybe it's not up to date?

            The parsing and unmarshaling complete without errors but the result is null. Because the default element handlers are used, not the ones from the jbossxb-builder (annotation-based binding).

            If you look at the log you sent me you'll see messages like:

            [testng] TRACE [binding.sunday.unmarshalling.impl.runtime.RtElementHandler] Failed to resolve class for element {http://java.sun.com/xml/ns/javaee}interceptor-binding: com.sun.java.xml.ns.javaee.InterceptorBindingType


            The default behavior is to ignore unresolved classes. SchemaBinding.isIgnoreUnresolvedFieldOrClass() is true by default. If it was false you would get an exception.

            Anyway, I think we need to look into your SchemaResolver initialization.

            • 3. Re: A valid empty jboss.xml
              Alexey Loubyansky Master

              This is where the exception is thrown

              package org.jboss.deployers.vfs.spi.deployer;
              
              public abstract class SchemaResolverDeployer<T> extends AbstractVFSParsingDeployer<T>
              
               protected T parse(VFSDeploymentUnit unit, VirtualFile file, T root) throws Exception
               {
               if (file == null)
               throw new IllegalArgumentException("Null file");
              
               log.debug("Parsing file: "+file+" for deploymentType: " + getOutput());
               Unmarshaller unmarshaller = factory.newUnmarshaller();
               unmarshaller.setSchemaValidation(isUseSchemaValidation());
               unmarshaller.setValidation(isUseValidation());
               InputStream is = file.openStream();
               Object parsed = null;
               try
               {
               parsed = unmarshaller.unmarshal(is, resolver);
               log.debug("Parsed file: "+file+" to: "+parsed);
               }
               finally
               {
               try
               {
               is.close();
               }
               catch (Exception ignored)
               {
               }
               }
               if (parsed == null)
               throw new DeploymentException("The xml " + file.getPathName() + " is not well formed!");


              • 4. Re: A valid empty jboss.xml
                Pete Muir Master

                 

                "alex.loubyansky@jboss.com" wrote:
                Something's wrong in the SchemaBinding resolver/initialization. Maybe it's not up to date?

                The default behavior is to ignore unresolved classes. SchemaBinding.isIgnoreUnresolvedFieldOrClass() is true by default. If it was false you would get an exception.

                Anyway, I think we need to look into your SchemaResolver initialization.


                The deployer does

                private static final SchemaBindingResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();


                I'm not sure where else to look. You can find all the xml we are using here

                http://fisheye.jboss.com/browse/JBoss/jboss-seam/bootstrap-new

                And the jars in use

                http://fisheye.jboss.com/browse/JBossAS/trunk/embedded/build.xml?r=67802#l343

                • 5. Re: A valid empty jboss.xml
                  Adrian Brock Master

                   

                  "pete.muir@jboss.org" wrote:

                  I'm not sure where else to look. You can find all the xml we are using here

                  http://fisheye.jboss.com/browse/JBoss/jboss-seam/bootstrap-new


                  You're missing the
                  deployers/metadata-beans.xml
                  that populates which dtd/schema maps to which metadata model/version.

                  Your problem is that JBossXB knows how to resolve the schema and
                  create the SchemaBinding.

                  But the SchemaBinding has no object model bindings. JBossXB has scanned
                  the schema for JAXB schema annotations and not found any and there is no
                  initializer to populate the bindings either.

                  It parsed the xml file but there were no callbacks registered to actually do anything. ;-)

                  • 6. Re: A valid empty jboss.xml
                    Pete Muir Master

                    Thanks Adrian, much appreciated :)