You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by RajiR <ra...@yahoo.com> on 2008/02/21 11:33:31 UTC

struts2+Spring+Hibernate Integration

Hi,

As struts2 comes along with spring integration with
struts2-spring-plugin-2.0.11.jar,after starting the tomcat server its unable
to load that jar and getting an exception as:

SEVERE: Exception starting filter struts2
Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory
class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean -
jar:file:/E:/Struts2WorkSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SampleStruts2/WEB-INF/lib/struts2-spring-plugin-2.0.11.jar!/struts-plugin.xml:30:132
      .....
Caused by: java.lang.NoClassDefFoundError:
org/springframework/context/ApplicationContextAware
        at java.lang.ClassLoader.defineClass1(Native Method)
      
......com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:180)
        ... 24 more


What is the reason for this?I have checked whether I have loaded same jar
double times,but tht's not tht problem.what might b the reason?Does any body
came across this one?

Also,the link:
http://www.roseindia.net/struts/hibernate-spring/integrate.shtml helps in
integrating struts1+hibernate+springs.But, since I would like to work with
struts2+Hibernate+Spring,what modifications I have to do to satisfy my
requirement?Since action forms concept is not there in struts2...!!!

Thanks.

-- 
View this message in context: http://www.nabble.com/struts2%2BSpring%2BHibernate-Integration-tp15607260p15607260.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


RE: struts2+Spring+Hibernate Integration

Posted by RajiR <ra...@yahoo.com>.
Hi,

By implementing Preparable,ModelDriven,ServletRequestAware interfaces,am
able to get the form details and sent those details to service
implementation layer from an action class.From service implementation i have
called dao.Since DAO is not injected any where in struts.xml,its throwing
nullpointerexception.I have used only hibernate.Is it required to use
springs inorder to inject dao?Or,can I inject using hibernate and struts2
alone??

Replies plzzzzzzzz........

Thanks.


RajiR wrote:
> 
> Hi,
> 
> In the link provided below,it uses struts1+hibernate+spring.I have done
> tht and trying to do the same application in struts2.So now i have a jsp
> page to enter user details and to register and after clicking on submit
> button entered values should be saved into database for which I have used
> mapping files(hbm.xml) and connected to database using hibernate
> alone(hibernate.cfg.xml file).I am not injecting springs as of now inorder
> to connect to database,instead i have used hibernate pooling.I would like
> to use spring webservices while logging into the application after this
> registration process,but vill come to tht later.
>                     My present problem is after writing struts.xml,jsp
> pages,java class with all fields in the table and mapping hbm.xml file, I
> would like to insert entered details into database using hibernate i.e., I
> need to get the entered details and to set it to the java class(form bean
> kind of),so that i can send them to the hibernate dao implementation
> inorder to save the values.But how to get the user entered values and for
> what i have to set them?Since action form concept is not there in
> struts2.I can provide u with the code if required..
>                     Looking forward to get a favourable hint.Plz reply as
> soon as possible.
> 
> Thanks.
> 
> Deepak Kumar wrote:
>> 
>> Hi,
>> 
>> Here is and application with example code
>> http://www.roseindia.net/struts/hibernate-spring/index.shtml
>> 
>> Thanks
>> 
>> 
>> -----Original Message-----
>> From: RajiR [mailto:rajesware99@yahoo.com]
>> Sent: Thursday, February 21, 2008 4:04 PM
>> To: user@struts.apache.org
>> Subject: struts2+Spring+Hibernate Integration
>> 
>> 
>> 
>> Hi,
>> 
>> As struts2 comes along with spring integration with
>> struts2-spring-plugin-2.0.11.jar,after starting the tomcat server its
>> unable
>> to load that jar and getting an exception as:
>> 
>> SEVERE: Exception starting filter struts2
>> Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory
>> class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean -
>> jar:file:/E:/Struts2WorkSpace/.metadata/.plugins/org.eclipse.wst.server.core
>> /tmp0/wtpwebapps/SampleStruts2/WEB-INF/lib/struts2-spring-plugin-2.0.11.jar!
>> /struts-plugin.xml:30:132
>>       .....
>> Caused by: java.lang.NoClassDefFoundError:
>> org/springframework/context/ApplicationContextAware
>>         at java.lang.ClassLoader.defineClass1(Native Method)
>> 
>> ......com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.regi
>> ster(XmlConfigurationProvider.java:180)
>>         ... 24 more
>> 
>> 
>> What is the reason for this?I have checked whether I have loaded same jar
>> double times,but tht's not tht problem.what might b the reason?Does any
>> body
>> came across this one?
>> 
>> Also,the link:
>> http://www.roseindia.net/struts/hibernate-spring/integrate.shtml helps in
>> integrating struts1+hibernate+springs.But, since I would like to work
>> with
>> struts2+Hibernate+Spring,what modifications I have to do to satisfy my
>> requirement?Since action forms concept is not there in struts2...!!!
>> 
>> Thanks.
>> 
>> --
>> View this message in context:
>> http://www.nabble.com/struts2%2BSpring%2BHibernate-Integration-tp15607260p15
>> 607260.html
>> Sent from the Struts - User mailing list archive at Nabble.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
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/struts2%2BSpring%2BHibernate-Integration-tp15607260p15715059.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


