I'm using deploytool to deploy an app into Sun's j2ee server. Right now, it just consists of one stateless session bean. The following is the error I am getting:
In console & UI:
Deploy the application in E:\Projects\Mustang\deploy\mustang.ear on the server localhost saving the
client jar as E:\Projects\Mustang\deploy\MustangClient.jar
Sender object Deploy Tool : Deploy Mustang on localhost
Remote message: Contacted Server....
Remote message: Application Mustang transferred.
Remote message: Mustang has 1 ejbs, 0 web components to deploy.
Remote message: Deploying Ejbs....
Remote message: Processing beans ....
Remote message: Generating wrapper code for Mustang Environment.
Remote message: Compiling wrapper code ....
Remote message: Compiling RMI-IIOP code ....
Remote message: Making client JARs ....
Remote message: Making server JARs ....
There was a deployment error.java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Error while loading JAR E:\Java\j2sdkee1.2.1\repository<snip>;nested exception is
javax.naming.InvalidNameException: JNDI name 'java:comp/env/jdbc/MustangDB' for resource reference 'java:comp/env/jdbc/MustangDB' is not valid
What did I do?
BTW, this error seems to occur no matter what I give for the JNDI name or the resource-ref name.
I think Ur JNDI name that specified in during deployment is not same as U specified in Client program.
A client program of an enterprise bean does following the basic tasks
1. Locate the Home Interface
2. Create an Enterprise Bean Instance
3. Invoke a Business Method
Locate the Home Interface
1. Create a JNDI naming context.
Context initial = new InitialContext();
2. Retrieve the object bound to the name MyConverter. (This is the JNDI name you specified in the section, "Deploying the J2EE Application".)
java.lang.Object objref = initial.lookup("MyConverter");
In the above coding, MyConverter is the JNDI name that I gave during deploying the bean.If U want to know how the bean is deployed and client code is written, then U can refer to
J2EETM Developer's Guide Getting Started
It is available in java.sun.com.
If there is any problem after going through this book and code, then U can post U r program here. I will try to deploy it.
I'm not deploying a client; only the bean. In fact, I don't even have a client written. The problem is JNDI during deployment. In other words, I haven't yet deployed anything under any JNDI name.
I think Ur bean is deployed suscessfully.Because from the message,it is clear that it creates the client and server jars.
Now the error comes because, I think U have wrong entry in Ur default.properties file. The logical JNDI name in file is not correct Check an entry like below
The jdbc/oracle is the logical name and the rest is URL.
Since U are creating a stateless session bean, u don't need any database connection. In fact U can comment this in default.properties file and then restart the J2EE server.
and try to deploy the bean. If it gives any error message after this let me know