我有一个在eclipse virgo OSGi平台上运行的spring MVC projet.当我尝试使用<osgi:reference>标记导入OSGi服务时,我得到以下异常:
Servlet /Web threw load() exception org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/osgi]
Run Code Online (Sandbox Code Playgroud)
这是我的应用程序上下文文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
<annotation-driven />
<resources mapping="/resources/**" location="/resources/" />
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.apptivit.web" />
<osgi:reference id="entityService" interface="com.apptivit.db.service.AbstractEntityService"/>
</beans:beans>
Run Code Online (Sandbox Code Playgroud)
最后在我的MANIFEST.MF文件中我这样做:
Manifest-Version: 1.0
Export-Package: com.apptivit.web;uses:="org.springframework.stereotype
,org.springframework.ui,org.springframework.web.bind.annotation"
Tool: Bundlor 1.0.0.RELEASE
Import-Package: com.apptivit.db.service,
org.apache.log4j,
org.slf4j, …Run Code Online (Sandbox Code Playgroud) 我确信我会理解差异,因为我开始做更多与OSGi相关的事情,但我认为这是一个很好的问题,因为我不清楚几次快速谷歌搜索.如果有人有一个清晰,简洁的答案......
我有一个干净安装Eclipse Virgo(3.5)的问题,一旦它在Amazon EC2上的Ubuntu映像12.04上启动,显然无缘无故地关闭.我从SSH开始处女座,启动工作正常但几个小时后服务器停止,日志报告如下(见第三行):
[2012-12-10 11:57:14.804] INFO http-bio-8080-exec-9 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping Mapped URL path [/splash] onto handler 'splashController'
[2012-12-10 11:57:14.840] INFO http-bio-8080-exec-9 org.springframework.web.servlet.DispatcherServlet FrameworkServlet 'splash': initialization completed in 92 ms
[2012-12-10 15:33:27.488] INFO System Bundle Shutdown o.e.g.b.extender.internal.activator.ContextLoaderListener Stopping [org.eclipse.gemini.blueprint.extender] bundle v.[1.0.0.RELEASE]
[2012-12-10 15:33:27.493] INFO kernel-dm-10 o.e.g.blueprint.context.support.OsgiBundleXmlApplicationContext Unpublishing application context OSGi service for bundle Virgo Kernel Admin
Shell (org.eclipse.virgo.kernel.shell)
[2012-12-10 15:33:27.494] INFO kernel-dm-10 o.e.g.blueprint.context.support.OsgiBundleXmlApplicationContext Closing OsgiBundleXmlApplicationContext(bundle=org.eclipse.virgo.kernel.she
ll, config=osgibundle:/META-INF/spring/*.xml): startup date [Mon Dec 10 11:40:04 UTC 2012]; root of context hierarchy
[2012-12-10 15:33:27.495] INFO kernel-dm-10 …Run Code Online (Sandbox Code Playgroud) 我们正在开发一个Web应用程序(我们称之为图像库),我们已经确定了以下需求:
问题:我们应该在标准的OSGi框架上构建它还是我们更好地使用其中一个新兴的应用程序框架(Virgo,Aries或即将推出的OSGi标准)?
更多背景和一些初步想法:
我们正在构建一个网络应用程序,我们预计很快就会有数百个客户(公司),每个用户数量达到数百名(员工),否则为什么会这么麻烦;).我们希望使其模块化,因此OSGi.在未来,客户自己可能会开发和插入组件到他们的应用程序,因此我们需要客户隔离.我们也可能希望不同的客户获得不同的功能集.
当不同的客户端共享相同的捆绑包时,为应用程序的不同客户端提供不同的服务实现的"正确"方法是什么?
我们可以使用app-server方法(我们已经查看过Virgo)并将每个客户的每个包加载到他们自己的"app"中.然而,它不喜欢拥抱OSGi.我们没有托管多个应用程序,99%的服务将共享相同的impl.为所有客户.我们还希望将应用程序作为一个进行管理(配置,监视等).
每个服务都可以为每个客户注册(正确配置)一次,以及一些"客户令牌"属性.它有点乱,需要使用扩展模式或ManagedServiceFactory来处理?在为客户A注册服务之前,还需要获取每个依赖项的A版本.
每个请求都将知道"当前"客户,并且可以绑定到该线程.每次搜索服务时都必须提供客户令牌,这有点乱.这使得很难使用蓝图等组件框架.为了解决这个问题,我们可以使用服务挂钩来代理每个注册的服务类型,并让代理根据当前客户(线程)调度到正确的实例.
通过实现上面的解决方法(hack?)来开始我们整个OSGi体验真的感觉就像是我们走错了路.那我们该怎么办?回到处女座?尝试类似于上面概述的内容?有什么完全不同的东西?!
PS.感谢您一直在这里阅读!;)
我正在使用Spring MVC和Virgo Webserver在OSGi应用程序上开发一个模块.
在我的模块上,我有一个Controller,它可以访问Manager,它有一个负责处理报告生成的处理程序列表.
一切都很好,直到我不得不从外部服务调用事务方法.由于我的所有类都不是事务性的,因此我必须将引用添加到转换管理器和annotation-driven.然后,我的经理停止接到通知.
我知道当使用annotation-driven我的所有bean时必须实现一个公共接口,以便代理机制能够工作.据我所知,所有课程都是(其中一个不是,但后来我改了).
我的配置文件是:
束-context.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<context:annotation-config />
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="reportManager" class="reportmodule.manager.impl.ReportManagerImpl"/>
<bean id="mvpepReportHandler" class="reportmodule.manager.impl.MVPEPReportHandler"/>
<bean id="reportConfigDao" class="reportmodule.repository.impl.ReportConfigurationHibernateDAOImpl"/>
<bean id="oSGIChangeReportHandler" class="reportmodule.osgi.impl.OSGIChangeReportHandlerImpl"/>
<bean id="reportController"
class="reportmodule.controller.impl.ReportControllerImpl"/>
<bean id="reportControllerHandlerMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>/module/reportController/**=reportController</value>
</property>
<property name="alwaysUseFullPath" value="true"></property>
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
我的bundle-osgi.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.springframework.org/schema/osgi-compendium
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd">
<osgi:reference id="transactionManager" interface="org.springframework.transaction.PlatformTransactionManager" />
<osgi:reference …Run Code Online (Sandbox Code Playgroud) 嘿,
Eclipse Virgo和Eclipse Gemini有什么区别?
(我理解OSGI的一般做法).
我是OSGi主题的新手,但尝试了解一下这项技术.
经过一些研究我无法找到问题的答案,eclipse处女座和apache servicemix之间的真正区别是什么?
我自己揭示了这个谜团:我已经看过两者了,首先我认为virgo似乎是像osgi的web服务器一样的想法,而servicemix更像是公共汽车.但后来我看到,服务组合附加了jetty,甚至我可以添加web控制台功能到浏览器的托管servicemix,并得到完全混淆.现在我不知道,mayby virgo和servicemix是同一种软件,但是有不同的捆绑和生产者(simmilar到例如jetty和tomcat)?
我会非常感谢一些信息.对不起,如果我的问题很愚蠢并且回答非常简单,但正如我之前所说的那样,我对这项技术感兴趣:)
我需要等待一段时间才能关闭我的OSGI上下文.(花一些时间来完成当前正在运行的任务).我shutdown.wait.time在extenderProperties豆里遇到了财产.
任何人都可以让我知道如何使用这个OSGi片段来实现我的目标?我想我可以将一个片段包附加到我现有的OSGI包中.
提前致谢.感谢您的帮助.
osgi ×7
java ×4
spring ×3
spring-dm ×2
amazon-ec2 ×1
equinox ×1
spring-mvc ×1
ssh ×1
tomcat ×1