Discussion:
[Middlegen-user] Simple client?
G***@xcomp.com.au
2002-07-31 05:28:01 UTC
Permalink
Hi All.

It seems there are some problems with the struts part of the sample
application shipped with middlegen. So I am trying to write my own
simple client to test that the ejb's are deployed and working properly.

I have successfuly generated and deployed the airline-ejb.jar file in
JBoss, so the ejb's should be deployed. I have a simple client (below).
When I run it I get the error:

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

I'm not really sure how I should be using the XXXUtil, XXXLocalHome and
XXXLocal interfaces (I have never come across a "local" home interface
before). Can someone explain this??? How do I get the client to work???


---------
package airline;
import airline.interfaces.*;

/**
* Test the 'Airline' application.
*/
class AirlineClient{
public static void main(String[] args){
try{
PersonLocalHome personLocalHome = PersonUtil.getLocalHome();
PersonLocal allah = personLocalHome.findByPrimaryKey(new
Integer(2));
}
catch(Exception e){
System.out.println(e.toString());
}
}
}


thanks!!

--
Glenn
M-Leander Reimer
2002-07-31 06:25:02 UTC
Permalink
Hi Glenn,

As far as I understand it, you can only use local interfaces when your
client runs in the same JVM as the EJBs, e.g. the struts action classes
can use the EJBs via local calls when they are deployed together in the
same EAR. Fruthermore realations between EJB only work with local
interfaces. There are some good tutorials on the net that explain the
difference between local and remote interfaces in more depth.

Because your client application is a stand-alone Java app, you can not
use local homes and interfaces. You have to use the remote stuff
instead. If you are using JBoss, download the voluntary documentation
and code samples. In there is a small example of how to get a EJB
stand-alone client app to run, especially how to configure the Initial
Context so that it uses the Lookup service from JBoss so it can find
your EJB homes.

Hope that helps.

Leander
Post by G***@xcomp.com.au
Hi All.
It seems there are some problems with the struts part of the sample
application shipped with middlegen. So I am trying to write my own
simple client to test that the ejb's are deployed and working properly.
I have successfuly generated and deployed the airline-ejb.jar file in
JBoss, so the ejb's should be deployed. I have a simple client (below).
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
I'm not really sure how I should be using the XXXUtil, XXXLocalHome and
XXXLocal interfaces (I have never come across a "local" home interface
before). Can someone explain this??? How do I get the client to work???
---------
package airline;
import airline.interfaces.*;
/**
* Test the 'Airline' application.
*/
class AirlineClient{
public static void main(String[] args){
try{
PersonLocalHome personLocalHome = PersonUtil.getLocalHome();
PersonLocal allah = personLocalHome.findByPrimaryKey(new
Integer(2));
}
catch(Exception e){
System.out.println(e.toString());
}
}
}
thanks!!
--
Glenn
-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
--
M.-Leander Reimer
Dipl.-Inf. (FH)

Techdivision
Kunstmühlstr. 17
83022 Rosenheim

Fon: (08031) 356 38 32
Fax: (08031) 356 38 48
Mail: ***@techdivision.com
Loading...