This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Learn Java with Math: Using Fun Projects and Games and have Ron Dai on-line!
See this thread for details.
Win a copy of Learn Java with Math: Using Fun Projects and Games this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Problem in getting EJBHome for stateless session bean in servlet in websphere4.0

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,
I am getting problem in servlet side while calling session bean in websphere 4.0.It is not going to ejbHome statement.

My STDOUT.LOG shows in websphere is:
U userid
[02.06.10 15:09:47:906 GMT+05:30] 131dd1a4 SystemOut U password
[02.06.10 15:09:47:906 GMT+05:30] 131dd1a4 SystemOut U Inside the perform task of login servlet7.05
[02.06.10 15:09:47:921 GMT+05:30] 131dd1a4 SystemOut U Before lookup1.5
[02.06.10 15:09:47:921 GMT+05:30] 131dd1a4 SystemOut U After lookup
[02.06.10 15:09:47:921 GMT+05:30] 131dd1a4 SystemOut U ejbHome1 is:IOR:0000000000000030524d493a454a427061636b6167652e53657373696f6e4a444243486f6d653a30303030303030303030303030303030000000000100000000000000f8000101000000000e3137322e31392e32342e323332002328000000b84a4d42490000001242f65a4765636462373435653036303030303030000000240000009449454a5001000e44656661756c74205365727665721544656661756c7420454a4220436f6e7461696e657200000065acac0002000100290000005f5f686f6d654f66486f6d6573235f5f686f6d654f66486f6d6573235f5f686f6d654f66486f6d65730852414a234c6f67696e73657373696 f6e6265616e332e6a617223454a427061636b6167655f53657373696f6e4a444243000000010000000100000018000000000001000100000001000100200001010000000000
My servlet code is:

public void performTask(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) {

System.out.println("before calling method");
//EJBpackage.SessionJDBCHome homeObject =null;
/*try{

SessionJDBCAccessBean ab =new SessionJDBCAccessBean();
ab.jdbcconn();
System.out.println("after calling method"); */

try

{
// Insert user code from here.

String UserID = request.getParameter("UserID");
String password =request.getParameter("password");

System.out.println("userid"+ UserID);
System.out.println("password"+ password);

System.out.println("Inside the perform task of login servlet7.05");
Hashtable env1 =new Hashtable();
env1.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env1.put(Context.PROVIDER_URL,"iiop:///");
Context initialContext=new InitialContext(env1);
System.out.println("Before lookup1.5 ");
try{
java.lang.Object ejbHome =initialContext.lookup("EJBpackage/SessionJDBC");
System.out.println("After lookup");
System.out.println("ejbHome1 is:"+ejbHome);



homeObject = ( EJBpackage.SessionJDBCHome)javax.rmi.PortableRemoteObject.narrow((org.omg.CORBA.Object)ejbHome,EJBpackage.SessionJDBCHome.class);
System.out.println("After getting homeObject" );
}catch(Exception e){System.out.println("excpetion is"+e.getMessage());}
//To get the session bean object

EJBpackage.SessionJDBC remoteobject = homeObject.create();
System.out.println("After getting remoteobject" + remoteobject);
remoteobject.jdbcconn();

//To create an entity in database with the use of an entity bean
// homeObject.create(UserID);

//Finding a customer bean
// EJBpackage.FirstbeanKey key = new EJBpackage.FirstbeanKey(UserID);
// EJBpackage.Firstbean remoteobject = homeObject.findByPrimaryKey(key);

}

catch(NamingException e) { }
catch(Throwable theException)
{

theException.printStackTrace();
}
}

MY ACTIVITY.LOG IN WEBSPHEERE shows:

ervlet Error: {0}: {1} %com.ibm.ejs.resources.seriousMessages �>��� .Connection aborted by peer: socket write error!java.net.SocketException: Connection aborted by peer: socket write error
at java.net.SocketOutputStream.socketWrite(Native Method)
at java.net.SocketOutputStream.write(SocketOutputStream.java(Compiled Code))
at com.ibm.ws.io.Stream.write(Stream.java(Compiled Code))
at com.ibm.ws.io.WriteStream.flush(WriteStream.java(Compiled Code))
at com.ibm.ws.http.ResponseStream.flush(ResponseStream.java(Compiled Code))
at com.ibm.ws.io.WriteStream.flush(WriteStream.java(Compiled Code))
at com.ibm.servlet.engine.srp.SRPConnection.flush(SRPConnection.java(Compiled Code))
at com.ibm.servlet.engine.srp.SRPConnection.flush(SRPConnection.java(Compiled Code))
at com.ibm.servlet.engine.srt.SRTOutputStream.flush(SRTOutputStream.java(Compiled Code))
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java(Compiled Code))
at com.ibm.servlet.engine.srt.BufferedWriter.flushChars(BufferedWriter.java(Compiled Code))
at com.ibm.servlet.engine.srt.BufferedWriter.flushBuffer(BufferedWriter.java(Compiled Code))
at com.ibm.servlet.engine.srt.BufferedWriter.flushBuffer(BufferedWriter.java(Compiled Code))
at com.ibm.servlet.engine.srt.SRTServletResponse.flushBuffer(SRTServletResponse.java(Compiled Code))
at com.ibm.servlet.engine.webapp.HttpServletResponseProxy.flushBuffer(HttpServletResponseProxy.java(Compiled Code))
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the IBM/Websphere forum...
Also, please read the naming policy and edit your profile accordingly.
Thanks
Simon
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take out the cast to the CORBA.Object inside the PortableRemoteObject.narrow(). That is no longer necessary in WebSphere 4.0 and causes problems when you have it!
Kyle
 
What are you doing? You are supposed to be reading this tiny ad!
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!