• 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

Problem deploying spring in Tomcat 6

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am new to Spring2 framework. I am just trying to develop a sample application, where in which, the flow is the controller class directs to a jsp page. I have used the below jars.
spring.jar
commons-logging-1.0.4.jar
log4j.jar

The Home.java(controller) file


My web.xml file


My login-servlet.xml file

**I get the below exception when deployed in the Tomcat 6 server.


Any help could be highly appreciated.
Regards,
Kiran.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
your exception clearly says :: SAXParserExceptoin (premature end of line)
please validate your login-service.xml
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Check for presence of a BOM character in your XML,(in the starting) it happens sometimes with encoding in editors, might be the case with you too

http://unicode.org/faq/utf_bom.html
 
K Kiran Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My login-serlvet.xml is free from BOM character. Not sure what is the flaw .
Is it that I need to add some more jars or I need to modify my login-servlet.xml?
Is the file applicationContext.xml mandatory? I didn't create that file in WEB-INF.

Regards,
Kiran.
 
K Kiran Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have fixed the issue. The only thing I have modified is the web.xml's contextConfigLocation param name. I have removed the other two xml files(/WEB-INF/login-service.xml,/WEB-INF/login-data.xml)in the param-value
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/login-servlet.xml</param-value>
</context-param>
If we don't use this param, the controller will look for applicationContext.xml under WEB-INF. So in order to load our own xml instead of the default one, we have to use the above tag.

Thanks for all who helped me in this issue.

Regards,
Kiran.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by K Kiran Kumar:
Hi,

I have fixed the issue. The only thing I have modified is the web.xml's contextConfigLocation param name. I have removed the other two xml files(/WEB-INF/login-service.xml,/WEB-INF/login-data.xml)in the param-value
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/login-servlet.xml</param-value>
</context-param>
If we don't use this param, the controller will look for applicationContext.xml under WEB-INF. So in order to load our own xml instead of the default one, we have to use the above tag.

Thanks for all who helped me in this issue.

Regards,
Kiran.



Yes, applicationContext.xml is the default name it looks for when you don't supply the contextParam in your web.xml. But if you use the default name for your application context as applicationContext, then you don't need to add more xml to your web.xml.

Same thing goes with your servlet xml file for defining you viewResolvers and Controllers. if you call it xxx-servlet.xml where xxx is the name of the servlet that you give in web.xml for servlet name for the dispatcher servlet.

so if I have

<servlet>
<servlet-name>MyServlet</...>
<servlet-class>...DispatcherServlet</...>
</servlet>

Then you don't have to include the init param in there.

Mark
 
K Kiran Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark for the info.

Regards.
Kiran.
 
Arch enemy? I mean, I don't like you, but I don't think you qualify as "arch enemy". Here, try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic