我有与Eclipse Helios集成的Glassfish3服务器
我已经通过右键单击服务器使用添加和删除将我的示例 Spring 项目添加到服务器。
当我跑http://localhost:8080/SpringHibernateJSFTest/insertJdbcContact.do
我正进入(状态description The requested resource () is not available.
如何解决此错误?我究竟做错了什么?
非常感谢任何帮助。
我的controller class
@Controller
public class JBTJdbcController {
@Autowired
com.service.SpringJdbcService mfssService;
@RequestMapping(value = "/insertJdbcContact", method = RequestMethod.GET)
public ModelAndView insertMemDtls() {
ModelAndView mav = new ModelAndView("JdbcInsert");
VngMem mfssbean = new VngMem();
mav.addObject("insertUser", mfssbean);
mav.addObject("status", "success");
return mav;
}
@RequestMapping(value = "/insertJdbcContact", method = RequestMethod.POST)
public ModelAndView insertContact(
@ModelAttribute("insertUser") VngMem vngmem) {
ModelAndView mav = new ModelAndView("JdbcInsert");
try {
mfssService.insertMfssMemDts(vngmem);
} catch (Exception e) {
e.printStackTrace();
}
mav.addObject("searchResultPost", vngmem);
return mav;
}
}
这是web.xml
<display-name>SpringHibernateJSFTest</display-name>
<display-name>SpringMVC</display-name>
<welcome-file-list>
<welcome-file>welcome.do</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
</web-app>
我的applicationContext.xml
<context:annotation-config />
<context:component-scan base-package="com.controller,com.beans" />
<mvc:annotation-driven />
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@server:1521:orcl"/>
<property name="username" value="scott"/>
<property name="password" value="tiger"/>
</bean>
<bean id="SpringJdbcDao" class="com.dao.SpringJdbcDaoImpl">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="SpringJdbcService" class="com.service.SpringJdbcServiceImpl">
<property name="springJdbcDao" ref="SpringJdbcDao"/>
</bean>
</beans>
我的调度程序-servlet.xml
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
我JdbcInsert.jsp
有/WebContent/WEB-INF
更新 1
cannot Deploy SpringHibernateJSFTest
Deployment Error for module: SpringHibernateJSFTest: Exception while loading the app :
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException:
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from class path resource [applicationContext.xml];
nested exception is java.io.FileNotFoundException: class path resource
[applicationContext.xml] cannot be opened because it does not exist