OpenJPA 增强 Spring ROO 批处理应用程序
我对 OpenJPA 很陌生,想运行我的应用程序。我已经创建了一个 main 方法,并在那里加载上下文 XML,并启动一个事务来运行我的服务。但是当我运行它时,我得到一个
org.apache.openjpa.persistence.ArgumentException: The type "class tld.myproject.域.实体”尚未得到增强。
我谷歌了一下,发现我需要添加一个增强器,所以我在命令行中添加了以下内容:
-javaagent:/home/me/.m2/repository/org/apache/openjpa/openjpa/2.0。 1/openjpa-2.0.1.jar
现在,我得到了
java.lang.LinkageError: loader (instance of sun/misc/Launcher$AppClassLoader): attempts 重复的类定义名称:“org/springframework/stereotype/Controller”
也许是只是已经晚了,我的头脑还不太清醒,但是,这里到底发生了什么?我需要做什么才能让我的 Spring Roo 批处理项目运行?
干杯
Nik
PS,我可能应该在我的 pom.xml 中添加 Roo 为编译阶段定义了一个增强器
I'm quite new to OpenJPA and wanted to run my application. I've made a main method and load the context XML there and fire up a transaction to run my service in. But when I run it I get a
org.apache.openjpa.persistence.ArgumentException: The type "class tld.myproject.domain.Entity" has not been enhanced.
I Google'd around and found that I'd need to add an enhancer, so I added the following to my command line:
-javaagent:/home/me/.m2/repository/org/apache/openjpa/openjpa/2.0.1/openjpa-2.0.1.jar
Now, I get
java.lang.LinkageError: loader (instance of sun/misc/Launcher$AppClassLoader): attempted duplicate class definition for name: "org/springframework/stereotype/Controller"
Perhaps it's just getting late and I don't have my head screwed right on, but, what on earth is going on here? What do I need to do to get my Spring Roo batch project running?
Cheers
Nik
PS, I should probably add that in my pom.xml Roo has defined an enhancer for the compile phase
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能应该使用 javaagent 的编译时增强而不是运行时增强。
如果您正在使用 m2eclipse (您可能会这样做),那么使用类似以下内容就足够了:
在 pom.xml 的构建部分中,您应该有类似的内容:
请注意,roo 可能会生成可能不起作用的不同 xml 片段(IIRC 它使用不同的输出目录)。
清理后,您的项目类应该得到增强。
You should probably use compile time enhancement instead of runtime enhancement with javaagent.
If you're using m2eclipse (you probably do) it would be enough to use something like:
and inside build section of your pom.xml you should have something like:
Please note that roo might generate different xml snippet that might not work (IIRC it uses different output directory).
After you clean your project classes should be enhanced.