Re: Help with Spring JDBC

2011-03-31 Thread Maurizio Cucchiara
Have you defined a bean for the struts action class inside your
applicationContext.xml? Did it include your dao property?

On 30 March 2011 20:12, alxer  wrote:
> Hello,
> I am developing a web application with EclipseIDE and I am using the Struts2
> and Spring3 frameworks.
> I am trying to configure the web application acces to my MySQL database.
> I am inexperienced with the configuration of these frameworks so I would
> like someone to give me a help, I'm sure it is not very complicate but I
> can't find what I am doing wrong.
>
> I have configured the web.xml with the listeners ContextLoaderListener and
> RequestContextListener and also set the contextConfigLocation
> (applicationContext.xml).
>
> In the applicationContext.xml:
> - I have set the dataSource bean (driverClassName, url, username and
> password).
> - Defined one applicationDAO bean class (it extends SimpleJdbcDaoSupport)
> with a property that references the dataSource bean.
> - And another bean that represents the main action with a property that
> references the applicationDAO bean.
>
> In the applicationDAO implementation I have implement some methods that
> acces the MySQL database, but I have not defined any dataSource object and
> either any dataSource settler because I'm pretty sure that it inherits the
> dataSource settler method from SimpleJdbcDaoSupport (I am extending this
> class).
>
> In the main action I have defined an object that represents the
> applicationDAO and also its settler.
>
> The problem is that when I debug the application, in the point of the main
> action that I have to use the applicationDAO object methods, it is null, so
> I get a NullPointerException.
>
> I don't know what I am missing to configure to be able to use the
> applicationDAO methods from the main action. I would be very very grateful
> to get some help.
>
> If you want I can post the code of these files.
>
> Thank you very much,
> alxer
>
> --
> View this message in context: 
> http://struts.1045723.n5.nabble.com/Help-with-Spring-JDBC-tp4272010p4272010.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
Maurizio Cucchiara

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Help with Spring JDBC

2011-03-31 Thread Ty Connell
Low hanging fruit comment:  virtually 100% of the time I get a NPE when
using spring, it's because I'm instantiating objects with "new" instead of
letting the app context get the object for me (either explicitly or via
injection).

On Wed, Mar 30, 2011 at 2:12 PM, alxer  wrote:

> Hello,
> I am developing a web application with EclipseIDE and I am using the
> Struts2
> and Spring3 frameworks.
> I am trying to configure the web application acces to my MySQL database.
> I am inexperienced with the configuration of these frameworks so I would
> like someone to give me a help, I'm sure it is not very complicate but I
> can't find what I am doing wrong.
>
> I have configured the web.xml with the listeners ContextLoaderListener and
> RequestContextListener and also set the contextConfigLocation
> (applicationContext.xml).
>
> In the applicationContext.xml:
> - I have set the dataSource bean (driverClassName, url, username and
> password).
> - Defined one applicationDAO bean class (it extends SimpleJdbcDaoSupport)
> with a property that references the dataSource bean.
> - And another bean that represents the main action with a property that
> references the applicationDAO bean.
>
> In the applicationDAO implementation I have implement some methods that
> acces the MySQL database, but I have not defined any dataSource object and
> either any dataSource settler because I'm pretty sure that it inherits the
> dataSource settler method from SimpleJdbcDaoSupport (I am extending this
> class).
>
> In the main action I have defined an object that represents the
> applicationDAO and also its settler.
>
> The problem is that when I debug the application, in the point of the main
> action that I have to use the applicationDAO object methods, it is null, so
> I get a NullPointerException.
>
> I don't know what I am missing to configure to be able to use the
> applicationDAO methods from the main action. I would be very very grateful
> to get some help.
>
> If you want I can post the code of these files.
>
> Thank you very much,
> alxer
>
> --
> View this message in context:
> http://struts.1045723.n5.nabble.com/Help-with-Spring-JDBC-tp4272010p4272010.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: Help with Spring JDBC

2011-03-31 Thread Dave Newton
On Thu, Mar 31, 2011 at 11:02 AM, Dave Newton wrote:
> This is a Spring question?

And are you using the Spring plugin?

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Help with Spring JDBC

2011-03-31 Thread Dave Newton
This is a Spring question?

Dave

On Wed, Mar 30, 2011 at 2:12 PM, alxer  wrote:
> Hello,
> I am developing a web application with EclipseIDE and I am using the Struts2
> and Spring3 frameworks.
> I am trying to configure the web application acces to my MySQL database.
> I am inexperienced with the configuration of these frameworks so I would
> like someone to give me a help, I'm sure it is not very complicate but I
> can't find what I am doing wrong.
>
> I have configured the web.xml with the listeners ContextLoaderListener and
> RequestContextListener and also set the contextConfigLocation
> (applicationContext.xml).
>
> In the applicationContext.xml:
> - I have set the dataSource bean (driverClassName, url, username and
> password).
> - Defined one applicationDAO bean class (it extends SimpleJdbcDaoSupport)
> with a property that references the dataSource bean.
> - And another bean that represents the main action with a property that
> references the applicationDAO bean.
>
> In the applicationDAO implementation I have implement some methods that
> acces the MySQL database, but I have not defined any dataSource object and
> either any dataSource settler because I'm pretty sure that it inherits the
> dataSource settler method from SimpleJdbcDaoSupport (I am extending this
> class).
>
> In the main action I have defined an object that represents the
> applicationDAO and also its settler.
>
> The problem is that when I debug the application, in the point of the main
> action that I have to use the applicationDAO object methods, it is null, so
> I get a NullPointerException.
>
> I don't know what I am missing to configure to be able to use the
> applicationDAO methods from the main action. I would be very very grateful
> to get some help.
>
> If you want I can post the code of these files.
>
> Thank you very much,
> alxer
>
> --
> View this message in context: 
> http://struts.1045723.n5.nabble.com/Help-with-Spring-JDBC-tp4272010p4272010.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Help with Spring JDBC

2011-03-31 Thread alxer
Hello,
I am developing a web application with EclipseIDE and I am using the Struts2
and Spring3 frameworks.
I am trying to configure the web application acces to my MySQL database.
I am inexperienced with the configuration of these frameworks so I would
like someone to give me a help, I'm sure it is not very complicate but I
can't find what I am doing wrong.

I have configured the web.xml with the listeners ContextLoaderListener and
RequestContextListener and also set the contextConfigLocation
(applicationContext.xml).

In the applicationContext.xml:
- I have set the dataSource bean (driverClassName, url, username and
password).
- Defined one applicationDAO bean class (it extends SimpleJdbcDaoSupport)
with a property that references the dataSource bean.
- And another bean that represents the main action with a property that
references the applicationDAO bean.

In the applicationDAO implementation I have implement some methods that
acces the MySQL database, but I have not defined any dataSource object and
either any dataSource settler because I'm pretty sure that it inherits the
dataSource settler method from SimpleJdbcDaoSupport (I am extending this
class).

In the main action I have defined an object that represents the
applicationDAO and also its settler.

The problem is that when I debug the application, in the point of the main
action that I have to use the applicationDAO object methods, it is null, so
I get a NullPointerException.

I don't know what I am missing to configure to be able to use the
applicationDAO methods from the main action. I would be very very grateful
to get some help.

If you want I can post the code of these files.

Thank you very much,
alxer

--
View this message in context: 
http://struts.1045723.n5.nabble.com/Help-with-Spring-JDBC-tp4272010p4272010.html
Sent from the Struts - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org