Springspectj jar 未正确配置
当我尝试使用 Roo 创建的 JPA 对象时,出现此错误。
尚未注入实体管理器(Spring Aspects JAR 是否配置为 AJC/AJDT 方面库?)
我已经按照一些在线建议将 spring-aspects.jar 添加到 Eclipse 中的aspectj路径,但我仍然收到此错误。有谁知道如何解决这个问题?
我使用的环境是Spring 3.0.5、Hibernate 3.6和JBoss 6.0.0.Final。
I am getting this error when I tried to use a JPA object created by Roo.
Entity manager has not been injected (is the Spring Aspects JAR configured as an
AJC/AJDT aspects library?)
I have followed some online advice to add the spring-aspects.jar to aspectj path in Eclipse but I still get this error. Does anyone know how to solve this?
The environment I am using is Spring 3.0.5, Hibernate 3.6 and JBoss 6.0.0.Final.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
转到 STS ROO 控制台(在 STS 中的项目中右键单击,然后单击 Spring Tools,然后单击 Open Spring Roo)
在提示符下输入perform clean(将执行Maven clean)
然后输入执行 eclipse
它应该可以工作!
Go to STS ROO console (right click in the project in STS, then Spring Tools, then Open Spring Roo)
Type in the prompt perform clean (will perform Maven clean)
Then type perform eclipse
It should work!
看来您还没有注入实体管理器。
Webapps(可能的原因):
Java 应用程序:
Looks like you haven't injected Entity Manager.
Webapps (possible causes):
Java Applications:
Wrong application initialization (see below)
我也遇到了这个问题,并在这里找到了答案: http://whyjava.wordpress.com/2012/02/13/fixing-exception-entity- manager-has-not-been-injected-is-the-spring-aspects-jar-configured-as-an-ajcajdt-aspects-library/
在我的例子中,我需要创建一个名为
的文件_Roo_Configurable.aj
包含以下内容:特权方面_Roo_Configurable { 声明 @type:: @Configurable;这
解释了为什么现有的类可以工作,但我创建的新类却不能。 _Configurable.aj 文件没有(并且仍然没有)显示在 STS 的包资源管理器中。
(我知道这个答案太晚了,但我希望它对其他人有帮助!)
I had this problem too, and found the answer here: http://whyjava.wordpress.com/2012/02/13/fixing-exception-entity-manager-has-not-been-injected-is-the-spring-aspects-jar-configured-as-an-ajcajdt-aspects-library/
In my case, I needed to create a file called
<classname>_Roo_Configurable.aj
with the following content:privileged aspect <classname>_Roo_Configurable { declare @type: <classname>: @Configurable; }
This explained why existing classes worked but new ones that I had created did not. The _Configurable.aj file did not (and still does not) show up in the package explorer in STS.
(I know this answer is incredibly late but I hope it helps someone else!)
我遇到了同样的问题,并通过执行 Spring Tools | 解决了它在我的项目上启用 Spring Aspects 工具。
我的类是由 Roo 生成并推入的(我遇到了太多问题),我只是将它们添加到我创建的全新 Google Web 应用程序项目中(因此它使用带有 war 目录的 GAE 应用程序布局,并且没有Maven 适合任何东西,至少现在还不是)。
I was having this same issue and fixed it by doing Spring Tools | Enable Spring Aspects Tooling on my project.
My classes were generated by Roo and pushed in (I was having way too many issues with it), and I simply added them to a brand new Google Web Application Project I created (so it uses GAE's app layout with a war directory, and no Maven for anything, at least not yet).
您必须为指示域创建存储库。
在 roo-terminal 中运行以下脚本
es。
You have to create the repository for the indicate domain.
In roo-terminal run the follow script
es.