This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes  Spring Beginners-Help Needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark " Spring Beginners-Help Needed " Watch " Spring Beginners-Help Needed " New topic
Author

Spring Beginners-Help Needed

suneel kota
Greenhorn

Joined: Jun 06, 2006
Posts: 24
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
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
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

Joined: Jun 06, 2006
Posts: 24
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
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You've got an extra '<' here, before the class attribute:
<bean id="urlMapping" <class=

Remove it.


[My Blog]
All roads lead to JavaRanch
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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

Joined: Jun 06, 2006
Posts: 24
Hi Satou,

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

Regards
SuneelKota
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring Beginners-Help Needed
 
Similar Threads
Error: spring-servlet.xml
spring with hibernate showing exception
Localisation errors
HTTP Status 404 - Servlet springtest is not available
Using Handler Mappings