Re: InjectSpring and NullPointerException

2007-04-26 Thread mateamargo



Alejandro Scandroli wrote:
> 
> Hi Matecito ;-)
> 
> I'm using Tapestry 4.0.2, but @InjectSpring and @InjectObject
> annotations are not from Tapestry 4.0.2 core, they are from
> tapestry-spring module.
> Anyway, if when you change something you get a bean error it means
> that the problem is in other place. Are you sure that the NPE isn't
> happening inside PersonDAO?
> 
> Alejandro.
> 

Hi Ale, I have finally solved this by upgrading from 4.0.2 to 4.1 and that
was the only change.
I'm wondering if this is mentioned somewhere.

Thanks y gracias.
-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10204553
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-26 Thread Alejandro Scandroli

Hi Matecito ;-)

I'm using Tapestry 4.0.2, but @InjectSpring and @InjectObject
annotations are not from Tapestry 4.0.2 core, they are from
tapestry-spring module.
Anyway, if when you change something you get a bean error it means
that the problem is in other place. Are you sure that the NPE isn't
happening inside PersonDAO?

Alejandro.

On 4/26/07, Alex Fishlock <[EMAIL PROTECTED]> wrote:

I am T5 sorry

-Original Message-
From: mateamargo [mailto:[EMAIL PROTECTED]
Sent: 25 April 2007 19:16
To: users@tapestry.apache.org
Subject: Re: InjectSpring and NullPointerException



Alex Fishlock wrote:
>
> I use this with good results:
>
> @Inject("spring:somebean")
> private SomeBean somebean;
>

Without getter or setter?
Are you using a .page file for each class?
--
View this message in context:
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html
#a10186539
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: InjectSpring and NullPointerException

2007-04-26 Thread Alex Fishlock
I am T5 sorry

-Original Message-
From: mateamargo [mailto:[EMAIL PROTECTED] 
Sent: 25 April 2007 19:16
To: users@tapestry.apache.org
Subject: Re: InjectSpring and NullPointerException



Alex Fishlock wrote:
> 
> I use this with good results:
> 
> @Inject("spring:somebean")
> private SomeBean somebean;
> 

Without getter or setter?
Are you using a .page file for each class?
-- 
View this message in context:
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html
#a10186539
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread mateamargo



Alejandro Scandroli wrote:
> 
> I have no clue.
> Are you sure your spring context is ok? and is getting loaded?
> Have you tried with @InjectObject("spring:personDAObean")?
> Dough it should produce the same result
> 
> 

I know that it is loading fine because if I change something I get a bean
error.
I can't find the annotation @InjectObject, I guess is because I'm using
Tapestry 4.0.2.

Which version are you using?
-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10190301
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread Alejandro Scandroli

I have no clue.
Are you sure your spring context is ok? and is getting loaded?
Have you tried with @InjectObject("spring:personDAObean")?
Dough it should produce the same result


On 4/25/07, mateamargo <[EMAIL PROTECTED]> wrote:




Alejandro Scandroli wrote:
>
> Hi MateAmargo
>
> just remove the property from the page definition
> let the ".page" empty
> 
> 
>
>
> Saludos.
> Alejandro.
>

Hi Alejandro, I have just removed the property and now I'm trying to run
Jetty...
Nope, the same problem. I don't know why I get a NullPointerException.

The object PersonDAO is a subclass of HibernateDAOSupport, and I don't know
if it keeps null because a bad configuration or what.
--
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10189304
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread mateamargo



Alejandro Scandroli wrote:
> 
> Hi MateAmargo
> 
> just remove the property from the page definition
> let the ".page" empty
> 
> 
> 
> 
> Saludos.
> Alejandro.
> 

Hi Alejandro, I have just removed the property and now I'm trying to run
Jetty...
Nope, the same problem. I don't know why I get a NullPointerException.

The object PersonDAO is a subclass of HibernateDAOSupport, and I don't know
if it keeps null because a bad configuration or what.
-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10189304
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread Alejandro Scandroli

Hi MateAmargo

just remove the property from the page definition
let the ".page" empty




Saludos.
Alejandro.


On 4/25/07, mateamargo <[EMAIL PROTECTED]> wrote:




Jessek wrote:
>
> Where are you getting that local member from ? You can't have anything
> injected and used as a local member because the method you add the
> annotation to will likely be replaced...So if you've been trying to set a
> member and seeing it null that's why - it's not actually using your method
> to inject it.
>

I just typed by memory, in fact it is:

public List getPersons(){
 return getPersonDAO().getAll();
}

@InjectSpring("personDAObean")
public abstract PersonDAO getPersonDAO();


I have added a .page file for this class with this:



http://tapestry.apache.org/dtd/Tapestry_4_0.dtd";>



    


--
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10187850
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread Jesse Kuhnert

Where are you getting that local member from ? You can't have anything
injected and used as a local member because the method you add the
annotation to will likely be replaced...So if you've been trying to set a
member and seeing it null that's why - it's not actually using your method
to inject it.

On 4/25/07, mateamargo <[EMAIL PROTECTED]> wrote:



public List getPersons(){
return PersonDAO.getAll();
}

This is because PersonDAO is null, and this is what I need to be injected
by
Spring.
--
View this message in context:
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10187525
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com


Re: InjectSpring and NullPointerException

2007-04-25 Thread mateamargo



Santiago Fernández wrote:
> 
> Yes, you need a .page file, like every tapestry page. Or set the property
> "
> org.apache.tapestry.page-class-packages" in .application file.
> 
> Browse into the example:
> http://www.google.com/codesearch?hl=en&q=show:W7d5X-mFWSg:dORw9TpfYA4:F3TWNBX8eZ4&sa=N&ct=rd&cs_p=http://howardlewisship.com/downloads/tapestry-javaforge/tapestry-spring-1.0.0-src.zip&cs_f=tapestry-spring-1.0.0/src/test/webapp/WEB-INF/app.application
> 

I have used other classes without a .page file without problems.
But this I need a property to be injected by Spring and I'm not able to do
it.

The exception says that cannont read the "persons" OGNL:



The method getPersons:

public List getPersons(){
return PersonDAO.getAll();
}

This is because PersonDAO is null, and this is what I need to be injected by
Spring.
-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10187525
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread mateamargo



Jessek wrote:
> 
> Where are you getting that local member from ? You can't have anything
> injected and used as a local member because the method you add the
> annotation to will likely be replaced...So if you've been trying to set a
> member and seeing it null that's why - it's not actually using your method
> to inject it.
> 

I just typed by memory, in fact it is:

public List getPersons(){
 return getPersonDAO().getAll();
}

@InjectSpring("personDAObean")
public abstract PersonDAO getPersonDAO();


I have added a .page file for this class with this:



http://tapestry.apache.org/dtd/Tapestry_4_0.dtd";>






-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10187850
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread Santiago Fernández

Yes, you need a .page file, like every tapestry page. Or set the property "
org.apache.tapestry.page-class-packages" in .application file.

Browse into the example:
http://www.google.com/codesearch?hl=en&q=show:W7d5X-mFWSg:dORw9TpfYA4:F3TWNBX8eZ4&sa=N&ct=rd&cs_p=http://howardlewisship.com/downloads/tapestry-javaforge/tapestry-spring-1.0.0-src.zip&cs_f=tapestry-spring-1.0.0/src/test/webapp/WEB-INF/app.application


2007/4/25, mateamargo <[EMAIL PROTECTED]>:





Santiago Fernández wrote:
>
> This code works for me:
>
> public abstract class Home extends BasePage
> {
>
> ...
> @InjectSpring("someBean")
> public abstract SomeBean getSomeBean();
> ...
>
> Check this code:
> 
http://www.google.com/codesearch?hl=en&q=+doc:9AU8EeUPIqc+%40InjectSpring%5C(+show:9AU8EeUPIqc:RIIGoLvmuBc:IOb23uxRU70&sa=N&cd=3&ct=ri&cs_p=http://howardlewisship.com/downloads/tapestry-javaforge/tapestry-spring-1.0.0-src.zip&cs_f=tapestry-spring-1.0.0/src/test/java/com/javaforge/tapestry/spring/pages/Home.java#a0

>
> Saludos
>
>

But are you specifiying a .page file for that class?
--
View this message in context:
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10186909
Sent from the Tapestry - User mailing list archive at 
Nabble.com<http://nabble.com/>
.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: InjectSpring and NullPointerException

2007-04-25 Thread mateamargo


Alex Fishlock wrote:
> 
> I use this with good results:
> 
> @Inject("spring:somebean")
> private SomeBean somebean;
> 

Without getter or setter?
Are you using a .page file for each class?
-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10186539
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread Santiago Fernández

Hi, mateamargo. The getter

@InjectSpring("somebean")
public abstract SomeBean getSomething();

works fine... but be careful when you call getSomething()... if you call
this getter inside an "initialize()" method, you will get an exception,
because the property isn't injected yet... You must invoque this
property from a listener, or PageAttachListener.pageAttached()..

Saludos desde Argentina :-)


2007/4/25, mateamargo <[EMAIL PROTECTED]>:



I don't know if this should be asked here or in the SpringFramework forum.
I have a bean defined and I need to inject it into a property inside a
class
that extends BasePage.

But when I read this property I get a NullPointerException.

Before that, I have tried without providing an implementation for that
setter (leaving it asbtract), but Tapestry complains.

So, what is the right thing to do?

@InjectSpring("somebean")
public abstract void SetSomething();

or

@InjectSpring("somebean")
public void SetSomething(SomeObject so){
   this.so = so;
}

Thanks.
--
View this message in context:
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10185808
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: InjectSpring and NullPointerException

2007-04-25 Thread Alex Fishlock
I use this with good results:

@Inject("spring:somebean")
private SomeBean somebean;


- Original Message -
From: "mateamargo" <[EMAIL PROTECTED]>
To: users@tapestry.apache.org
Sent: 25 April 2007 18:35:21 o'clock (GMT) Europe/London
Subject: InjectSpring and NullPointerException


I don't know if this should be asked here or in the SpringFramework forum.
I have a bean defined and I need to inject it into a property inside a class
that extends BasePage.

But when I read this property I get a NullPointerException.

Before that, I have tried without providing an implementation for that
setter (leaving it asbtract), but Tapestry complains.

So, what is the right thing to do?

@InjectSpring("somebean")
public abstract void SetSomething();

or

@InjectSpring("somebean")
public void SetSomething(SomeObject so){
this.so = so;
}

Thanks.
-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10185808
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread mateamargo



Santiago Fernández wrote:
> 
> This code works for me:
> 
> public abstract class Home extends BasePage
> {
> 
> ...
> @InjectSpring("someBean")
> public abstract SomeBean getSomeBean();
> ...
> 
> Check this code:
> http://www.google.com/codesearch?hl=en&q=+doc:9AU8EeUPIqc+%40InjectSpring%5C(+show:9AU8EeUPIqc:RIIGoLvmuBc:IOb23uxRU70&sa=N&cd=3&ct=ri&cs_p=http://howardlewisship.com/downloads/tapestry-javaforge/tapestry-spring-1.0.0-src.zip&cs_f=tapestry-spring-1.0.0/src/test/java/com/javaforge/tapestry/spring/pages/Home.java#a0
> 
> Saludos
> 
> 

But are you specifiying a .page file for that class?
-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10186909
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: InjectSpring and NullPointerException

2007-04-25 Thread Santiago Fernández

This code works for me:

public abstract class Home extends BasePage
{

   ...
   @InjectSpring("someBean")
   public abstract SomeBean getSomeBean();
   ...

Check this code:
http://www.google.com/codesearch?hl=en&q=+doc:9AU8EeUPIqc+%40InjectSpring%5C(+show:9AU8EeUPIqc:RIIGoLvmuBc:IOb23uxRU70&sa=N&cd=3&ct=ri&cs_p=http://howardlewisship.com/downloads/tapestry-javaforge/tapestry-spring-1.0.0-src.zip&cs_f=tapestry-spring-1.0.0/src/test/java/com/javaforge/tapestry/spring/pages/Home.java#a0

Saludos


2007/4/25, mateamargo <[EMAIL PROTECTED]>:





Santiago Fernández wrote:
>
> Hi, mateamargo. The getter
>
> @InjectSpring("somebean")
> public abstract SomeBean getSomething();
>
> works fine... but be careful when you call getSomething()... if you call
> this getter inside an "initialize()" method, you will get an exception,
> because the property isn't injected yet... You must invoque this
> property from a listener, or PageAttachListener.pageAttached()..
>
> Saludos desde Argentina :-)
>
>

Ok, but If use an abstract method Tapestry complains saying that the
method
hasn't an implementation.

Saludos che.
--
View this message in context:
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10186596
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: InjectSpring and NullPointerException

2007-04-25 Thread mateamargo



Santiago Fernández wrote:
> 
> Hi, mateamargo. The getter
> 
> @InjectSpring("somebean")
> public abstract SomeBean getSomething();
> 
> works fine... but be careful when you call getSomething()... if you call
> this getter inside an "initialize()" method, you will get an exception,
> because the property isn't injected yet... You must invoque this
> property from a listener, or PageAttachListener.pageAttached()..
> 
> Saludos desde Argentina :-)
> 
> 

Ok, but If use an abstract method Tapestry complains saying that the method
hasn't an implementation.

Saludos che.
-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10186596
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



InjectSpring and NullPointerException

2007-04-25 Thread mateamargo

I don't know if this should be asked here or in the SpringFramework forum.
I have a bean defined and I need to inject it into a property inside a class
that extends BasePage.

But when I read this property I get a NullPointerException.

Before that, I have tried without providing an implementation for that
setter (leaving it asbtract), but Tapestry complains.

So, what is the right thing to do?

@InjectSpring("somebean")
public abstract void SetSomething();

or

@InjectSpring("somebean")
public void SetSomething(SomeObject so){
this.so = so;
}

Thanks.
-- 
View this message in context: 
http://www.nabble.com/InjectSpring-and-NullPointerException-tf3646961.html#a10185808
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]