• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Very Strange Error with Mapping. Please help

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I'm getting a really strange error with Struts.

My application runs under jBoss and I'm using Hibernate, Struts and SpringFramework.

Turns that when I try to save an object (not anyone, a specific one) the mapping does no occur and when the page expires, I get this error:

21:24:35,929 INFO [SessionFactoryImpl] closing
21:24:36,090 ERROR [[action]] Servlet.service() for servlet action threw exception
java.lang.NullPointerException
at org.apache.struts.action.RequestProcessor.getInternal(RequestProcessor.java:1106)
at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)


I tried changing the struts-config mapping, but result in nothing.

Can anybody help me?

Thank you!
 
alice azevedo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To help I'm posting my struts-config with the mapping that fails:

<action path="/saveEvent" name="eventForm" scope="request"
type="actions.EventAction" parameter="save">
<forward name="success" path="/inicial.do"/>
<forward name="error" path="message?showMessage=error">
</action>

The DAO class:
public class EventDAOImpl extends HibernateDaoSupport implements EventDAO
{
public void save(Event event)
{
getHibernateTemplate().saveOrUpdate(event);
}

}


Well the page expires after I call the method to save the Event object at my action class:

public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) throws ParseException
{
Event event = (Event) req.getSession().getAttribute("event");

if (event == null)
return mapping.findForward("error");


EventDAO eventDao = (EventDAO) getWebApplicationContext().getBean(Constants.EVENT_DAO);
eventDao.save(event);

return mapping.findForward(Constants.MAPPING_SUCCESS);
}


When I'm debuging, when the save is made, I dont know why, the thread doesnt ge to the return line. So when the page expires the exception is thrown.

Please, anybody can help me?
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sure sounds like it is an issue in your Hibernate layer. I do not have any Hibernate experience, so I cannot help much there. Have you tried setting a break point in your save method? What if you surrounded your call to saveOrUpdate with a "try / catch(Throwable t)" block to see if Hibernate is throwing a meaningful exception. Is Hibernate throwing the NullPointerException?

I am not sure what you mean when you say "the mapping does no(t) occur" and "the page expires".

- Brent
 
alice azevedo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Brent.
Thanks for replying.

I tried to set a breakpoint in the save method. The object is saved normally.
And even with the try/catch, no throwable object is thrown.

What I meant with "the mapping does not occur" is that the hibernate save method is done,
and the next line is the struts mapping return but the thread does not get there, and the
page gets no answer, so when the page expires, that exception is thrown.

I hope I was clear.

Thanks!
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No real ideas. I don't have experience with Spring. Does the call to getBean directly instantiate your bean class, or does Spring create a wrapper around your class?

Have you tried downloading the Struts source code for the version you are using and looking at line 1106 in RequestProcessor.java? Are you using log4j? A couple times I have tracked down tricky Struts issues by cranking the logging level to debug. I don't remember the exact log4j.properties entry...something like this:

log4j.logger.org.apache.struts=DEBUG

- Brent
 
alice azevedo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Brent!

One thing that really looks strange to me, is that I have similar daos and actions that do the same that I'm trying to do with this particular [Event] object.

I have downloaded the struts source code and it wasnt helpful.

I'll take your advice on log4j and struts.

Thanks for the help!

- Alice
 
alice azevedo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some news!

Seems that something is wrong with the database!
I got the exception: Pool not open

I'm not sure about what it means.
I'm using MySQL.

Can someone help me with that?

Thanks!
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic