When test the deployed cmp ,throw MalformedObjectNameExcepti
wqhhust Mar 4, 2003 9:49 AMI use eclipse+lomboz to develop CMP,and after I deploy the ejb jar file to jboss,and jboss can work well(it did not throw any exception).And then I use the Test java file created by lomboz,and run it,it throw a strange exception!!
public class Test {
private org.hust.ProductHome getHome() throws NamingException {
return (org.hust.ProductHome) getContext().lookup(
org.hust.ProductHome.JNDI_NAME);
}
private InitialContext getContext() throws NamingException {
Hashtable props = new Hashtable();
//---------------------WEBLOGIC
//props.put(
// InitialContext.INITIAL_CONTEXT_FACTORY,
// "weblogic.jndi.WLInitialContextFactory");
//props.put(InitialContext.PROVIDER_URL, "t3://127.0.0.1:7001");
//----------------------WEBLOGIC
//----------------------JBOSS
props.put(
InitialContext.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");
InitialContext initialContext = new InitialContext(props);
return initialContext;
}
public void testBean() {
try {
org.hust.Product myBean = getHome().create(11111,"wwwww");
} catch (RemoteException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
Test test = new Test();
test.testBean();
}
}
java.lang.NoClassDefFoundError: javax/management/MalformedObjectNameException
at org.jboss.system.server.ServerImpl.(ServerImpl.java:51)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at org.jboss.system.server.ServerLoader.createServer(ServerLoader.java:244)
at org.jboss.system.server.ServerLoader.load(ServerLoader.java:224)
at org.jboss.Main.boot(Main.java:134)
at org.jboss.Main$1.run(Main.java:375)
at java.lang.Thread.run(Thread.java:536)
WARNING: Default charset GBK not supported, using ISO-8859-1 instead