• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts and Spring

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i try to integrate spring in a struts application. So the first thing was to change dtd 2.2 to

to add spring listener:

As soon as i added the listener tag context loading for my web app fails:

I don't realy understand what this exception means.

I am using java 1.4, Tomcat/4.1.36, Struts 1.x and Spring 2.x

Can anyone help?

Regards,

ak
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see it in your post. Did you add the Spring libraries to the classpath? The stack trace you posted looks like it is coming from an XML parsing error. Make sure that your XML file do not have errors.

I am using java 1.4, Tomcat/4.1.36, Struts 1.x and Spring 2.x



If possible, upgrade Tomcat to the lastest version.
 
A. Kosrus
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello James,

Originally posted by James Clark:
I don't see it in your post. Did you add the Spring libraries to the classpath? The stack trace you posted looks like it is coming from an XML parsing error. Make sure that your XML file do not have errors.

If possible, upgrade Tomcat to the lastest version.



I added spring.jar to the classpath. The parsing error only appears when i add the listener-tag to the web.xml. Without it everything is fine.
In the moment i cannot upgrade Tomcat.

Any other suggestions?

Regards,

ak
 
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that the error is due to that you did not specify the location(s) of the spring config file(s) like this

 
A. Kosrus
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Alaa,

Originally posted by Alaa Nassef:
I think that the error is due to that you did not specify the location(s) of the spring config file(s) like this



i specified config location like other config files(struts-config):



Other ideas?

Regards,

ak
 
Alaa Nassef
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I googled a little bit and found this page, and here's what caught my attention

You need to use org.springframework.web.context.request.RequestContextListener, which is the "Listener for Servlet 2.4+ containers. Exposes the request to the current thread, through both LocaleContextHolder and RequestContextHolder"

. You are using servlet 2.3 on tomcat 4.1. I'd say to upgrade to servlet 2.4. Never used 2.3 in my life so can't help you a lot there. Hope this is the cause of your problem
 
A. Kosrus
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

yes, i think you might be right! I will try to fix that and try again. Thank you for your help!

Regards,

ak
 
A. Kosrus
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again,

i found a solution for my problem:


This is all in web.xml. Further i added following to faces-config.xml:


Now all managed beans go to applicationContext.xml. To use the managed beans (now under Spring control) use the <id="yourBean"> in your jsp pages.

Regards,

ak
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Arndt K.",
Please check your private messages regarding an important administrative matter.
-Ben
 
Alaa Nassef
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that I once read somewhere that spring listeners don't work in J2EE 1.3 and to use filters instead. I just remembered this now
 
A. Kosrus
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

the listener is working fine. I also removed the filter from the web.xml. The application just needs to startup Spring application context.

Regards,

ak
[ April 30, 2008: Message edited by: A. Kosrus ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic