Can't connect to entity beans some time after deployment.

Discussions

EJB programming & troubleshooting: Can't connect to entity beans some time after deployment.

  1. hi,

    I am facing this strange problem. I am developing a Learning Management System. Once I deploy the app it works profectly fine. It calls all the session and ejb beans perfectly.

    I am using the sun one 7 PE and J2EE 1.3. After the product has been deployed for a couple of hours, and i re run the application, it gives a null pointer exception. The session bean cannot connect to the entity bean.

    I am using mysql as db and have a pool defined.

    Is there a connection time-out problem or some problem with the entity bean, because the session beans work fine even days after deployment, but entity bean stop functioning in a couple of hours.

    Some help needed !

    Threaded Messages (6)

  2. Check you logs[ Go to top ]

    Look for OutOfMemory or other errors.

    Mike
  3. looked for it. no such errors. i wonder what is happening. can there be some problem in the way the ejb is created. i have the db connection in the ejbcreate, disconnect in ejbremove and general loadrow and storerow methods.
  4. some other suggestions[ Go to top ]

    I would look into:
    - pool size for db connections. There should be at least as many at the DB side as max connections in the app server. You should get something else then null if the pool is well coded though.
    - cache size for entity beans. Are beans released when not used? Are there referenced entity beans in sessions beans?

    Some questions:
    - is it always failing the second time or after a couple of hours no matter how many times it has been used?
    - is it failing when using the same entity or is it some number of entity beans that has been exceeded?

    It would be informative with the stack from NullPointerException.
  5. looked for it. no such errors. i wonder what is happening. can there be some problem in the way the ejb is created. i have the db connection in the ejbcreate, disconnect in ejbremove and general loadrow and storerow methods.
    Are you saying you cache your db connection in ejbCreate and disconnect in ejbRemove. That sounds very wrong. If you are using BMP. The only thing you should cache and not in ejbCreate, but in ejbActivate is the DataSource.

    In any method you perform SQL in the bean have the method get the connection and release it by closing it after the sql is executed. The db connection should not span multiple lifecycle calls
  6. here is the stack trace.[ Go to top ]

    The application always stops working after a couple of hours of deployment.
    Whenever I start the appserver and deploy a fresh copy it works perfectly fine.

    I used the j2ee application verifier, it fails some tests, especially related to findbyprimarykey. can it be because of improperly implemented findByPrimaryKey methods.

    We have now modules developed by two different teams, we have integrated them, but the problem persists with the new merged application also.

    Checked the connection pool and other time out. seems to be ok.

    Here is the stack trace.

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException
    org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:284)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:200)


    root cause

    java.lang.NullPointerException
    com.ssnsase.elysian.SystemManagement.UserSystemManager.getUsers(UserSystemManager.java:49)
    com.ssnsase.elysian.actions.ManageuserAction.execute(ManageuserAction.java:49)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:284)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:200)
  7. more questions[ Go to top ]

    More questions:
    -What happens at line 49 in com.ssnsase.elysian.SystemManagement.UserSystemManager ? Seems that you try to send a message to a null object.
    - Is UserSystemManager the session bean?
    - Do you run Struts and EJBs in the same app server? Or is the Exception propagated from an EJB server. In that case it would be interesting to see a stack from the EJB server as well since the null pointer may be caused by something entirely different.