You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chris Pat <cp...@yahoo.com> on 2005/11/23 17:48:55 UTC
odd return error
Hello
In my Action I am creating an object and storing it in
a db. It works fine. The next line I then call a
method on the object, does some lookups printoutsa
proof that it is working and then on the return gets
this message:
java.lang.NullPointerException
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:372)
It is a boolean method that just returns a computed
boolean value that I have a println proving that the
falue is false. I have upgraded to 5.5.12 and the
latest 1.2.8 struts. Can anyone provide any insight?
Thank you.
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: odd return error
Posted by James Mitchell <jm...@apache.org>.
5.5.12 of what?
--
James Mitchell
Software Engineer / Open Source Evangelist
Consulting / Mentoring / Freelance
EdgeTech, Inc.
http://www.edgetechservices.net/
678.910.8017
AIM: jmitchtx
MSN: jmitchell@apache.org
Skype: jmitchtx
----- Original Message -----
From: "Chris Pat" <cp...@yahoo.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, November 23, 2005 11:48 AM
Subject: odd return error
> Hello
> In my Action I am creating an object and storing it in
> a db. It works fine. The next line I then call a
> method on the object, does some lookups printoutsa
> proof that it is working and then on the return gets
> this message:
>
> java.lang.NullPointerException
> org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:372)
>
> It is a boolean method that just returns a computed
> boolean value that I have a println proving that the
> falue is false. I have upgraded to 5.5.12 and the
> latest 1.2.8 struts. Can anyone provide any insight?
> Thank you.
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: odd return error
Posted by Borislav Sabev <b....@eventsoft.de>.
Chris Pat wrote:
>Hi Dave
>Okay the code is below. What I am doing is creating
>sampleRequest from the action, then calling isAllowed.
> The sampleRequest is being successfully made and
>persisted in the db. The isAlowed is failing. I got
>both working from fine from the command line. I am a
>relative struts newbie and this is the first time I am
>trying this type of coding under Tomcat 5.5.12.
>Thanks for your attention and any comments.
>
>public class sampleRequest
> implements InstanceCallbacks {
>
> private String fromHere;
> private Date atThisTime;
> private String thisMP3;
> private String thisSession;
> private String type;
>
> public sampleRequest() {
> }
>
> public sampleRequest(String remoteAddr, Date
>dateTime, String thisMP3,
> String thisSession, String
>type, PersistenceManager pm) {
>
>/**
> PersistenceManagerFactory pmf =
>KodoHelper.getPersistenceManagerFactory(
> "kodo.properties");
> PersistenceManager pm =
>pmf.getPersistenceManager();
>
>**/
> String db =
>pm.getPersistenceManagerFactory().getConnectionURL();
> System.out.println("the database= " + db);
> this.fromHere = remoteAddr;
> this.atThisTime = dateTime;
> this.thisMP3 = thisMP3;
> this.thisSession = thisSession;
> this.type=type;
> pm.currentTransaction().begin();
> pm.makePersistent(this);
> pm.currentTransaction().commit();
> //pm.close();
>}
>
> public boolean isAllowed(int
>samples,PersistenceManager pm) {
> //051112 cp could be very dangerous on the issue
>of closing the pm.
> //051112 cp for production really the same issues,
>just getting it from the TC plugin.
> //051120 cp question if I can really use the same
>pm. cant get a new one.
> //051121 cp i am assuming the pm will "stay" with
>the object. this could be dangerous.
>/**
> PersistenceManagerFactory pmf =
>KodoHelper.getPersistenceManagerFactory("kodo.properties");
> PersistenceManager pm =
>pmf.getPersistenceManager();
> **/
>
> KodoQuery q = (KodoQuery)
>pm.newQuery(filesDM.helper.sampleRequest.class,"thisSession==thisSession
>& thisSession!=null");
> q.setResult("count(this)");
> Long count = (Long) q.execute();
> System.out.println("from isAllowed count= " +
>count);
> q.close(count);
> pm.close();
> boolean
>returnValue=(samples<count.intValue()?false:true);
> System.out.println("samples < count.intValue())?
>false : true "+returnValue);
> return returnValue;
> }
>}
>
>
>
Is hte string printed out properly - do you see it in out stream? can
you submit some code that actually calls this isAllowed() method.
I'll suggest you simple test - comment all the code in this method and
just return true - then you can understand where this
NullPointerException comes from. if everything is fine, then it ocurs in
this method and Struts doesn't have anything to do with the problem.
Borislav
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: odd return error
Posted by Chris Pat <cp...@yahoo.com>.
Hi Dave
The problem is happening when I return from isAllowed.
This is just a helper class that the action is
calling. I just ass-umed that it would return to the
action called it on the stack. But now that you flag
it I barely see that there might be some trouble with
multiple instances and a pool of these sampleRequest.
Is there a special forward that needs to be setup for
these type of helper classes to return properly? I
never would have expected that.
--- Dave Newton <ne...@pingsite.com> wrote:
> Chris Pat wrote:
>
> >Okay the code is below. What I am doing is
> creating
> >sampleRequest from the action, then calling
> isAllowed.
> > The sampleRequest is being successfully made and
> >persisted in the db. The isAlowed is failing. I
> got
> >both working from fine from the command line. I am
> a
> >relative struts newbie and this is the first time I
> am
> >trying this type of coding under Tomcat 5.5.12.
> >Thanks for your attention and any comments.
> >
> >
> I don't see anything Struts-related here.
>
> What makes you think isAllowed is failing? Looks
> more like a
> poorly-configured struts action, forward, or
> something like that.
>
> Dave
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
>
>
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: odd return error
Posted by Dave Newton <ne...@pingsite.com>.
Chris Pat wrote:
>Okay the code is below. What I am doing is creating
>sampleRequest from the action, then calling isAllowed.
> The sampleRequest is being successfully made and
>persisted in the db. The isAlowed is failing. I got
>both working from fine from the command line. I am a
>relative struts newbie and this is the first time I am
>trying this type of coding under Tomcat 5.5.12.
>Thanks for your attention and any comments.
>
>
I don't see anything Struts-related here.
What makes you think isAllowed is failing? Looks more like a
poorly-configured struts action, forward, or something like that.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: odd return error
Posted by Chris Pat <cp...@yahoo.com>.
Hi Dave
Okay the code is below. What I am doing is creating
sampleRequest from the action, then calling isAllowed.
The sampleRequest is being successfully made and
persisted in the db. The isAlowed is failing. I got
both working from fine from the command line. I am a
relative struts newbie and this is the first time I am
trying this type of coding under Tomcat 5.5.12.
Thanks for your attention and any comments.
public class sampleRequest
implements InstanceCallbacks {
private String fromHere;
private Date atThisTime;
private String thisMP3;
private String thisSession;
private String type;
public sampleRequest() {
}
public sampleRequest(String remoteAddr, Date
dateTime, String thisMP3,
String thisSession, String
type, PersistenceManager pm) {
/**
PersistenceManagerFactory pmf =
KodoHelper.getPersistenceManagerFactory(
"kodo.properties");
PersistenceManager pm =
pmf.getPersistenceManager();
**/
String db =
pm.getPersistenceManagerFactory().getConnectionURL();
System.out.println("the database= " + db);
this.fromHere = remoteAddr;
this.atThisTime = dateTime;
this.thisMP3 = thisMP3;
this.thisSession = thisSession;
this.type=type;
pm.currentTransaction().begin();
pm.makePersistent(this);
pm.currentTransaction().commit();
//pm.close();
}
public boolean isAllowed(int
samples,PersistenceManager pm) {
//051112 cp could be very dangerous on the issue
of closing the pm.
//051112 cp for production really the same issues,
just getting it from the TC plugin.
//051120 cp question if I can really use the same
pm. cant get a new one.
//051121 cp i am assuming the pm will "stay" with
the object. this could be dangerous.
/**
PersistenceManagerFactory pmf =
KodoHelper.getPersistenceManagerFactory("kodo.properties");
PersistenceManager pm =
pmf.getPersistenceManager();
**/
KodoQuery q = (KodoQuery)
pm.newQuery(filesDM.helper.sampleRequest.class,"thisSession==thisSession
& thisSession!=null");
q.setResult("count(this)");
Long count = (Long) q.execute();
System.out.println("from isAllowed count= " +
count);
q.close(count);
pm.close();
boolean
returnValue=(samples<count.intValue()?false:true);
System.out.println("samples < count.intValue())?
false : true "+returnValue);
return returnValue;
}
}
--- Dave Newton <ne...@pingsite.com> wrote:
> Chris Pat wrote:
>
> >Can anyone provide any insight?
> >
> >
> Not too much without information (code, configs,
> ...)
>
> Dave
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
>
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: odd return error
Posted by Dave Newton <ne...@pingsite.com>.
Chris Pat wrote:
>Can anyone provide any insight?
>
>
Not too much without information (code, configs, ...)
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org