1 Reply Latest reply: Jan 25, 2008 3:49 PM by David Bernstein RSS

    NullPointerException in VFSUtils.readManifest during WAR de

    David Bernstein Newbie

      I have a very simple WAR file that I'm trying to deploy on JBoss 5.0.0.Beta3.

      I'm using:
      * Java VM: Java HotSpot(TM) Server VM 1.6.0_03-b05,Sun Microsystems Inc.
      * OS-System: Windows XP 5.1,x86
      I am using the -Dsun.lang.ClassLoader.allowArraySyntax=true option for the JVM for Java 6 with JBoss 5 as described in JBAS-4491.

      Intermittently, when I deploy the WAR file, I get a NullPointerException in org.jboss.virtual.VFSUtils.readManifest():

      2008-01-24 18:48:53,624 DEBUG [org.jboss.deployers.plugins.main.MainDeployerImpl] Add deployment: vfsfile:/C:/java/jboss/jboss-5.0.0.Beta3/server/orgmob/deploy/orgmobilist.war
      2008-01-24 18:48:53,624 DEBUG [org.jboss.deployers.plugins.main.MainDeployerImpl] Removing previous deployment: vfsfile:/C:/java/jboss/jboss-5.0.0.Beta3/server/orgmob/deploy/orgmobilist.war
      2008-01-24 18:48:53,624 DEBUG [org.jboss.deployers.plugins.main.MainDeployerImpl] Scheduling undeployment: vfsfile:/C:/java/jboss/jboss-5.0.0.Beta3/server/orgmob/deploy/orgmobilist.war parent=null
      2008-01-24 18:48:53,624 WARN [org.jboss.system.server.profileservice.hotdeploy.HDScanner] Scan failed
      org.jboss.deployers.spi.DeploymentException: Error populating deployment vfsfile:/C:/java/jboss/jboss-5.0.0.Beta3/server/orgmob/deploy/orgmobilist.war
       at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
       at org.jboss.deployers.structure.spi.helpers.AbstractStructureBuilder.populateContext(AbstractStructureBuilder.java:77)
       at org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers.determineStructure(AbstractStructuralDeployers.java:89)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.determineStructure(MainDeployerImpl.java:743)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.addDeployment(MainDeployerImpl.java:280)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.addDeployment(MainDeployerImpl.java:237)
       at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:270)
       at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
       at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NullPointerException
       at org.jboss.virtual.VFSUtils.readManifest(VFSUtils.java:208)
       at org.jboss.virtual.VFSUtils.getManifest(VFSUtils.java:187)
       at org.jboss.virtual.VFSUtils.addManifestLocations(VFSUtils.java:106)
       at org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder.applyContextInfo(VFSStructureBuilder.java:155)
       at org.jboss.deployers.structure.spi.helpers.AbstractStructureBuilder.populateContext(AbstractStructureBuilder.java:73)
       ... 15 more
      


      Sometimes it works without complaint. I haven't been able to figure out exactly which conditions tickle this. I had suspicions that it might have to do with whether it was a hot deploy or on the existence of the properties file, but I wasn't able to prove it consistently. It did seem that if there was previously no properties file and I then did a hot deploy with a properties file, then I got the exception. I was able to deploy successfully to 4.2.2.GA. The structure of the WAR is:

      META-INF/
      META-INF/MANIFEST.MF
      WEB-INF/
      WEB-INF/web.xml
      WEB-INF/classes/
      WEB-INF/classes/com/
      WEB-INF/classes/com/orgmob/
      WEB-INF/classes/com/orgmob/orgmobilist/
      WEB-INF/classes/com/orgmob/orgmobilist/server/
      WEB-INF/classes/com/orgmob/orgmobilist/orgmob.properties
      WEB-INF/classes/com/orgmob/orgmobilist/server/FooServlet.class
      


      The manifest is:
      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.7.0
      Created-By: 1.6.0_03-b05 (Sun Microsystems Inc.)
      
      
      


      The web.xml file is:
      <?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">
      
       <servlet>
       <servlet-name>foo</servlet-name>
       <servlet-class>com.orgmob.orgmobilist.server.FooServlet</servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>foo</servlet-name>
       <url-pattern>/foo</url-pattern>
       </servlet-mapping>
      
      </web-app>
      


      The servlet code is:
      package com.orgmob.orgmobilist.server;
      
      import java.io.IOException;
      import java.io.PrintWriter;
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      
      public class FooServlet extends HttpServlet {
      
       private static final long serialVersionUID = 1L;
      
       private void doGetPost(HttpServletRequest req, HttpServletResponse resp)
       throws ServletException, IOException {
       String userid = req.getParameter("userid");
       resp.setContentType("text/html");
       resp.setCharacterEncoding("UTF-8");
       PrintWriter pw = resp.getWriter();
       pw.println("<html>");
       pw.println(" <head>");
       pw.println(" <title>foo servlet</title>");
       pw.println(" </head>");
       pw.println(" <body>");
       pw.println(" <p>userid: ");
       pw.println(userid);
       pw.println(" </p>");
       pw.println(" <p>");
       pw.println(" </p>");
       pw.println(" </body>");
       pw.println("</html>");
       pw.flush();
       pw.close();
       resp.setStatus(HttpServletResponse.SC_OK);
       }
      
       @Override
       public void doGet(HttpServletRequest req, HttpServletResponse resp)
       throws ServletException, IOException {
       doGetPost(req,resp);
       }
      
       @Override
       public void doPost(HttpServletRequest req, HttpServletResponse resp)
       throws ServletException, IOException {
       doGetPost(req,resp);
       }
      }
      


      The properties file is:
      # orgmob
      # Copyright 2007-2008 David B. Bernstein
      
      # major.minor.patch versioning scheme for orgmob
      orgmob.major.version=0
      orgmob.minor.version=0
      orgmob.patch.version=0
      
      #
      orgmob.copyright.year=2007-2008
      


      Apologies in advance if there's an obvious problem, a missed bug, or a missed post.

      Thanks.