Can't get client app to work

2001-10-03 Thread Lorenc, Swavek

I am trying to get to work the examples from Ed Roman's book Mastering
Enerprise Java Beans.
One of his examples is CountBean client application.

Here is what I have done so far.

I have Orion installed in 
D:\Program Files\SPSSWeb\Orion

J2EE sdk installed in
C:\j2sdkee1.2.1

Java SDK installed in
C:\jdk1.3

I created classes CountBean, CountHome, Count in a package session.count and
located them 
in c:\orionapp\classes\session\count. In the same directory I also have
CountClient class.
I compiled allclasses from C:\orionapp\classes.

Using Sun's deploytool I crated the Mastering.ear file containing
ejb-jar-ic.jar
app-client-ic.jar
META-INF\MANIFEST.MF
META-INF\applicatioin.xml
META-INF\sun-j2ee-ri.xml

I deployed the application into Orion and got the following confirmation:
Auto-deploying mastering (Assembly had been updated)...
Auto-deploying ejb-jar-ic.jar (ejb-jar.xml had been touched since the
previous d
eployment)... done.
Auto-deploying app-client-ic.jar (Previous deployment not found)... done.

I extracted the files contained int the app-client-ic.jar into
c:\orionapp\classes.

Now I am trying to run the client application like this and get the
following error:

C:\orionapp\classesjava -classpath
c:\orionapp\classes\;C:\orionapp\orionlib\or
ion.jar session.count.CountClient
javax.naming.NameNotFoundException: Count_JNDIName not found
at com.evermind.server.rmi.RMIContext.lookup(Unknown Source)
at com.evermind._dkb.lookup(Unknown Source)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at session.count.CountClient.main(CountClient.java:15)


The code in CountClient.java that tries to look up the CountHome object
looks like this:
package session.count;

import javax.ejb.*;
import javax.naming.*;
import java.util.Properties;

public class CountClient 
{
public static void main(String [] args)
{
try
{
Properties props = System.getProperties();
Context ctx = new InitialContext(props);
CountHome home = (CountHome) ctx.lookup(Count_JNDIName);


According to some postings in this mail list when the client application is
looking up
ejbs it shouldn't use the java:comp/env prefixed names.

Here is the contents of the various xml files (minus the headers).  All of
these files were
created either by deploytool or by Orion's deployment process.

c:\orionapp\classes\META-INF\application-client.xml
-
application-client
  display-nameCountClient/display-name
  descriptionDescription entered via New Client Application
Wizard/description
  env-entry
descriptionSome environment entry/description
env-entry-namexyz/env-entry-name
env-entry-typejava.lang.String/env-entry-type
env-entry-value6/env-entry-value
  /env-entry
  ejb-ref
descriptionmain EJB referenced in the code/description
ejb-ref-namesession.count.CountBean/ejb-ref-name
ejb-ref-typeSession/ejb-ref-type
homesession.count.CountHome/home
remotesession.count.Count/remote
  /ejb-ref
/application-client


c:\orionapp\classes\META-INF\orion-application-client.xml
-
orion-application-client
ejb-ref-mapping name=session.count.CountBean location=Count /
/orion-application-client


c:\orionapp\classes\jndi.properties
-
#Orion JNDI properties
#Tue Oct 02 17:57:23 CDT 2001
java.naming.provider.url=ormi\://127.0.0.1\:23791/mastering
java.naming.factory.initial=com.evermind.server.ApplicationClientInitialCont
extFactory
java.naming.security.principal=admin
java.naming.security.credentials=123


c:\orionapp\classes\META-INF\sun-j2ee-ri.xml
-
j2ee-ri-specific-information
  app-client
ejb-ref
  ejb-ref-namesession.count.CountBean/ejb-ref-name
  jndi-nameCount_JNDIName/jndi-name
/ejb-ref
  /app-client
/j2ee-ri-specific-information


I have been trying to solve this problem for the last 2 days by looking on
Orion's site,
this site, javasoft site but I can't figure out what is wrong.  It seems to
me that 
JNDI doesn't have the right name or maybe the xml files don't contain the
right information.

Please help.

Thank you
Swavek





Re: Can't get client app to work

2001-10-03 Thread Stephen Davidson

Greetings, Swavek.

I think the problem may be your orion-ejb-jar.xml file.  If you do not
have one (you did not post one), Orion will autogenerate one for you
based (loosely) on your ejb-jar.xml file.  It is similar to the one for
the J2EE server, and the details are available on the Orion
Documentation web pages.  The file that orion generates will, if left to
its own devices, give your ejbs JNDI names that end in EJB.  In this
case, for you to access your EJB, you would most likely have to look for
CountEJB.  Even if you do specify one, Orion will still create and use
its own, but will use yours as the template.  What happens is that when
it generates the stub and skeleton files, these generated files are what
is actually stored as the home and remote interfaces in the xml file. 
If it is reading yours, it will set the JNDI names as you specify.  Use
your OrionConsole to examine what Orion thinks your Jar file looks like.

If you want to change the JNDI name of something that Orion has
autogenerated info for, you will have to make sure that all of the
temp files are deleted.  There seem to be two sets, one in the
ORION_HOME/application-deployments directory, and one with the .ear file
(if you are using ear files).

Regards,
Steve

Lorenc, Swavek wrote:
 
 I am trying to get to work the examples from Ed Roman's book Mastering
 Enerprise Java Beans.
 One of his examples is CountBean client application.
 
 Here is what I have done so far.
 
 I have Orion installed in
 D:\Program Files\SPSSWeb\Orion
 
 J2EE sdk installed in
 C:\j2sdkee1.2.1
 
 Java SDK installed in
 C:\jdk1.3
 
 I created classes CountBean, CountHome, Count in a package session.count and
 located them
 in c:\orionapp\classes\session\count. In the same directory I also have
 CountClient class.
 I compiled allclasses from C:\orionapp\classes.
 
 Using Sun's deploytool I crated the Mastering.ear file containing
 ejb-jar-ic.jar
 app-client-ic.jar
 META-INF\MANIFEST.MF
 META-INF\applicatioin.xml
 META-INF\sun-j2ee-ri.xml
 
 I deployed the application into Orion and got the following confirmation:
 Auto-deploying mastering (Assembly had been updated)...
 Auto-deploying ejb-jar-ic.jar (ejb-jar.xml had been touched since the
 previous d
 eployment)... done.
 Auto-deploying app-client-ic.jar (Previous deployment not found)... done.
 
 I extracted the files contained int the app-client-ic.jar into
 c:\orionapp\classes.
 
 Now I am trying to run the client application like this and get the
 following error:
 
 C:\orionapp\classesjava -classpath
 c:\orionapp\classes\;C:\orionapp\orionlib\or
 ion.jar session.count.CountClient
 javax.naming.NameNotFoundException: Count_JNDIName not found
 at com.evermind.server.rmi.RMIContext.lookup(Unknown Source)
 at com.evermind._dkb.lookup(Unknown Source)
 at javax.naming.InitialContext.lookup(InitialContext.java:350)
 at session.count.CountClient.main(CountClient.java:15)
 
 The code in CountClient.java that tries to look up the CountHome object
 looks like this:
 package session.count;
 
 import javax.ejb.*;
 import javax.naming.*;
 import java.util.Properties;
 
 public class CountClient
 {
 public static void main(String [] args)
 {
 try
 {
 Properties props = System.getProperties();
 Context ctx = new InitialContext(props);
 CountHome home = (CountHome) ctx.lookup(Count_JNDIName);
 
 According to some postings in this mail list when the client application is
 looking up
 ejbs it shouldn't use the java:comp/env prefixed names.
 
 Here is the contents of the various xml files (minus the headers).  All of
 these files were
 created either by deploytool or by Orion's deployment process.
 
 c:\orionapp\classes\META-INF\application-client.xml
 -
 application-client
   display-nameCountClient/display-name
   descriptionDescription entered via New Client Application
 Wizard/description
   env-entry
 descriptionSome environment entry/description
 env-entry-namexyz/env-entry-name
 env-entry-typejava.lang.String/env-entry-type
 env-entry-value6/env-entry-value
   /env-entry
   ejb-ref
 descriptionmain EJB referenced in the code/description
 ejb-ref-namesession.count.CountBean/ejb-ref-name
 ejb-ref-typeSession/ejb-ref-type
 homesession.count.CountHome/home
 remotesession.count.Count/remote
   /ejb-ref
 /application-client
 
 c:\orionapp\classes\META-INF\orion-application-client.xml
 -
 orion-application-client
 ejb-ref-mapping name=session.count.CountBean location=Count /
 /orion-application-client
 
 c:\orionapp\classes\jndi.properties
 -
 #Orion JNDI properties
 #Tue Oct 02 17:57:23 CDT 2001
 java.naming.provider.url=ormi\://127.0.0.1\:23791/mastering
 

Can't get client app to work

2001-10-03 Thread Xiaowen Wang

I think it might be that sun-j2ee-ri.xml is specifying the jndi name,
ejb-ref name binding, whereas orion is not parsing that file. I think
you have to do it in orion-ejb-jar.xml to do the things equivalent to
sun-j2ee-ri.xml does. You can find the orion-ejb-jar.xml in
orion\application-deployments\your-app-name\your-ejb-jar-name\ . Copy
it to your codebase and change it.
Xiaowen