I use lomboz for eclipse to develop a CMPBean which is deployed in jboss3.0.8. The
jboss uses the configuration files under server/all directory ,not server/default , in
my eclipse. The CMPBean named Account should be deployed successfully because the
information below emerged when starting the jboss under eclipse :
23:41:45,593 INFO [MainDeployer] Starting deployment of package:
file:/D:/jboss-3.0.8/server/all/deploy/TicketModule.jar
23:41:45,781 INFO [EjbModule] Creating
23:41:45,812 INFO [EjbModule] Deploying Account
23:41:45,875 INFO [EjbModule] Created
23:41:45,875 INFO [EjbModule] Starting
23:41:47,703 INFO [Account] Table 'ACCOUNT' already exists
23:41:47,750 INFO [EjbModule] Started
23:41:47,750 INFO [MainDeployer] Deployed package:
file:/D:/jboss-3.0.8/server/all/deploy/TicketModule.jar
I think the clue above means that the CMPBean is deployed in jboss. To test the
CMPBean I write a plain java object (not a sessionBean) in the same project where the
CMPBean resides. The main function of the plain java object is to retrive the
localhome of the CMPBean and call the FINDER mothed. But I find that I can't get the
localhome refrence through the getLocalhome() in the AccountUtil class generated by
lomboz . I write the code to throw an EJBException which inherites the
RuntimeException when error occured. The real Exception is nested in the EJBException
so I can stop the application and find what the real error is .I find that if I use
the default code in the getLocalHome() which is listed below:
javax.naming.InitialContext initialContext =new javax.naming.InitialContext();
(server.ejb.account.AccountLocalHome)initialContext.lookup(server.ejb.account.AccountLocalHome.COMP_NAME)
I 'll get the error below:
javax.ejb.EJBException: nested exception is: javax.naming.NoInitialContextException:
Need to specify class name in environment or system property, or as an applet
parameter, or in an application resource file: java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in environment or
system property, or as an applet parameter, or in an application resource file:
java.naming.factory.initial at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
If I change the default code to the format below:
Hashtable props = new Hashtable();
props.put(
javax.naming.InitialContext.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(
javax.naming.InitialContext.PROVIDER_URL,
"jnp://127.0.0.1:1099");
// Obtain initial context
javax.naming.InitialContext initialContext =
new javax.naming.InitialContext(props);
(server.ejb.account.AccountLocalHome)initialContext.lookup(server.ejb.account.AccountLocalHome.COMP_NAME)
I'll get the erro below:
javax.ejb.EJBException: nested exception is: javax.naming.NameNotFoundException: comp
not bound
If I change the "server.ejb.account.AccountLocalHome.COMP_NAME"(which is
"java:comp/env/ejb/Account") to "server.ejb.account.AccountLocalHome.JNDI_NAME" (which
is"
Account"), I 'll get the error below :
exception is java.lang.ClassNotFoundException:
org.jboss.ejb.plugins.local.LocalHomeProxy
(no security manager: RMI class loader disabled)]
javax.naming.CommunicationException [Root exception is
java.lang.ClassNotFoundException:
org.jboss.ejb.plugins.local.LocalHomeProxy (no security manager: RMI class loader
disabled)]
I am surprise very much. I write code to list all the content in the Context
NamingEnumeration enum = initialContext.list("");
// print out everything in the enum
while (enum.hasMore()) {
Object obj = enum.next();
NameClassPair entry =
(NameClassPair) javax.rmi.PortableRemoteObject.narrow(obj,
NameClassPair.class);
String eName = entry.getName();
String eClass = entry.getClassName();
System.out.println(eName + "\t" + eClass);}
I get the information below:
HASessionState org.jnp.interfaces.NamingContext
jmx org.jnp.interfaces.NamingContext
clustering org.jnp.interfaces.NamingContext
ConnectionFactory org.jboss.mq.SpyConnectionFactory
anonymous wrote : AccountLocal $Proxy34
UserTransactionSessionFactory
org.jboss.tm.usertx.server.UserTransactionSessionFactoryImpl
XAConnectionFactory org.jboss.mq.SpyXAConnectionFactory
invokers org.jnp.interfaces.NamingContext
jetty org.jnp.interfaces.NamingContext
UserTransaction org.jboss.tm.usertx.client.ClientUserTransaction
UILXAConnectionFactory org.jboss.mq.SpyXAConnectionFactory
RMIXAConnectionFactory org.jboss.mq.SpyXAConnectionFactory
UIL2XAConnectionFactory org.jboss.mq.SpyXAConnectionFactory
HAPartition org.jnp.interfaces.NamingContext
queue org.jnp.interfaces.NamingContext
topic org.jnp.interfaces.NamingContext
UIL2ConnectionFactory org.jboss.mq.SpyConnectionFactory
anonymous wrote : AccountBean $Proxy35
UILConnectionFactory org.jboss.mq.SpyConnectionFactory
RMIConnectionFactory org.jboss.mq.SpyConnectionFactory
ejb org.jnp.interfaces.NamingContext
jmx:yx:rmi org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl
I find that the AccountLocal and AccountBean are all in the Context .But I can't
retrive the AccountLocal through NamingService in jboss.
Can anybody tell me what's wrong with my application .The default code generated by
lomboz is right or not ? Why can't I get the localhome refrence of Account? How should
I do ? What is the right code to retrive the localhome in the same project where the
EJB reside?
I am looking forward to reply !
Thank you a million!
Best regards!
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3829986#3829986
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3829986
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user