Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Spring framework: Unable to load multiple servlets

890792Jan 25 2012 — edited Jan 30 2012
Hi All,

My application is a spring 2.5 application. I am trying to specify two servlets inside web.xml:

1) dispatcherservlet ---- spring dispatcher servlet

2) EmailServlet ----- This is an HTTP servlet which is available from inside a jar file. The jar file is added as a lib in the web application. This servlet acts as a client to a particular web-service. The application will invoke this client which in-turn will call the web-service. My web.xml is as follows:

<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>

<context-param>
<!-- the url where the web-service is put -->
<param-name>WEBSERVICE_HOST</param-name>
<param-value>http://ABCD:7200</param-value>
</context-param>

<servlet>

<servlet-name>EmailServlet</servlet-name>
<servlet-class>com.abc.EmailServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>EmailServlet</servlet-name>
<url-pattern>/EmailService</url-pattern>
</servlet-mapping>
<context-param>
<description>URI of the default page the servlets should return if there is a processing error</description>
<param-name>DEFAULT_ERROR_PAGE</param-name>
<param-value>/fail.jsp</param-value>
</context-param>
<welcome-file-list>
<welcome-file>home.html</welcome-file>
</welcome-file-list>
</web-app>

I am trying to invoke the email service from my page as below:

<form method="post" id="emailThisPageForm" name="emailThisPageForm" action="/EmailService" >

However, the email is not getting send. It seems the Email servlet is not getting invoked.

Can someone please suggest a solution for this? Do I need to add something additional to invoke the servlet?

Please help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 27 2012
Added on Jan 25 2012
10 comments
616 views