RE: struts2+Spring+Hibernate Integration

Posted by RajiR <ra...@yahoo.com>.
Hi,

In the link provided below,it uses struts1+hibernate+spring.I have done tht
and trying to do the same application in struts2.So now i have a jsp page to
enter user details and to register and after clicking on submit button
entered values should be saved into database for which I have used mapping
files(hbm.xml) and connected to database using hibernate
alone(hibernate.cfg.xml file).I am not injecting springs as of now inorder
to connect to database,instead i have used hibernate pooling.I would like to
use spring webservices while logging into the application after this
registration process,but vill come to tht later.
                    My present problem is after writing struts.xml,jsp
pages,java class with all fields in the table and mapping hbm.xml file, I
would like to insert entered details into database using hibernate i.e., I
need to get the entered details and to set it to the java class(form bean
kind of),so that i can send them to the hibernate dao implementation inorder
to save the values.But how to get the user entered values and for what i
have to set them?Since action form concept is not there in struts2.I can
provide u with the code if required..
                    Looking forward to get a favourable hint.Plz reply as
soon as possible.

Thanks.

Deepak Kumar wrote:
> 
> Hi,
> 
> Here is and application with example code
> http://www.roseindia.net/struts/hibernate-spring/index.shtml
> 
> Thanks
> 
> 
> -----Original Message-----
> From: RajiR [mailto:rajesware99@yahoo.com]
> Sent: Thursday, February 21, 2008 4:04 PM
> To: user@struts.apache.org
> Subject: struts2+Spring+Hibernate Integration
> 
> 
> 
> Hi,
> 
> As struts2 comes along with spring integration with
> struts2-spring-plugin-2.0.11.jar,after starting the tomcat server its
> unable
> to load that jar and getting an exception as:
> 
> SEVERE: Exception starting filter struts2
> Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory
> class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean -
> jar:file:/E:/Struts2WorkSpace/.metadata/.plugins/org.eclipse.wst.server.core
> /tmp0/wtpwebapps/SampleStruts2/WEB-INF/lib/struts2-spring-plugin-2.0.11.jar!
> /struts-plugin.xml:30:132
>       .....
> Caused by: java.lang.NoClassDefFoundError:
> org/springframework/context/ApplicationContextAware
>         at java.lang.ClassLoader.defineClass1(Native Method)
> 
> ......com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.regi
> ster(XmlConfigurationProvider.java:180)
>         ... 24 more
> 
> 
> What is the reason for this?I have checked whether I have loaded same jar
> double times,but tht's not tht problem.what might b the reason?Does any
> body
> came across this one?
> 
> Also,the link:
> http://www.roseindia.net/struts/hibernate-spring/integrate.shtml helps in
> integrating struts1+hibernate+springs.But, since I would like to work with
> struts2+Hibernate+Spring,what modifications I have to do to satisfy my
> requirement?Since action forms concept is not there in struts2...!!!
> 
> Thanks.
> 
> --
> View this message in context:
> http://www.nabble.com/struts2%2BSpring%2BHibernate-Integration-tp15607260p15
> 607260.html
> Sent from the Struts - User mailing list archive at Nabble.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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/struts2%2BSpring%2BHibernate-Integration-tp15607260p15708410.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: struts2+Spring+Hibernate Integration

Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi,

Download Spring 2 libraries and put in your WEB-INF/lib folder


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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


RE: struts2+Spring+Hibernate Integration

Posted by Deepak Kumar <de...@roseindia.net>.
Hi,

Here is and application with example code
http://www.roseindia.net/struts/hibernate-spring/index.shtml

Thanks


-----Original Message-----
From: RajiR [mailto:rajesware99@yahoo.com]
Sent: Thursday, February 21, 2008 4:04 PM
To: user@struts.apache.org
Subject: struts2+Spring+Hibernate Integration



Hi,

As struts2 comes along with spring integration with
struts2-spring-plugin-2.0.11.jar,after starting the tomcat server its unable
to load that jar and getting an exception as:

SEVERE: Exception starting filter struts2
Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory
class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean -
jar:file:/E:/Struts2WorkSpace/.metadata/.plugins/org.eclipse.wst.server.core
/tmp0/wtpwebapps/SampleStruts2/WEB-INF/lib/struts2-spring-plugin-2.0.11.jar!
/struts-plugin.xml:30:132
      .....
Caused by: java.lang.NoClassDefFoundError:
org/springframework/context/ApplicationContextAware
        at java.lang.ClassLoader.defineClass1(Native Method)

......com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.regi
ster(XmlConfigurationProvider.java:180)
        ... 24 more


What is the reason for this?I have checked whether I have loaded same jar
double times,but tht's not tht problem.what might b the reason?Does any body
came across this one?

Also,the link:
http://www.roseindia.net/struts/hibernate-spring/integrate.shtml helps in
integrating struts1+hibernate+springs.But, since I would like to work with
struts2+Hibernate+Spring,what modifications I have to do to satisfy my
requirement?Since action forms concept is not there in struts2...!!!

Thanks.

--
View this message in context:
http://www.nabble.com/struts2%2BSpring%2BHibernate-Integration-tp15607260p15
607260.html
Sent from the Struts - User mailing list archive at Nabble.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