[英]why the JAXRSIntegration can't lookup JNDI
i need some help here!我需要一些帮助!
I'm using javaEE 7, javax-ws-rs 2.0.1 and Weblogic 12.2.1.4.0.我正在使用 javaEE 7、javax-ws-rs 2.0.1 和 Weblogic 12.2.1.4.0。
Im getting following error on my Manage Server log:我的管理服务器日志中出现以下错误:
<04.01.2022 16:51 Uhr MEZ> <Warning> <JAXRSIntegration> <BEA-2192505> <An instance of EJB class com.my.company.rest.MyExchangeServer could not be looked up using a simple form name.
Attempting to look up using the fully-qualified form name.
javax.naming.NameNotFoundException: While trying to look up /app/my-company-web-1.7.0.2/MyExchangeServer in /app/webapp/my-company-web/1607311341.; remaining name '/app/my-company-web-1/7/0/2/MyExchangeServer'
this happend after the Migration from Weblogic 12.1 to Weblogic 12.2.这发生在从 Weblogic 12.1 迁移到 Weblogic 12.2 之后。 The Application runs without problem tough.该应用程序运行没有问题。 Only the ms_logs bothering us, because it take so much memory.只有 ms_logs 困扰着我们,因为它占用了太多 memory。
@ApplicationPath("rest")
public class ApplicationConfig extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> restClasses = new HashSet<>();
restClasses.add(MyExchangeServer.class);
return restClasses;
}
}
</web-app>
...
<servlet>
<servlet-name>Jersey-Servlet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.my.company.rest.ApplicationConfig</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerResponseFilter</param-name>
<param-value>com.sun.jersey.server.linking.LinkFiler</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey-Servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
@Stateless
@LocalBean
@Path("serviceInterface")
public class MyExchangeServer {
...
}
Under JNDI tree i find: java:global.my-int-ear.my-company-web.MyExchangeServer.com.my.company.rest.MyExchangeServer
在 JNDI 树下,我发现: java:global.my-int-ear.my-company-web.MyExchangeServer.com.my.company.rest.MyExchangeServer
It seems that the MyExchangeServer class are instantiated by jersey and not from EJB. MyExchangeServer class 似乎是由 jersey 而不是 EJB 实例化的。 Why would JAXRSIntegration trying to look up under /app/my-company-web-1.7.0.2/MyExchangeServer?为什么 JAXRSIntegration 会尝试在 /app/my-company-web-1.7.0.2/MyExchangeServer 下查找?
The Application works prefectly tough该应用程序工作起来非常艰难
now i have found the solution.现在我找到了解决办法。 The porblem was i'm still using JAX-RS 1.0 on my project.问题是我仍在我的项目中使用 JAX-RS 1.0。 Since on WLS 12.2.* JAX-RS 1.0 deprecated.从 WLS 12.2 开始。* JAX-RS 1.0 已弃用。 I have to use the JAX-RS 2.*.我必须使用 JAX-RS 2.*。
So far i only need to change the Jersey configuration on my web.xml.到目前为止,我只需要更改 web.xml 上的 Jersey 配置。 And i'm good to go.我对 go 很好。
<web-app>
<servlet>
<servlet-name>Jersey-Servlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<!-- Register resources and providers under my.package. -->
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>my.company.rest.ApplicationConfig</param-value>
</init-param>
<!-- Enable Tracing support. -->
<init-param>
<param-name>jersey.config.server.tracing</param-name>
<param-value>ALL</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey-Servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.