我已经部署了两只耳朵,但其中一只我却无法使用。 有一个文件 application-web-bnd.xml,其中是对数据源的引用
在我的server.xml文件中,我定义了数据源
<application id="MyCustomApp.war" location="F:\programming\source\MyCustomApp\target\MyCustomApp" name="MyCustomApp" type="war">
<application-bnd>
<security-role name="admin">
<special-subject type="ALL_AUTHENTICATED_USERS" />
</security-role>
<data-source binding-name="jdbc/Sample" name="java:comp/env/jdbc/db" />
</application-bnd>
</application>
<dataSource id="Sample" jndiName="jdbc/Sample" type="javax.sql.DataSource">
<jdbcDriver>
<library name="JdbcJarFiles">
<fileset dir="${shared.resource.dir}" includes="db2jcc4.jar, db2jcc_license_cisuz.jar, db2jcc_license_cu.jar, pdq.jar, pdqmgmt.jar" />
<folder dir="${shared.resource.dir}" />
</library>
</jdbcDriver>
</dataSource>
在我无法访问的耳朵中的代码中有initialContext java:comp / env / jdbc / db。
存在对数据源的引用,但不存在数据源。 我无权访问web.xml来创建参考。 我不知道如何重写它。
您能帮忙吗?
我的耳朵看起来:
<module>
<ejb>PRE-BF.jar</ejb>
</module>
<module>
<web>
<web-uri>PRE-WS.war</web-uri>
<context-root>/PRE-WS</context-root>
</web>
</module>
<module>
<web>
<web-uri>PRE-RS.war</web-uri>
<context-root>/PRE-RS</context-root>
</web>
</module>
<module>
<web>
<web-uri>PRE-PF.war</web-uri>
<context-root>/PRE-PF</context-root>
</web>
</module>
答案 0 :(得分:1)
您可以按以下方式在服务器配置中覆盖绑定。 (这将需要在服务器配置而不是dropins中定义您的应用程序。)
<application location="MyApp.war">
<web-bnd moduleName="MyApp">
<resource-ref name="jdbc/Sample" binding-name="java:comp/env/jdbc/db"/>
</web-bnd>
</application>