Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem accessing a session bean running on a different port

0 views
Skip to first unread message

Ramya

unread,
Apr 18, 2003, 4:09:02 PM4/18/03
to

Hi,
I am using weblogic7.0 as the application server. I craeted two EJB's and
deployed them in two ports, port 7001 and 7378. I can access the beans when I
deploy them in the same port. But, I am having problem when EJB1 'server1' accesses
EJB2 'server2' deployed in port 7378. Below is the code I am using to lookup the
bean.

Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
prop.put(Context.PROVIDER_URL, "t3://localhost:7378");
Context ctx = new InitialContext(prop);

Object objref = ctx.lookup("java:comp/env/server2");
System.out.println("Inside the Object method "+objref);
iHome = (server2.InsertHome) objref;
System.out.println("Inside the iHome method "+iHome);
mInsert=iHome.create();


I am getting the following exception when I run the client. Can any one plaes
help me with the problem I am facing.
Thanks,
Ramya.

java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NullPointerException

Start server side stack trace:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NullPointerException
java.lang.NullPointerException
at server1.ConnectBean.insertName(ConnectBean.java:133)
at server1.ConnectBean_wtb7ta_EOImpl.insertName(ConnectBean_wtb7ta_EOIm
pl.java:45)
at server1.ConnectBean_wtb7ta_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)

at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServer
Ref.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:785)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.ja
va:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteReques
t.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace
; nested exception is:
java.lang.NullPointerException:
Start server side stack trace:
java.lang.NullPointerException
at server1.ConnectBean.insertName(ConnectBean.java:133)
at server1.ConnectBean_wtb7ta_EOImpl.insertName(ConnectBean_wtb7ta_EOIm
pl.java:45)
at server1.ConnectBean_wtb7ta_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)

at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServer
Ref.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:785)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.ja
va:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteReques
t.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace

at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutbound
Request.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemote
Ref.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemote
Ref.java:229)
at server1.ConnectBean_wtb7ta_EOImpl_WLStub.insertName(Unknown Source)
at server1.Client.example(Client.java:156)
at server1.Client.main(Client.java:168)
Caused by: java.lang.NullPointerException:
Start server side stack trace:
java.lang.NullPointerException
at server1.ConnectBean.insertName(ConnectBean.java:133)
at server1.ConnectBean_wtb7ta_EOImpl.insertName(ConnectBean_wtb7ta_EOIm
pl.java:45)
at server1.ConnectBean_wtb7ta_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)

at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServer
Ref.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:785)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.ja
va:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteReques
t.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace

Rob Woollen

unread,
Apr 18, 2003, 6:07:07 PM4/18/03
to
That looks like a NullPointerException in your code. You'd have to show
us line 133 of ConnectBean if you need help debugging it.

-- Rob

Ramya

unread,
Apr 20, 2003, 3:46:52 PM4/20/03
to

Hi Rob,
Thanks for your relpy. Below is the method which calls methods from the EJB2.


public void insertName(String name) throws Exception {
Connection con = null;
String name2="raj";
int num=30;

PreparedStatement ps = null;
CallableStatement cs=null;

String fName=null;
try {
System.out.println("In the insertName() before calling this.lookup()");
this.lookUp();
System.out.println("In the insertName() after calling this.lookup()");
con=mInsert.getConnection();
System.out.println("Inside the InsertName() in connectbean the value
of connect is"+con);
ps = con.prepareStatement("Insert into My_info values (?,?,?) ");
ps.setString(1, name);
ps.setString(2, "RamyaRAJ");
ps.setInt(3,30);

if (!(ps.executeUpdate() > 0)) {
String error = "insertName: MyInfoBean (" + fName + ") not updated";
throw new NoSuchEntityException (error);
}
else{
System.out.println("After calling execute upadte");
}
} catch(Exception e) {
System.out.println("There is an SQL insert exception in insertName()
method");
e.printStackTrace();
throw new EJBException (e);
} finally {
mInsert.cleanup(con, ps);//LINE NO 133
}
}

Line 133 (mInsert.cleanup(con, ps);) is the call to close up the SQL connection
that is from EJB2. mInsert is the member variable of the Remote class from EJB2.

Thanks,
Ramya.

Rob Woollen

unread,
Apr 21, 2003, 8:17:53 PM4/21/03
to
So it looks like mInsert is null causing the NPE. I think you'll have
to debug this one.

-- Rob

0 new messages