我正在尝试将resource-ref添加到我的web.xml中。它看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>de.so.orderalloc.servlet.web</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<display-name>OrderAllocServlet</display-name>
<servlet-name>OrderAllocServlet</servlet-name>
<servlet-class>servlet.OrderAllocServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>OrderAllocServlet</servlet-name>
<url-pattern>/OrderAllocServlet</url-pattern>
</servlet-mapping>
一切都按预期工作。然后我添加资源-ref,使它看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>de.so.orderalloc.servlet.web</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<display-name>OrderAllocServlet</display-name>
<servlet-name>OrderAllocServlet</servlet-name>
<servlet-class>servlet.OrderAllocServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>OrderAllocServlet</servlet-name>
<url-pattern>/OrderAllocServlet</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>jdbc/as400</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
之后,如果我提交表单,我会收到此错误:
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /de.so.orderalloc.servlet.web/OrderAllocServlet
当我添加资源引用时,我无法弄清楚它为什么会中断。我错过了什么吗?
提前致谢
答案 0 :(得分:0)
它解决了。
问题在于我没有添加
<resource-ref name="jdbc/as400" binding-name="jdbc/as400"></resource-ref>
到我的ibm-web-bnd-xml。