我们正在尝试使用网络应用程序创建一个。ear项目,该项目公开了一些rest api。该项目包括表示某些业务逻辑的“微型jar”(由@Path
注释),每个jar包含一些rest类(由@Path
注释)。该应用程序符合Java EE 7的要求,并已部署在WAS 9实例上,结构化的[[.ear如下:]]project.ear
|
|- META-INF
| |- application.xml
|
|-lib
| |- service1.jar (with rest classes)
| | |- META-INF
| | |- beans.xml
| |
| |
| |
| |- service2.jar (with rest classes, same structure as service1.jar)
| |
| |- core.jar (with Application subclass, same structure as service1.jar)
|
|
|- app.war
| |- classes (empty)
| |- web.xml
| |- beans.xml
。[war包中的
web.xml包含对自定义应用程序子类的引用:<servlet>
<description>JAX-RS Tools Generated - Do not modify</description>
<servlet-name>JAX-RS Servlet</servlet-name>
<servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.example.MyApplicationSubclass</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAX-RS Servlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all"> </beans>
[
MyApplicationSubclass
为空,它具有任何覆盖的方法,并使用基本的@ApplicationPath
注释。
[在像WebLogic和JBOSS这样的其他AS上,不需要显式的servlet声明,所有内容都会自动发现,但是在WAS上,我们发现了这些主要问题:自动发现已完全关闭,
@ApplicationPath
和@Path
类均未自动发现。[C0必须包含在.war的web.xml中
- 即使在web.xml中声明了
MyApplicationSubclass
,也不会自动发现其余端点- 即使通过反射,也无法从
MyApplicationSubclass
中找到休止符类- 任何提示?为什么其他AS可以使用这种结构?这些问题与Apache CXF有关吗?
NOTE:
我们也尝试过使用父级上载策略启动应用程序,但问题仍然存在。我们正在尝试使用公开一些Rest API的Web应用程序来创建.ear项目。该项目包括代表一些业务逻辑的“微型jar”(由@Path注释),每个jar都包含一些...