har*_*are 1 osgi eclipse-plugin jax-rs apache-wink amdatu
我正在尝试在OSGI中运行Apache Wink并使用Felix Whiteboard注册资源作为服务.在极简主义的OSGI环境中,捆绑包按预期工作.但是,然后我将捆绑包移动到Eclipse Equinox环境中,我正在开发一个依赖它的插件.我开始收到这个错误.
May 22, 2013 11:19:59 AM org.apache.wink.server.internal.application.ApplicationProcessor processWinkApplication
SEVERE: An exception occurred during processing of the com.yarcdata.rest.Repositories instance. This instance is ignored.
java.lang.IllegalArgumentException: interface javax.servlet.http.HttpServletRequest is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:461)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:690)
at org.apache.wink.common.internal.registry.ContextAccessor.getContextFromAccessor(ContextAccessor.java:92)
Run Code Online (Sandbox Code Playgroud)
我想我已经安装了所有必需的软件包,如果我开始寻找导出HttpServletRequest的软件包,我会看到:
g! lb | grep ervlet
311|Resolved | 4|Servlet API Bundle (3.0.0.v201112011016)
394|Starting | 4|Http Services Servlet (1.1.300.v20120912-130548)
444|Resolved | 4|Jetty :: Servlet Handling (8.1.3.v20120522)
578|Resolved | 4|jersey-servlet (1.12.0)
580|Resolved | 4|jersey-servlet (1.17.1)
588|Active | 4|Java Servlet API (3.0.1)
589|Resolved | 4|javax.servlet.api (2.5.0)
590|Resolved | 4|javax.servlet.jstl (1.1.2)
622|Active | 4|Servlet Specification API (2.5.0)
678|Resolved | 4|Spring Web Servlet (2.5.6)
g! bundle 588
javax.servlet-api_3.0.1 [588]
Id=588, Status=ACTIVE Data Root=/wspaces/tbcPlugin/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/org.eclipse.osgi/bundles/588/data
"No registered services."
No services in use.
Exported packages
javax.servlet; version="3.0.0"[exported]
javax.servlet.descriptor; version="3.0.0"[exported]
javax.servlet.annotation; version="3.0.0"[exported]
javax.servlet.http; version="3.0.0"[exported]
No imported packages
No fragment bundles
Named class space
javax.servlet-api; bundle-version="3.0.1"[provided]
No required bundles
Run Code Online (Sandbox Code Playgroud)
因此,由于HttpServletRequest的完整包,javax.servlet.http.HttpServletRequest我希望bundle 588处于Active状态以解决Wink的问题.它是活动的并且它导出包,是否需要更多的东西?让我们来看看它正在寻找什么版本:
g! lb | grep mdatu
595|Resolved | 4|Amdatu Web - JAX RS (1.0.0)
596|Active | 4|Amdatu Web - Apache Wink Application (1.0.1)
g! bundle 596
org.amdatu.web.rest.wink_1.0.1 [596]
Id=596, Status=ACTIVE Data Root=/wspaces/tbcPlugin/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/org.eclipse.osgi/bundles/596/data
"Registered Services"
{org.amdatu.web.rest.jaxrs.JaxRsSpi}={service.id=139}
{javax.servlet.Servlet}={init.applicationConfigLocation=/conf/application.properties, alias=/myresource, service.id=140}
{javax.servlet.Servlet}={init.applicationConfigLocation=/conf/application.properties, alias=/protocol, service.id=141}
{javax.servlet.Servlet}={init.applicationConfigLocation=/conf/application.properties, alias=/repositories, service.id=142}
{org.osgi.service.cm.ManagedService}={service.pid=org.amdatu.web.rest.wink, org.amdatu.tenant.pid=org.amdatu.tenant.PLATFORM, service.id=143}
Services in use:
{java.lang.Object}={osgi.command.function=[confapply], osgi.command.scope=equinox, service.id=110}
...
No exported packages
Imported packages
javax.activation; version="0.0.0"<org.eclipse.osgi_3.8.2.v20130124-134944 [0]>
javax.annotation; version="0.0.0"<org.eclipse.osgi_3.8.2.v20130124-134944 [0]>
javax.servlet; version="3.0.0"<javax.servlet-api_3.0.1 [588]>
javax.servlet.http; version="3.0.0"<javax.servlet-api_3.0.1 [588]>
Run Code Online (Sandbox Code Playgroud)
看起来你有多个捆绑导出Servlet API包(例如588,589 和 622,也可能是其他包).因此,捆绑包导入的包可能与Apache Wink捆绑包导入的包不同.在正常的Java类加载规则,两个包只能认为是"相同的",如果他们有相同的名字和由同一个类加载器加载; 在OSGi下,它们需要通过同一个包导出.
Wink报告说你没有servlet包的可见性......它的真正含义是你没有看到它正在使用的同一个servlet包.
虽然OSGi可以处理同一个包的多个版本化导出,但如果您尝试仅从一个包中导出每个包,则可以使您的生活更轻松.因此,在第一个实例中,您应该摆脱所有这些冗余的API包.
| 归档时间: |
|
| 查看次数: |
1606 次 |
| 最近记录: |