Win a copy of Emmy in the Key of Code this week in the General Computing 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Spring Beginners-Help Needed

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to Spring. I have used the example MVC available at the Spring site
http://www.springframework.org/docs/...ep-Part-1.html.

I keep getting a java.net.ConnectException. Connection Times Out when I call the http://localhost:8080/springapp/hello.htm. It is the last step.

exception

javax.servlet.ServletException: Servlet.init() for servlet springapp threw exception
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:164)
org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:206)
org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:828)
org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:700)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:584)
org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)


root cause

org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from ServletContext resource [/WEB-INF/springapp-servlet.xml]; nested exception is java.net.ConnectException: Connection timed out: connect
org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:176)
org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:125)
org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:141)
org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:126)
org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:94)
org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:89)
org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:268)
org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:134)
org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:3 05)
org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:250 )
org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:219)
org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:112)
javax.servlet.GenericServlet.init(GenericServlet.j ava:256)
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:164)
org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:206)
org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:828)
org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:700)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:584)
org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)



The springapp-servlet.xml I am using is:


<beans>
<bean id="springappController" class="SpringappController"/>
<bean id="urlMapping" <class="org.springframework.web.servlet.handler.Si mpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/hello.htm">springappController</prop>
</props>
</property>
</bean>
</beans>

Do I have to pass any init-param to the DispatcherServlet.

Please help. Any help will be appreciated. My web.xml looks like:


<web-app>

<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>springapp</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>

</web-app>

I am running it on Tomcat 4.1 with ecilipse3.1 as IDE

Advance Thanks

Regards
SuneelKota
 
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

If you typed this manually...in your xml file..I see a space...

not sure whether that is the real cause...but neverthless...


<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>


There is a space ..in the servlet-class value for the class


Regards
 
suneel kota
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kumar,

Thanks for your reply, but i did not put any space in the web.xml file. If you can across this type problem give me some solution..

Thanking You
SuneelKota
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've got an extra '<' here, before the class attribute:
<bean id="urlMapping" <class=

Remove it.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another thing:
<bean id="springappController" class="SpringappController"/>

We usually put classes into packages. I think that you should put your controllers inside packages (for example 'controller' package).
<bean id="springappController" class="controller.SpringappController"/>
 
suneel kota
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satou,

Thanks for you reply thing is that i did not use any packages in my program.

Regards
SuneelKota
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!