Problem running EJB client on Blazix App Server [message #92571] |
Mon, 20 September 2004 02:46 |
Bibudh Lahiri
Messages: 6 Registered: August 2004
|
Junior Member |
|
|
Hi,
I've deployed a CMP EntityBean named Cabin on Blazix App server. I've successfully compiled the client also, but i'm getting an error when i'm trying to run the client.
The class files Cabin.class, CabinBean.class, CabinHome.class and Client_1.class are all located in C:Blazixserverdevcomtitancabin. The corresponding source files are all located in C:Blazixserverdev and all the classes are included in the package com.titan.cabin.
i've set the following env variables in Autoexec.bat :
SET JAVA_HOME=D:JDK1.4
SET PATH=C:WINDOWS;C:WINDOWSCOMMAND;%JAVA_HOME%bin;C:Blazixserver
SET CLASSPATH=%JAVA_HOME%bin;C:Blazixserverblazix.jar;C:Blazixserverdev;%JAVA_HOME%jrelib*.jar;%JAVA_HOME%jrelibext*.jar;C:BlazixserverdevCabinEjb.jar
i've run the client by the following command java com.titan.cabin.Client_1 from the location C:Blazixserverdev and got the follwoing stacktrace
C:Blazixserverdev>sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)sun.rmi.transport.Transport$1.run(Unknown Source)java.security.AccessController.doPrivileged(Native Method)
sun.rmi.transport.Transport.serviceCall(Unknown Source)sun.rmi.transport.tcp.
TCPTransport.handleMessages(Unknown Source)sun.rmi.transport.tcp.TCPTransport$Co
nnectionHandler.run(Unknown Source)java.lang.Thread.run(Unknown Source)sun.rmi.t
ransport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)sun.rmi.tra
nsport.StreamRemoteCall.executeCall(Unknown Source)sun.rmi.server.UnicastRef.inv
oke(Unknown Source)com.titan.cabin.CabinHomeCtx_Stub.create(Unknown Source)com.t
itan.cabin.Client_1.main(Client_1.java:22)
( I couldn't view the full stacktrace in MS-DOS console, therefore i've applied a trick to remove the indentations)
The code of Client_1.java is as follows
package com.titan.cabin;
import com.titan.cabin.CabinHome;
import com.titan.cabin.Cabin;
//import com.titan.cabin.CabinPK;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import java.rmi.RemoteException;
import java.util.Properties;
import java.io.*;
public class Client_1 {
public static void main(String [[]] args) throws IOException{
try {
Context jndiContext = getInitialContext();
/*Object ref = jndiContext.lookup("CabinHomeRemote");
CabinHomeRemote home = (CabinHomeRemote)
javax.rmi.PortableRemoteObject.narrow(ref,CabinHomeRemote.class);*/
CabinHome home = (CabinHome)jndiContext.lookup("Cabin");
Cabin cabin_1 = home.create(new Integer(1));
cabin_1.setName("Master Suite");
cabin_1.setDeckLevel(1);
cabin_1.setShipId(1);
cabin_1.setBedCount(3);
Integer pk = new Integer(1);
Cabin cabin_2 = home.findByPrimaryKey(pk);
System.out.println(cabin_2.getName());
System.out.println(cabin_2.getDeckLevel());
System.out.println(cabin_2.getShipId());
System.out.println(cabin_2.getBedCount());
} catch (java.rmi.RemoteException re)
{
StackTraceElement[[]] stackTrace = re.getStackTrace();
for (int i=0;i<stackTrace.length;i++)
{
StackTraceElement objStackTraceElement = stackTrace[[i]];
String strStackTraceElement = objStackTraceElement.toString();
try{
for (int j=0;j< strStackTraceElement.length();j++)
{
char charStackTrace = strStackTraceElement.charAt(j);
System.out.print(charStackTrace);
FileOutputStream fout = null;
try{
fout = new FileOutputStream("logger.txt");
}
catch(FileNotFoundException fle)
{
System.out.println("output file not found");
}
if (charStackTrace!= -1) fout.write(charStackTrace);
}
} //end try
catch(IOException ioe)
{
System.out.println("File error");
}
}
}
catch (javax.naming.NamingException ne)
{
ne.printStackTrace();
System.out.println("NamingException");
}
catch (javax.ejb.CreateException ce){ce.printStackTrace();
System.out.println("CreateException");
}
catch (javax.ejb.FinderException fe){fe.printStackTrace();
System.out.println("FinderException");
}
}
public static Context getInitialContext()
throws javax.naming.NamingException {
java.util.Properties properties = new java.util.Properties();
properties.put("java.naming.factory.initial","desisoft.ejb.client.JRMPFactory");
properties.put("desisoft.ejb.nameServer1","dr:2050");
InitialContext initialContext = new InitialContext(properties);
return initialContext;
}
}
I've commented the invokation to PortableRemoteObject.narrow as I'm working on JRMP protocol.
The EJB configuration file is as follows:
# The EJB server configuration file
server.port: 2050
isNameServer: yes
ejb.protocol: JRMP
admin.port: 2051
license.file: C:Blazixserverlicense.dat
tempDir: C:Blazixserverejbtemp
# EJB JAR files can be copied to this directory for automatic deployment
ejbDir: C:Blazixserverejbdir
# Alternate syntax for deploying EJB JAR files.
# Note: Live deploying or re-deploying is only available with "ejbDir".
# ejbJar: <path-to-EJB-jar-file>
dataSource.name: cabinDataSource
dataSource.cabinDatasource.odbc: CabinOdbc
ejbJar: C:BlazixserverdevCabinEjb.jar
ejb.cabin.dataSource: cabinDataSource
ejb.cabin.table: Cabin
The output at the console of the EJB server is as follows:
Log file: C:BlazixserverEjblog.log
Blazix EJB Server 1.2
Copyright (C) Desiderata Software, 2001-2002
All rights reserved
Configuration file: C:Blazixserverejb.ini
JRMP version
Deploying EJB-Home class "com.titan.cabin.CabinHome" at JNDI name "Cabin"
Evaluation license
Listening at dr:2050
EJB Server operational at Sat Sep 18 09:49:53 IST 2004
can someone pls tell a way out? Why isn't the client getting the remote object?
|
|
|