• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

java.rmi.RemoteException: NullPointerException

Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am new in EJB. Trying to run a client application which uses EJB 2.0 with Stateless session bean and WebLogic 7.0 application server. Codes are written using JDK 1.3.1.

Here's part of my client code showing the method where the Bean is been created and it's method been called -

public void callClient(String[] args) {

// Initializing variable with the argument value
int intMaxAttempts = Integer.parseInt(args[0]);

try {
// Create the client's context object
mContext = getInitialContext();
LOG.debug("Context created");
System.out.println("Context created");
// Find the Bean's home interface
LogConnStatApiHome mLogConnStatApiHome = (LogConnStatApiHome) mContex
LOG.debug("Home interface found");
System.out.println("Home interface found");
// Create the Bean
mLogConnStatApiRemote = mLogConnStatApiHome.create();
LOG.debug("Bean created");
// Now execute the method from the Bean
System.out.println("Now calling mLogConnStatApiRemote.logConnStat(" +
intMaxAttempts + ")");
mLogConnStatApiRemote.logConnStat(intMaxAttempts); } catch (RemoteException re) {

LOG.error("Remote Exception:", re);
System.out.println("Remote Exception: " + re);

} catch (NamingException ne) {
LOG.error("Naming Exception: ", ne);
System.out.println("Naming Exception: " + ne);
} catch (Exception e) {
LOG.error("Exception: ", e);
System.out.println("Exception: " + e);
LOG.debug("connectToBean ended"); /*

} // callClient()

* Main method
public static void main(String[] args) {
LOG.debug("Starting the main()");
LOG.info("creating LogConnStatApiClient object");
// Invoking the constructor
LogConnStatApiClient logConnStatApiClient = new LogConnStatApiClient();
LOG.info("LogConnStatApiClient object method callclient is executed");
LOG.info("main ended");


It seems to be failing at statement -

Here's the other EJB codes -


import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;

public interface LogConnStatApiHome extends EJBHome {

public LogConnStatApiRemote create() throws CreateException, RemoteException


import javax.ejb.*;
import java.rmi.RemoteException;
import com.sbcld.tldapi.common.exception.*;

public interface LogConnStatApiRemote extends EJBObject {

public void logConnStat(int intMaxAttempts) throws RemoteException;


public class LogConnStatApiBean implements SessionBean {

public void ejbCreate()throws RemoteException {
LOG.info("CheckDbConnApiBean.ejbCreate Invoked");

public void ejbActivate() throws RemoteException {
LOG.info("CheckDbConnApiBean.ejbActivate Invoked");

public void ejbRemove() throws RemoteException {
LOG.info("CheckDbConnApiBean.ejbRemove Invoked");
public void ejbPassivate()throws RemoteException {
LOG.info("CheckDbConnApiBean.ejbPassivate Invoked");

public void setSessionContext(SessionContext ctx) throws RemoteException {//
public void logConnStat(int intMaxAttempts) throws RemoteException, Client
Exception {
public void logConnStat(int intMaxAttempts) {
try {
// Call the API constructor that would call the DBHelper
// constructor which to do the database connection
LogConnStatApi logConnStatApi = new LogConnStatApi(intMaxAttempts); // Seems to be failing here
// Now call the method of the API to carry out a simple
// SQL query
try {


} catch (SQLException sqlEx1) {

LOG.debug("Exception in executing the SQL query");



Here's the log output with the error -

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

Start server side stack trace:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
at java.lang.String.<init>(String.java:455)
at com.sbcld.tldapi.util.cfg.Encryption.decryptAsString(Encryption.java:
at com.sbcld.tldapi.db.DBHelper.dbConnect(DBHelper.java:150)
at com.sbcld.tldapi.db.DBHelper.<init>(DBHelper.java:92)
at com.sbcld.tldapi.macro.logconnstat.LogConnStatApi.<init>(LogConnStatA
at com.sbcld.tldapi.ejb.logconnstatapi.LogConnStatApiBean.logConnStat(Lo
at com.sbcld.tldapi.ejb.logconnstatapi.LogConnStatApiBean_7g5yxl_EOImpl.
at com.sbcld.tldapi.ejb.logconnstatapi.LogConnStatApiBean_7g5yxl_EOImpl_
WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace

I am running the client app through a shell script passing an integer value as an argument.
I am new EJB. Also, want to mention I am using other classes for getting the JNDI naming and database connectivity etc. Can't figure out what could be the reason this application is failing -
java.rmi.RemoteException: EJB Exception: ; nested exception is:

Really would appreciate if I can get any idea, lead in troubleshooting this problem.

Thanking you all!
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This has nothing to do with the EJB technology. There is a nullpointer in your code. Check the line com.sbcld.tldapi.util.cfg.Encryption.decryptAsString(Encryption.java:
229) and check the imput that you are providing to it.
Tariq Ahsan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Amit!

I had the same hunch based on the error message outputs. I am new to EJB.But was trying to check for some reason it could have been an EJB related issue. I will now focus my troubleshooting in the area you mentioned.

Appreciated for your reply.
My, my, aren't you a big fella. Here, have a tiny ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic