web.xml 中的资源引用中断了 servlet 映射
Resrouce-ref in web.xml breaks servlet mapping
我正在尝试将资源引用添加到我的 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>
一切都按预期进行。然后我添加资源参考,使其看起来像这样:
<?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
我不明白为什么当我添加资源引用时它会中断。我错过了什么吗?
提前致谢
已解决。
问题是我没有添加
<resource-ref name="jdbc/as400" binding-name="jdbc/as400"></resource-ref>
到我的 ibm-web-bnd-xml.
我正在尝试将资源引用添加到我的 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>
一切都按预期进行。然后我添加资源参考,使其看起来像这样:
<?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
我不明白为什么当我添加资源引用时它会中断。我错过了什么吗?
提前致谢
已解决。
问题是我没有添加
<resource-ref name="jdbc/as400" binding-name="jdbc/as400"></resource-ref>
到我的 ibm-web-bnd-xml.