• Post Reply Bookmark Topic Watch Topic
  • New Topic

StreamCorruptedException from ejbclient for weblogic portal server

 
srinivasrao marri
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to run a client calling an ejb(session bean) from weblogic portal server. below i am giving my client code and error message:
client code:
================
public class DibClient2 {
private static final String JNDI_NAME = "com.ncs.ncs4school.services.ejb.assessment.AssessmentServicesHome";
private String DATASOURCE = "ncs_domainXADataSource";
private String url;
private AssessmentServicesHome home;
public DibClient2(String url)
throws NamingException
{
this.url = url;
home = lookupHome();
}
public static void main(String[] args) throws Exception {
System.out.println("================working");
log("\nBeginning statelessSession.Client...\n");
String url = "t3://localhost:7501";
System.setProperty("wsf.properties",
"C:/NCS4Schoolportal/settings/WSFProperties.properties");

// Parse the argument list
if (args.length != 1) {
System.out.println("Usage: java examples.ejb20.basic.statelessSession.Client t3://hostname ort");
return;
} else {
url = args[0];
System.out.println(args[0]);
}
DibClient2 client = null;
try {
client = new DibClient2(url);
} catch (NamingException ne) {
System.exit(1);
}
try {
client.example();
} catch (Exception e) {
log("There was an exception while creating and using the TestManager.");
log("This indicates that there was a problem communicating with the server: "+e);
}
log("\nEnd statelessSession.Client...\n");
}
public void example()
throws CreateException, RemoteException, RemoveException
{
// create a TestManager
log("Creating a TestManager");
AssessmentServicesRemote assessment = (AssessmentServicesRemote) narrow(home.create(), AssessmentServicesRemote.class);

log("After narrowing");

WSF_UserContextIF context = new WSF_UserContext("", "", "", "15", "",DATASOURCE);

System.out.println("Step 1");
Vector v=new Vector();
Integer i1=new Integer(1112);
Integer i2=new Integer(1108);
Integer i3=new Integer(1111);
Integer i4=new Integer(1110);
Integer i5=new Integer(1113);
Integer i6=new Integer(1109);
Integer i7=new Integer(1114);
Integer i8=new Integer(1117);
v.addElement(i1);
v.addElement(i2);
v.addElement(i3);
v.addElement(i4);
v.addElement(i5);
v.addElement(i6);
v.addElement(i7);
v.addElement(i8);
System.out.println("Vector size" +v.size());
System.out.println("Step 3");
HashMap hm = null;
System.out.println("Step 4");
hm = assessment.getSecuredEtest(context,v);
System.out.println("Step 5");
//v=assessment.getAlignedPublishedTests(context,"String");
int size = hm.size();
System.out.println("Step 6");
System.out.println(size);
String n1 = (String)hm.get(i1);
String n2 = (String)hm.get(i2);
String n3 = (String)hm.get(i3);
System.out.println(n1);
System.out.println(n2);
System.out.println(n3);
}
private Object narrow(Object ref, Class c) {
return PortableRemoteObject.narrow(ref, c);
}
private AssessmentServicesHome lookupHome()
throws NamingException
{
// Lookup the beans home using JNDI

Context ctx = getInitialContext();

try {
Object home = ctx.lookup(JNDI_NAME);
return (AssessmentServicesHome) narrow(home, AssessmentServicesHome.class);
} catch (NamingException ne) {
log("The client was unable to lookup the EJBHome. Please make sure ");
log("that you have deployed the ejb with the JNDI name "+JNDI_NAME+" on the WebLogic server at "+url);
throw ne;
}
}

private Context getInitialContext() throws NamingException {
try {
InitialContext IC = new InitialContext();
IC.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
System.out.println("getinitialcontext is working");
IC.addToEnvironment(Context.PROVIDER_URL,url);
return IC;
} catch (NamingException ne) {
log("We were unable to get a connection to the WebLogic server at "+url);
log("Please make sure that the server is running.");
throw ne;
}
}
private static void log(String s) {
System.out.println(s);
}
}

error message after running the client:
==========================================
java.io.StreamCorruptedException: Type code out of range, is 0
at java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1280)
at java.io.ObjectInputStream.SkipToEndOfBlockData(ObjectInputStream.java:1211)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:776)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:353)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:978)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java
:107)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java
:115)
at weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:686)
at weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(ConnectionManagerClient.java:
140)
at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java, Compiled Code)
at weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java, Compiled Code)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java, Compiled Code)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
--------------- nested within: ------------------
weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** - with nested exception:
[java.io.StreamCorruptedException: Type code out of range, is 0]
at weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:688)
at weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(ConnectionManagerClient.java:
140)
at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java, Compiled Code)
at weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java, Compiled Code)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java, Compiled Code)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
but this client code is working fine in another machine.... could anyone tell what might be the problem...
Thanks
srinivas
 
sram bahl
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
probably your client stubs and the corresponding bean classes on the server have their byte codes generated from different JRE's.
 
srinivasrao marri
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sram Bahl
Thanks a lot for u'r advice, it working fine now. Could u please tell how come u know that its related to the versions of jre's?
Thanks
Srinivas
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!