如何使用 Eclipse RCP/RAP 项目中的 spring-roo 实体

发布于 2024-08-23 06:09:13 字数 2074 浏览 6 评论 0原文

我使用 spring-roo 创建了一个域模型,它大量使用了 Spring 和 AspectJ。我的模型作为 OSGi 包很好地部署,并且从 Spring STS(基于 eclipse)IDE,我可以调用实体类等。

我需要从 Eclipse RCP/RAP 应用程序访问这些域类,并且这个项目我保留在用于 RCP/RAP 开发的普通 Eclipse IDE 中(即它具有所有 PDE 工具)。我还添加了 STS 和 AspectJ 插件。

我将域包添加到目标平台,并使我的 Eclipse RAP 应用程序依赖于它。当我运行 RAP 应用程序时,我可以看到我的域包已部署在 OSGi 中(即它处于活动状态)。当我添加依赖项时,我还看到它存在于 PDE 编辑器中。

但是,当我尝试导入和使用任何域类时,我什么也没得到。我什至无法从 Java 文件编辑器中看到域包。

我尝试将 AspectJ 和 Spring 特性添加到我的 RAP 项目中,但仍然一无所获。

此外,运行 Eclipse RAP 应用程序时,一切都部署正常,但 RAP 应用程序除外,它会引发以下异常:

2010 年 3 月 2 日上午 2:44:58 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息:从 URL 加载 XML bean 定义 [bundleentry://168.fwk1096264275/META-INF/spring/applicationContext.xml] 线程“SpringOsgiExtenderThread-2”java.lang.IllegalStateException中出现异常:BeanFactory未初始化或已关闭 - 在通过ApplicationContext访问bean之前调用“刷新” 在org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171) 在org.springframework.osgi.extender.internal.dependency.startup.DependencyWaiterApplicationContextExecutor.close(DependencyWaiterApplicationContextExecutor.java:345) 在org.springframework.osgi.extender.internal.dependency.startup.DependencyWaiterApplicationContextExecutor.fail(DependencyWaiterApplicationContextExecutor.java:401) 在org.springframework.osgi.extender.internal.dependency.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:287) 在org.springframework.osgi.extender.internal.dependency.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:175) 在org.springframework.osgi.context.support.AbstractDeleatedExecutionApplicationContext.refresh(AbstractDeleeratedExecutionApplicationContext.java:175) 在 org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:718) 在 java.lang.Thread.run(Thread.java:637)

任何帮助将不胜感激。

I have created a domain model using spring-roo, which makes heavy use of Spring and AspectJ. My model is deploying nicely as a OSGi bundle, and from the Spring STS (eclipse-based) IDE, I can call the entity classes, etc.

I need to access these domain classes from a Eclipse RCP/RAP application, and this project I keep in the normal Eclipse IDE for RCP/RAP development (i.e. it has all the PDE tools). I also added the STS and AspectJ plugins.

I added my domain bundle to the target platform, and made my Eclipse RAP app dependent on it. When I run the RAP application, I can see that my domain bundle is deployed in OSGi (i.e. it is ACTIVE). I also see that it exists in the PDE editor when I added the dependency.

However, when I try to import and use any of the domain classes, I get nothing. I can't even see the domain packages from my Java file editor.

I have tried to add a AspectJ and Spring nature to my RAP project, but still nothing.

Also, when running the Eclipse RAP application, everything deploys fine, except the RAP application, which throws the following exception:

Mar 2, 2010 2:44:58 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from URL [bundleentry://168.fwk1096264275/META-INF/spring/applicationContext.xml]
Exception in thread "SpringOsgiExtenderThread-2" java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.close(DependencyWaiterApplicationContextExecutor.java:345)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.fail(DependencyWaiterApplicationContextExecutor.java:401)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:287)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:175)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:718)
at java.lang.Thread.run(Thread.java:637)

Any help would be highly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

戒ㄋ 2024-08-30 06:09:13

也许您应该尝试不要将 Roo 项目构建为 jar,而是从您的 RCP 项目引用该项目。

Maybe you should try not to build Roo project to jar, but reference this project from your RCP project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文