9 Replies Latest reply on Apr 6, 2010 2:00 AM by jaikiran pai Branched to a new discussion.

    Can't deploy War in JBoss 6.0.0 M2

    jm collin Newbie

      Hello,

       

      I've got a war which was well fonctionning in JBoss 4.2.2-GA. This war can't deploy in JBoss 6.0.0 M2 with the following error :

      11:38:54,177 ERROR [AbstractKernelController] Error installing to Parse: name=vfszip:/D:/Developpement/jboss-6.0.0.20100216-M2/server/default/deploy/testjsf.war/ state=PreParse mode=Manual requiredState=Parse: org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfszip:/D:/Developpement/jboss-6.0.0.20100216-M2/server/default/deploy/testjsf.war/
          at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
          at org.jboss.deployment.WebAppFragmentParsingDeployer.createMetaData(WebAppFragmentParsingDeployer.java:94)
          at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:322)
          at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:294)
          at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:234)
          at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1660)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1378)

      ...

      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Failed to resolve schema nsURI= location=web-fragment
          at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:283)
          at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:401)
          at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
          at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:688)
          at com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.startElement(XIncludeHandler.java:908)
          at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
          at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
          at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
          at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
          at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
          at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
          at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
          at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
          at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
          at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
          at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
          at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
          at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:199)

       

      So it seems there is something wrong in my web.xml. I try to change the xsd version 2.4 -> 2.5 but I still have this error.

       

      Here is my web.xml :

      <?xml version="1.0" encoding="UTF-8"?>

       

      <web-app xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
               version="2.5">
         <context-param>
              <param-name>optimus.CONTEXT_SCAN_PATH</param-name>
              <param-value>test</param-value>
          </context-param>
         
          <context-param>
              <param-name>com.sun.faces.allowTextChildren</param-name>
              <param-value>true</param-value>
          </context-param>

       

          <filter>
              <filter-name>PrimeFaces FileUpload Filter</filter-name>
              <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
          </filter>
          <filter-mapping>
              <filter-name>PrimeFaces FileUpload Filter</filter-name>
              <servlet-name>Faces Servlet</servlet-name>
          </filter-mapping>
          <!-- Extensions Filter -->

       


          <!-- Optimus Listener -->
          <listener>
              <listener-class>org.primefaces.optimus.listener.ContextListener</listener-class>
          </listener>

       

          <!--  -->
          <servlet>
              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>

       

          <!-- The PrimeFaces resources servlet -->
          <servlet>
              <servlet-name>Resource Servlet</servlet-name>
              <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>

       

          <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.jsf</url-pattern>
          </servlet-mapping>
          <!-- The PrimeFaces resources servlet -->
          <servlet-mapping>
              <servlet-name>Resource Servlet</servlet-name>
              <url-pattern>/primefaces_resource/*</url-pattern>
          </servlet-mapping>

       

          <session-config>
              <session-timeout>20</session-timeout>
          </session-config>
         

       

          <!-- Welcome files -->
          <welcome-file-list>
             
              <welcome-file>index.jsp</welcome-file>
          </welcome-file-list>

       

          <error-page>
              <error-code>408</error-code>
              <location>/index.jsp</location>
          </error-page>
          <error-page>
              <error-code>403</error-code>
              <location>/403.jsp</location>
          </error-page>
         
          <!-- taglib merge-point -->
          <!-- resource-ref merge-point -->
          <security-constraint>
              <web-resource-collection>
                  <web-resource-name>Raw-JSF-Pages</web-resource-name>
                  <description>
                      Prevent access to raw pages that are for JSF pages.
                      (No roles, so no direct access)
                  </description>
                  <url-pattern>*.xhtml</url-pattern>
              </web-resource-collection>
              <auth-constraint>
              </auth-constraint>
              <user-data-constraint>
                  <transport-guarantee>NONE</transport-guarantee>
              </user-data-constraint>
          </security-constraint>
      </web-app>

       

      Any idea would be appreciated.

        • 1. Re: Can't deploy War in JBoss 6.0.0 M2
          jaikiran pai Master

          Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Failed to resolve schema nsURI= location=web-fragment

              at

          Look for the file containing web-fragment element. Looks like it's missing a xsd declaration.

          • 2. Re: Can't deploy War in JBoss 6.0.0 M2
            jm collin Newbie

            But what is a web-fragment ?

            I've got only 2 xml files (web.xml and faces-config.xml) wich all have xsd and a .xhtml file like this one :

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml"
                  xmlns:ui="http://java.sun.com/jsf/facelets"
                  xmlns:h="http://java.sun.com/jsf/html"
                  xmlns:f="http://java.sun.com/jsf/core"
                  xmlns:c="http://java.sun.com/jstl/core"
                  xmlns:a="http://www.andromda.org/cartridges/jsf"
                  xmlns:p="http://primefaces.prime.com.tr/ui">
               
            <f:view contentType="text/html">
            <h:head>
                <title>Formulaire 1</title>
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
            </h:head>
               
            <h:body>
                <p:growl id="messages" showDetail="true" />
                <p:ajaxStatus onstart="statusDialog.show();" oncomplete="statusDialog.hide();" />                            
                <p:dialog modal="true" widgetVar="statusDialog" header="Demande en cours..." draggable="false" close="false" fixedCenter="true">  
                   <h:graphicImage value="/design/ajaxloading.gif" /> 
                </p:dialog>
                <h:form id="page1Formulaire1Form" prependId="false">
                <p:panel id="page1Formulaire1Panel" header="Formulaire1" toggleable="true" toggleSpeed="200">
                     <h:panelGrid columns="4">
                        <h:outputLabel value="#{labels['param1']} * :" for="param1"/>
                        <h:inputText id="param1" value="#{controllerTest.param1}" label="#{labels['param1']}" required="true" readonly="false">
                            <p:watermark value="Here is watermark"/>
                        </h:inputText>
                        <h:inputHidden/>
                         <p:message for="param1"/>
                     </h:panelGrid>
                    <p:commandButton id="page1Formulaire1Action" value="Go !!" action="#{controllerTest.operation1}"
                        onclick="PrimeFaces.cleanWatermarks();" oncomplete="PrimeFaces.showWatermarks();" ajax="false" update="messages"/>
                </p:panel>
                </h:form>
               
                <h:form>
                    <p:wizard id="wizard" widgetVar="wizard" height="250" width="600" speed="175" effect="toggle">
                        <p:tab>
               
                            <p:panel header="Personal Details">
                           
                                <h:messages errorClass="error"/>
                               
                                <h:panelGrid columns="2" columnClasses="label, value" styleClass="grid">
                                    <h:outputText value="Param1 : *" />
                                    <h:inputText value="#{controllerTest.param1}" required="true" label="Firstname"/>                       
                                </h:panelGrid>
                            </p:panel>
                        </p:tab>
                           
                        <p:tab>
                            <p:panel header="Adress Details">
                           
                                <h:messages errorClass="error"/>
                               
                                <h:panelGrid columns="2" columnClasses="label, value">
                                    <h:outputText value="PrenomNom : " />
                                    <h:inputText value="#{controllerTest.prenomNom}" />
                                </h:panelGrid>
                            </p:panel>
                        </p:tab>
                           
                        <p:tab>
                            <p:panel header="Confirmation">
                                <h:panelGrid id="confirmation" columns="2">
                                    <h:outputText value="Param1 : " />
                                    <h:outputText value="#{controllerTest.param1}" styleClass="outputLabel"/>
                                   
                                    <h:outputText value="PrenomNom : " />
                                    <h:outputText value="#{controllerTest.prenomNom}" styleClass="outputLabel"/>                       
                                </h:panelGrid>
                               
                                <p:commandButton value="Submit" actionListener="#{controllerTest.operation3}" update="messages" />
                            </p:panel>
                        </p:tab>
                       
                    </p:wizard>       
                </h:form>
               
            </h:body>
            </f:view>
            </html>

             

            2 days on this very, very simple example with an enigmatic error message make me think JBoss 6 is not ready...

            • 3. Re: Can't deploy War in JBoss 6.0.0 M2
              jm collin Newbie

              OK. I've found what goes wrong. A included third-party jar have a web-fragment.xml file without schema. Modifying it by hand resolve the problem.

               

              It shoud be good idea to indicate where is the error (the full path of the wrong file for example).

               

              Thank's for your help.

              • 4. Re: Can't deploy War in JBoss 6.0.0 M2
                jaikiran pai Master

                jmcollin92 wrote:

                 

                It shoud be good idea to indicate where is the error (the full path of the wrong file for example).

                 

                Yes, i agree. I'll file a JIRA for this (i thought i already filed one for this, but JIRA report says otherwise).

                • 5. Re: Can't deploy War in JBoss 6.0.0 M2
                  Matthias Paul Scholz Novice

                  How did your modified web-fragemt file look like in the end?

                   

                  I am facing the same problem when using the primefaces 2.0.0 jar in my web app and deploying it to JBoss 6 M2.

                  Yet, I don't think modifying the web-fragment.xml of the third party library manually is a sustainable solution in the end, in particular not when using Maven for build and deployment (the changes will be overridden by the repository version of the library).

                   

                  Actually, I'm not sure whether JBoss 6 is correct here in expecting a schema definiton entry in a web-fragment.xml file: as far as I know, the servlet 3.0 spec does not require a web fragment file to provide one.

                  • 6. Re: Can't deploy War in JBoss 6.0.0 M2
                    jm collin Newbie

                    Hello,

                     

                    The exact problem is described here : http://primefaces.prime.com.tr/forum/viewtopic.php?f=3&t=1670

                    I see 2 solutions :

                    1. Use the 2.0.1-SNAPSHOT version which is working well. Coming from 2.0.0 you should have some modifications in your code. See the Primefaces site to see what.

                    2. Modify by hand the 3 files describe in the post above t omake it compliant. But there is a lot of modifications to do and this can't automatised.

                     

                    I suggest you to use the first solution ...

                     

                    I hope this helps.

                    • 7. Re: Can't deploy War in JBoss 6.0.0 M2
                      Matthias Paul Scholz Novice

                      nullnull,

                       

                      Thanks!

                      Using the latest snapshot of primfaces 2 helped indeed: deployment of my PrimeFaces 2 application into JBoss 6 M2 works fine now (I get other errors later on when working with the app that do not happen with Glassfish 3, but that's another story).

                       

                      Undoubtedly it's a good practive to validate a web-fragment against a schema definition; yet, I am still curious whether JBoss is correct in actually enforcing it.

                      • 8. Re: Can't deploy War in JBoss 6.0.0 M2
                        Dave Chen Master

                        we am facting the same issue on 6.0 M2.

                         

                        DEPLOYMENTS IN ERROR:
                          Deployment "vfszip:/C:/jboss-6.0.0.20100216-M2/server/default/deploy/myapp.ear/" is in error due to the following reason(s): org.jboss.xb.binding.JBossXBRuntimeException: -1:-1 -1:-1 schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

                         

                        We use Richfaces and Tomahawk, both of them defined schema:

                         

                        <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
                                      version="1.2">

                         

                        they do not have web-fragment.xml. Our web.xml and faces-config.xml define schema.

                         

                        We could not figure out what else to look for. Could the message be nicer pointing out which file. Thanks development team.

                         

                        Our application is working well on JBOSS 5.1.0  .  Thanks for any help.Dave

                        • 9. Re: Can't deploy War in JBoss 6.0.0 M2
                          jaikiran pai Master

                          Dave Chen wrote:

                           

                          Could the message be nicer pointing out which file.

                          https://jira.jboss.org/jira/browse/JBXB-246