aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Back in Business!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Back in Business!!" Watch "Back in Business!!" New topic
Author

Back in Business!!

Tualha Khan
Ranch Hand

Joined: Nov 22, 2000
Posts: 287
2:34 AM 1/6/2002
Dear All,
Hey,
I am a long lost SCJP. Lost the touch in somewhere June 2001. Now I am planning to be back in the stream, starting right from
things like ejb, j2ee, statefull, stateless etc etc. I 'll be needing a lot of help here...
Rest is fine.
Thanks & Bye,
Tualha Khan
& BTW, congrats on giving my best java companion a facelift....

===================================
3:04 PM 1/6/2002
Ok Here starts my queries.

I am studying from Ed Roman's Mastering EJB. I have just made my first enterprise bean ("Hello World"). I have the following
structure of my bean:
Package: HelloBean
3 Java source files:
Hello.java -- The interface which extends javax.ejb.EJBObject -- The Remote Interface file
HelloHome.java -- The interface which extends javax.ejb.EJBHome -- The Home Interface file
HelloBean.java -- The Actual Bean class which implements javax.ejb.SessionBean interface -- The Bean class file

1 Deployment Descriptor: Deployment_Descriptor.txt (Copied and edited from Ed Roman's Source code)

Now, when I try to compile these files, I get the error stating that javax.ejb.* class files not found.
package javax.ejb does not exist
cannot resolve symbol

I compile these files using the following command:
javac HelloBean\*.java

I was able to get j2ee up and running, I also have installed the Weblogic 6.1 server and it also seems to be running ok.
My directory structure is as follows:
Bea Home : c:\bea
JDK 1.3.1 : c:\bea\jdk131
J2EE 1.3.1: c:\j2ee

Can anybody help me on compiling my .java files and further steps.
Thanks & Bye,
Tualha Khan


SCJP2, BEA WLS 6.0, DB2 UDB 7.1
Tualha Khan
Ranch Hand

Joined: Nov 22, 2000
Posts: 287
Dear All,
Hey,
I was able to finally compile my .java files successfully (thanks a tonne to someone on this forum). Now the next question is about deployment. I have both J2ee and Weblogic up and running, what is a better choice?? Also, if I deploy my ejb in one environment, then can I with a little effort deploy it in the other environment?
Do guide!
Thanks & Bye,
Tualha Khan
Tualha Khan
Ranch Hand

Joined: Nov 22, 2000
Posts: 287
12:51 AM 1/7/2002
Dear All,
Hey,
I have successfully, deployed my first EJB. However there seems to be some problem in the client code. I am using the J2EE's deploytool to deploy the Application. Here is the summary from the Deploytool
===========================
Deploy the application in C:\bea\jfiles\HelloWorldApp.ear on the server
localhost saving the client jar as C:\bea\jfiles\HelloWorldAppClient.jar
Sender object Deploy Tool : Deploy HelloWorldApp on localhost
Remote message: Contacted Server....
Remote message: Application HelloWorldApp transferred.
Remote message: HelloWorldApp has 1 ejbs, 0 web components to deploy.
Remote message: Deploying Ejbs....
Remote message: Processing beans ....
Remote message: Compiling wrapper code ....
Remote message: Compiling RMI-IIOP code ....
Remote message: Making client JARs ....
Remote message: Making server JARs ....
Remote message: Deployment of HelloWorldApp is complete..
Sender object Deploy Tool : client code at
http://127.0.0.1:9191/HelloWorldAppClient.jar
Remote message: Client code for the deployed application HelloWorldApp saved to
C:\bea\jfiles\HelloWorldAppClient.jar.
===========================
Here is the complete session after running the client:-
===========================
C:\bea\jfiles>runclient -client HelloWorldApp.ear -name HelloWorldClient
-textauth
Initiating login ...
Username = null
Enter Username:guest
Enter Password:guest123
Binding name:`java:comp/env/SimpleHelloWorld`
Before Object Creation --->>>
Caught an Exception: java.rmi.AccessException: CORBA NO_PERMISSION 0 No;
nested
exception is:
org.omg.CORBA.NO_PERMISSION: minor code: 0 completed: No
java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:
org.omg.CORBA.NO_PERMISSION: minor code: 0 completed: No
org.omg.CORBA.NO_PERMISSION: minor code: 0 completed: No
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at
com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemExc
eption(ReplyMessage_1_2.java:93)
at
com.sun.corba.ee.internal.iiop.ClientResponseImpl.getSystemException(
ClientResponseImpl.java:108)
at
com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOACli
entSC.java:136)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:459)
at _HelloWorldHome_Stub.create(Unknown Source)
at HelloWorldClient.main(HelloWorldClient.java:18)
at java.lang.reflect.Method.invoke(Native Method)
at
com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:24
3)
at com.sun.enterprise.appclient.Main.main(Main.java:159)
Unbinding name:`java:comp/env/SimpleHelloWorld`
C:\bea\jfiles>
===========================
The StackTrace suggests some problem arises when I call the create() method on the Home interface of my app. Following are
the four source files.
==========================
HelloWorld.java (The Remote Interface)
import javax.ejb.*;
import java.rmi.*;

public interface HelloWorld extends EJBObject
{
public String hello() throws RemoteException;
}
==========================
HelloworldHome.java (The Home Interface)
import javax.ejb.*;
import java.rmi.*;
import java.io.Serializable;

public interface HelloWorldHome extends EJBHome
{
HelloWorld create() throws RemoteException, CreateException;
}

==========================
HelloWorldBean.java (The Enterprise Bean Class)
import javax.ejb.*;
import java.rmi.*;

public class HelloWorldBean implements SessionBean
{
public String hello()
{
System.out.println("Cool EJB Ultimately Worked??");
return "Yep, it Did!!";
}
public void ejbCreate()
{
System.out.println("In ejbCreate()");
}
public void ejbRemove()
{
System.out.println("In ejbRemove()");
}
public void ejbActivate()
{
System.out.println("In ejbActivate()");
}
public void ejbPassivate()
{
System.out.println("In ejbPassivate()");
}
public void setSessionContext(SessionContext ctx)
{
System.out.println("In setSessionContext()");
}
}

==========================
HelloWorldClient.java (The Application Client)
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import HelloWorld;
import HelloWorldHome;
public class HelloWorldClient
{
public static void main(String args[])
{
try
{
Context initial = new InitialContext();
Object objref=initial.lookup("java:comp/env/SimpleHelloWorld");
HelloWorldHome home=(HelloWorldHome)PortableRemoteObject.narrow(objref,
HelloWorldHome.class);
System.out.println("Before Object Creation --->>>");
HelloWorld sayHello = home.create();
//String hellosaid=sayHello.hello();
//System.out.println("The Reply from EJB is : "+hellosaid);
System.out.println("Client Seems to be ok");
//sayHello.remove();
}
catch(Exception ex)
{
System.out.println("Caught an Exception: "+ex);
ex.printStackTrace();
}
}
}

==========================

Any help will be appreciated!!
Thanks & Bye,
Tualha Khan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Back in Business!!