[jboss-user] [Beginners Corner] - Deployment Error
sudjboss
do-not-reply at jboss.com
Thu Jul 13 06:43:44 EDT 2006
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 at 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 at 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());
}
}
}
*********************************************************************
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957683#3957683
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957683
More information about the jboss-user
mailing list