1 Reply Latest reply on Jul 13, 2006 11:11 AM by Peter Johnson

    Deployment Error

    Sudhir N Newbie

      This EJB example I am trying with jboss-4.0.4.GA and am trying to deply the StringProcessor.jar file to C:\jboss-4.0.4.GA\server\default\deploy.

      The error generated is:
      2006-07-13 12:20:33,606 ERROR [org.jboss.deployment.scanner.URLDeploymentScanner] Incomplete Deployment listing:

      --- Incompletely deployed packages ---
      org.jboss.deployment.DeploymentInfo@e4b0ad97 { url=file:/C:/jboss-4.0.4.GA/server/default/deploy/StringProcessor.jar }
      deployer: MBeanProxyExt[jboss.ejb:service=EJBDeployer]
      status: Deployment FAILED reason: Invalid XML: file=jar:file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp31156StringProcessor.jar!/META-INF/ejb-jar.xml@6:2; - nested throwable: (org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.)
      state: FAILED
      watch: file:/C:/jboss-4.0.4.GA/server/default/deploy/StringProcessor.jar
      altDD: null
      lastDeployed: 1152786033278
      lastModified: 1152786033278
      mbeans:





      I have also alternatively tried with adding to ejb-jar.xml file DOCTYPE versions ( <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> ) or ( <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_1_1.dtd"> )

      And even I tried including the jboss.xml file.


      Still getting the same error, any help to solve this settings is appreciated. Thanks.





      The files used are:

      *********************************************************************
      Listing 1. The StringProcessor.java File


      package com.javapro.ejb;

      import javax.ejb.EJBObject;
      import java.rmi.RemoteException;

      public interface StringProcessor extends EJBObject {
      public String toUpperCase(String s) throws RemoteException;
      }

      *********************************************************************

      Listing 2. The StringProcessorHome.java File


      package com.javapro.ejb;

      import java.rmi.RemoteException;
      import javax.ejb.CreateException;
      import javax.ejb.EJBHome;

      public interface StringProcessorHome extends EJBHome {
      StringProcessor create() throws RemoteException, CreateException;
      }


      *********************************************************************

      Listing 3. The StringProcessorBean.java File


      package com.javapro.ejb;

      import java.rmi.RemoteException;
      import javax.ejb.SessionBean;
      import javax.ejb.SessionContext;

      public class StringProcessorBean implements SessionBean {

      public String toUpperCase(String s) {
      System.out.println("from StringProcessorBean");
      if (s==null)
      return null;
      else
      return s.toUpperCase();
      }

      public void ejbCreate() {
      }

      public void ejbRemove() {
      }

      public void ejbActivate() {
      }

      public void ejbPassivate() {
      }

      public void setSessionContext(SessionContext sc) {
      }
      }


      *********************************************************************

      Listing 4. The ejb-jar.xml File


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

      <ejb-jar>
      Your first EJB application
      <display-name>String Processor Application</display-name>
      <enterprise-beans>

      <ejb-name>StringProcessor</ejb-name>
      com.javapro.ejb.StringProcessorHome
      com.javapro.ejb.StringProcessor
      <ejb-class>com.javapro.ejb.StringProcessorBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>

      </enterprise-beans>
      </ejb-jar>


      *********************************************************************

      Listing 5. Client.java


      import javax.naming.*;
      import javax.rmi.PortableRemoteObject;
      import java.util.Properties;
      import com.javapro.ejb.StringProcessor;
      import com.javapro.ejb.StringProcessorHome;

      public class Client {

      public static void main(String[] args) {

      // first argument must be the input
      if (args.length==0) {
      System.out.println("Please specify the input to convert to upper case.");
      return;
      }
      String input = args[0];

      // preparing properties for constructing an InitialContext object
      Properties properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      properties.put(Context.PROVIDER_URL, "localhost:1099");

      try {
      // Get an initial context
      InitialContext jndiContext = new InitialContext(properties);
      System.out.println("Got context");

      // Get a reference to the Bean
      Object ref = jndiContext.lookup("StringProcessor");
      System.out.println("Got reference");

      // Get a reference from this to the Bean's Home interface
      StringProcessorHome home = (StringProcessorHome)
      PortableRemoteObject.narrow (ref, StringProcessorHome.class);

      // Create an Adder object from the Home interface
      StringProcessor sp = home.create();
      System.out.println ("Uppercase of '" + input + "' is " +
      sp.toUpperCase(input));
      }
      catch(Exception e) {
      System.out.println(e.toString());
      }
      }
      }

      *********************************************************************




        • 1. Re: Deployment Error
          Peter Johnson Master

          1) Do NOT post the same question to multiple forums!

          2) The error message states:

          Deployment FAILED reason: Invalid XML:
          file=jar:file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp31156StringProcessor.jar!/META-INF/ejb-jar.xml@6:2;
          - nested throwable: (org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.)


          The key parts are the xml file name and the location of the error (line 6, char position 2). (You will, of course, want to fix the ejb-jar.xml file located within the original jar file, not the one in the tmp directory.)

          3) You reformatted the xml file when you posted it (you should post it exactly as is and use the "CODE" brackets - paste the XML into the text box then highlight the XML text and click the Code button above the text entry area), so I cannot tell exactly what the problem is with it.