如何在运行时执行openJPA增强?

时间:2013-10-11 14:15:14

标签: java deployment openjpa tomee

我正在尝试使用openJPA faset将动态Web项目部署到TomEE Plus服务器。但是,当我在服务器上启动应用程序时,它会给我以下错误:

  

111 INFO [main] openjpa.Runtime - OpenJPA动态加载验证提供程序。   131 INFO [main] openjpa.Runtime - 启动OpenJPA 2.2.0   202 INFO [main] openjpa.jdbc.JDBC - 使用字典类" org.apache.openjpa.jdbc.sql.MySQLDictionary"。

Exception in thread "main" <openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types 
were not enhanced at build time or at class load time with a javaagent: "
    de.webshop.internal.db.Producer
    de.webshop.internal.db.Stock
    de.webshop.internal.db.Product".

at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:115)
at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:314)
at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:238)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
at de.webshop.inventory.service.business.logic.utils.ProductAvailabilityInStock.isEnoughProductsInStock(ProductAvailabilityInStock.java:43)
at de.webshop.inventory.service.implementation.InventoryWebService.CheckOrderItemsAvailability(InventoryWebService.java:52)
at test.de.webshop.TestClass.testWBService(TestClass.java:40)
at test.de.webshop.TestClass.main(TestClass.java:12)

你有什么建议?

1 个答案:

答案 0 :(得分:0)

您可以在构建时增强,或者需要为运行时增强定义代理,例如:“ java -javaagent:./ lib / openjpa-all-2.2.2.jar ... com.xyz 。主要