比较来自世界各地的卖家的域名和 IT 服务价格

EclipseLinkJpaVendorAdapter 反而 HibernateJpaVendorAdapter issue

使用包含的应用程序 JSF, Spring 和 Hibernate. 我的示例工作正常,然后在我改变时 class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" 在 class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter", 申请无法正常工作。 问题是什么? 任何一个都是 JPA spesificition impelementation.


xml version="1.0" encoding="UTF-8"?
<beans xmlns="[url=http://www.springframework.org/schema/beans"]http://www.springframework.org/schema/beans"[/url] xmlns:aop="[url=http://www.springframework.org/schema/aop"]http://www.springframework.org/schema/aop"[/url] xmlns:context="[url=http://www.springframework.org/schema/context"]http://www.springframework.org ... ot%3B[/url] xmlns:jee="[url=http://www.springframework.org/schema/jee"]http://www.springframework.org/schema/jee"[/url] xmlns:p="[url=http://www.springframework.org/schema/p"]http://www.springframework.org/schema/p"[/url] xmlns:tx="[url=http://www.springframework.org/schema/tx"]http://www.springframework.org/schema/tx"[/url] xmlns:xsi="[url=http://www.w3.org/2001/XMLSchema-instance"]http://www.w3.org/2001/XMLSchema-instance"[/url] xsi:schemalocation="
[url=http://www.springframework.org/schema/aop]http://www.springframework.org/schema/aop[/url]
[url=http://www.springframework.org/schema/aop/spring-aop-3.0.xsd]http://www.springframework.org ... 0.xsd[/url]
[url=http://www.springframework.org/schema/beans]http://www.springframework.org/schema/beans[/url]
[url=http://www.springframework.org/schema/beans/spring-beans-3.0.xsd]http://www.springframework.org ... 0.xsd[/url]
[url=http://www.springframework.org/schema/context]http://www.springframework.org/schema/context[/url]
[url=http://www.springframework.org/schema/context/spring-context-3.0.xsd]http://www.springframework.org ... 0.xsd[/url]
[url=http://www.springframework.org/schema/jee]http://www.springframework.org/schema/jee[/url]
[url=http://www.springframework.org/schema/jee/spring-jee-3.0.xsd]http://www.springframework.org ... 0.xsd[/url]
[url=http://www.springframework.org/schema/tx]http://www.springframework.org/schema/tx[/url]
[url=http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">]http://www.springframework.org ... gt%3B[/url]
<context:annotation-config></context:annotation-config>
<context:component-scan base-package="com.usta.spring"></context:component-scan>
<tx:annotation-driven></tx:annotation-driven>
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory" p:datasource-ref="dataSource">
<!-- p:jpaVendorAdapter-ref="jpaAdapter"-->
<!-- <property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
</property> -->
<property name="jpaVendorAdapter" ref="jpaAdapter">
</property>
<property name="persistenceUnitName" value="Spring_PU"></property>
</bean>
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="dataSource" p:driverclassname="com.mysql.jdbc.Driver" p:password="root" p:url="jdbc:mysql://localhost/spring" p:username="root"></bean>
<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"></property>
</bean>
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" id="jpaAdapter">
<property name="showSql" value="true"></property>
<property name="generateDdl" value="true"></property>
<property name="database" value="MYSQL"></property>
</bean>
<!-- <bean id="jpaAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
p:database="MYSQL" p:showSql="true" p:generateDdl="true" /> -->
<!-- <bean id="yazikontrolor" class="com.usta.spring.YaziKontolor" scope="request"/> -->
</beans>


错误 :


May 27, 2012 7:21:49 AM org.apache.catalina.core.ApplicationContext log
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'yaziServisi': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/marmara.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues/PersistenceAnnotationBeanPostProcessor.java:341/
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean/AbstractAutowireCapableBeanFactory.java:1073/
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean/AbstractAutowireCapableBeanFactory.java:516/
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean/AbstractAutowireCapableBeanFactory.java:455/
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject/AbstractBeanFactory.java:293/
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton/DefaultSingletonBeanRegistry.java:222/
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean/AbstractBeanFactory.java:290/
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean/AbstractBeanFactory.java:192/
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons/DefaultListableBeanFactory.java:585/
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization/AbstractApplicationContext.java:895/
at org.springframework.context.support.AbstractApplicationContext.refresh/AbstractApplicationContext.java:425/
at org.springframework.web.context.ContextLoader.createWebApplicationContext/ContextLoader.java:282/
at org.springframework.web.context.ContextLoader.initWebApplicationContext/ContextLoader.java:204/
at org.springframework.web.context.ContextLoaderListener.contextInitialized/ContextLoaderListener.java:47/
at org.apache.catalina.core.StandardContext.listenerStart/StandardContext.java:4206/
at org.apache.catalina.core.StandardContext.start/StandardContext.java:4705/
at org.apache.catalina.core.ContainerBase.addChildInternal/ContainerBase.java:799/
at org.apache.catalina.core.ContainerBase.addChild/ContainerBase.java:779/
at org.apache.catalina.core.StandardHost.addChild/StandardHost.java:601/
at org.apache.catalina.startup.HostConfig.deployDescriptor/HostConfig.java:675/
at org.apache.catalina.startup.HostConfig.deployDescriptors/HostConfig.java:601/
at org.apache.catalina.startup.HostConfig.deployApps/HostConfig.java:502/
at org.apache.catalina.startup.HostConfig.start/HostConfig.java:1317/
at org.apache.catalina.startup.HostConfig.lifecycleEvent/HostConfig.java:324/
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent/LifecycleSupport.java:142/
at org.apache.catalina.core.ContainerBase.start/ContainerBase.java:1065/
at org.apache.catalina.core.StandardHost.start/StandardHost.java:840/
at org.apache.catalina.core.ContainerBase.start/ContainerBase.java:1057/
at org.apache.catalina.core.StandardEngine.start/StandardEngine.java:463/
at org.apache.catalina.core.StandardService.start/StandardService.java:525/
at org.apache.catalina.core.StandardServer.start/StandardServer.java:754/
at org.apache.catalina.startup.Catalina.start/Catalina.java:595/
at sun.reflect.NativeMethodAccessorImpl.invoke0/Native Method/
at sun.reflect.NativeMethodAccessorImpl.invoke/NativeMethodAccessorImpl.java:57/
at sun.reflect.DelegatingMethodAccessorImpl.invoke/DelegatingMethodAccessorImpl.java:43/
at java.lang.reflect.Method.invoke/Method.java:601/
at org.apache.catalina.startup.Bootstrap.start/Bootstrap.java:289/
at org.apache.catalina.startup.Bootstrap.main/Bootstrap.java:414/
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/marmara.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean/AbstractAutowireCapableBeanFactory.java:1422/
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean/AbstractAutowireCapableBeanFactory.java:518/
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean/AbstractAutowireCapableBeanFactory.java:455/
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject/AbstractBeanFactory.java:293/
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton/DefaultSingletonBeanRegistry.java:222/
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean/AbstractBeanFactory.java:290/
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean/AbstractBeanFactory.java:192/
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory/PersistenceAnnotationBeanPostProcessor.java:529/
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory/PersistenceAnnotationBeanPostProcessor.java:495/
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager/PersistenceAnnotationBeanPostProcessor.java:656/
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject/PersistenceAnnotationBeanPostProcessor.java:629/
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject/InjectionMetadata.java:147/
at org.springframework.beans.factory.annotation.InjectionMetadata.inject/InjectionMetadata.java:84/
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues/PersistenceAnnotationBeanPostProcessor.java:338/
... 37 more
Caused by: java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
已邀请:

窦买办

赞同来自:

默认 EclipseLink 期望

织造

在执行期间,它将被打开,否则您会收到错误消息 "无法在不指定的情况下应用类变换器 LoadTimeWeaver". 这意味着对于在装配或非编织期间使用编织的情况,您需要明确指定此行为。 禁用 EclipseLink 编织,您需要配置组件 EntityManagerFactory Spring 应用程序:


<property name="jpaPropertyMap">
<map>
<entry key="eclipselink.weaving" value="false"></entry>
</map>
</property>


或添加


<property name="eclipselink.weaving" value="false"></property>


到文件。 persistence.xml 你的申请。

我建议激活编织,因为这是表现出色的改善。

配置缺点的默认执行时间 EclipseLink, 添加以下内容:


<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"></bean>
</property>


鲍勃申请 EntityManagerFactory Spring.

然后将此参数添加到您的 JVM :


-javaagent:/path-to-your-javaagent/org.springframework.instrument-3.1.1.RELEASE.jar


在 Spring 3.x javaagent 本地化B. org.springframework.instrument jar.

你需要

图书馆 org.springframework.instrument 与图书馆一起

aspectjrt.jar



aspectjweaver.jar

.

关联

http://java.dzone.com/articles ... h%3D0
JPA

要回复问题请先登录注册