This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

no WebApplicationContext found: no ContextLoaderListener registered?

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,

I'm learning spring and now i want to use a form but when i come in my page that contain the form i've this :

org.apache.jasper.JasperException: An exception occurred processing JSP page /user/createUser.jsp at line 36

here is my createUser.jsp:


My web.xml


my creationUser-context.xml:


My class USer:


and my controller

finally my log trace:


i'm disapointed with this issue thanks for your help
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure, because there is parts in the stack trace missing from earlier in your log.

1) I noticed no @Controller on your Controller class
So it will not be instantiated as a bean

not related to your issue, but I have issue with 2) You Controller class name is bad. User isn't a Controller.

Mark
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your advice but i've still the same error.

i've a page index.jsp that contain an iframe.
when i click on my link, i submit a form with the url : user/createUser.jsp (that's the src of my iframe)

my index.jsp


here is my web.xml


and my controller:


that's the complete log trace:


Thanks for your help
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds to me like your missing something in your web.xml
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah. I thought he wouldn't need it based on what was posted. But reading the log, there is a lot that was not posted. There was a lot more to the configurations, classes, etc. And since it wasn't posted that he had Services and other beans that would be needed in other Controllers etc, I assumed what he posted was all that was in his app.

But, if you look at the log line right above the stack trace, like line 120, it says

GRAVE: No WebApplicationContext found: no ContextLoaderListener registered?

Mark
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your replies.
but what is the difference whit <listener-class> and my <servlet-class> ? where do i put the tag listener?
Here is my complete web.xml



thanks again for your help to a noob ;-)
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone has an idea to help me?
maybe it comes from my url-pattern in web.xml but as i'm new, i've a lot of difficult to map correctly.

Is it correct this to intercept the url from my index.jsp that submit a form


And someone has a good tutorial to learn spring and form with sample that works to understand better.
here is the 2 samples i used but it doesn't work.

http://www.roseindia.net/tutorial/spring/spring3/web/spring-3-mvc-form-example.html
http://www.giantflyingsaucer.com/blog/?p=2395

thanks
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"<listener-class> and my <servlet-class>"

Difference is two different ApplicationContexts created. One to store your middle tier beans, and one for your web tier beans. The servlet-class is for your web-tier beans. Controllers, ViewResolvers. the listener class creates an ApplicationContext for your middle tier beans and gets stored in the ServletContext for all Servlets to get access to it, including all your web tier beans.

In your web.xml you have a servlet-class to create an ApplicationContext for your middle tier beans that won't be accessable by your two other DispatcherServlet. That one should be with the listener-class ContextLoaderListener.

On another note. this is one web application. So you only need one DispatcherServlet in the web.xml and servlet mapping to all URLs for your application. The more specific distinct URLs are then mapped to Controller methods with your @RequestMapping in your Controllers.

Mark
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend you pick up a copy of Spring In Action 3rd edition, or the Spring documentation. Be careful of tutorials/blog posts because they tend to show bad practices, use older styles and are sometimes just wrong.

Good Luck

Mark
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your help, i downloaded the pdf spring in action 3rd edition.

So i change my code but i've an error404 with this log error:


Here is the link i call :


my web.xml:


my creationUser.xml


and my controller:


my class User

and finally my mapge createUser.jsp that is under user/


i suppose it's a silly mistake but i can't find.

thanks to unblock me
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can do a sample that work and my mistake was the value of my @RequestMapping (my file is under the directory user.
it works with an hyperlink to the address /user/createUser.jsp but how can i do with a frame (createUSer.sjp) include in my index.jsp

thanks
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic