我在Struts2.0.14,Spring 3.0.0M1,Spring Security 3.0.0M2,Eclipselink 1.1.2中有我的应用程序的工作副本,
现在我正在努力将其升级到最新版本的框架,所以我把Struts 2.3.4,Spring 3.1.2,Spring security 3.1.1,Eclipselink 2.4.0 jar文件。
现在,当我运行程序时,它会给出,
java.lang.ClassCastException: org.eclipse.persistence.platform.database.oracle.Oracle11Platform cannot be cast to org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
这是sessions.mxl文件
<!-- server security -->
<session xsi:type="server-session">
<name>dbsession_new</name>
<event-listener-classes/>
<logging xsi:type="toplink-log"/>
<login xsi:type="database-login">
<platform-class>org.eclipse.persistence.platform.database.oracle.Oracle11Platform</platform-class>
<user-name>TEMPDB</user-name>
<password>TEMPPWD</password>
<sequencing>
<default-sequence xsi:type="native-sequence">
<name>Native</name>
</default-sequence>
</sequencing>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<connection-url>jdbc:oracle:thin:@11.101.102.42:1521:ORCL</connection-url>
</login>
<connection-pools>
<read-connection-pool>
<name>ReadConnectionPool</name>
</read-connection-pool>
<write-connection-pool>
<name>default</name>
</write-connection-pool>
</connection-pools>
<connection-policy/>
的persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="healthPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.sessions-xml" value="META-INF/sessions.xml"/>
<property name="eclipselink.session-name" value="dbsession_new"/>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.oracle.Oracle11Platform"/>
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.logging.timestamp" value="true"/>
<property name="eclipselink.logging.thread" value="true"/>
<property name="eclipselink.logging.session" value="true"/>
</properties>
</persistence-unit>
</persistence>
Spring security Xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<global-method-security secured-annotations="enabled" />
<http auto-config="true" access-denied-page="/deniedAccess.jsp">
<intercept-url pattern="/source/admin/**" access="ROLE_PowerUser" />
<intercept-url pattern="/login.action" access=". . .
<form-login . . .
<logout logout-success-url=". . .
<remember-me key="myAppKey" data-source-ref="dataSource" />
</http>
<authentication-manager>
<authentication-provider>
<password-encoder hash="sha-256" base64="true"/>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query=" . . . authorities-by-username-query=" . . . />
</authentication-provider>
</authentication-manager>
<beans:bean id="springSecurityFilterChain" class="org.springframework.security.util.FilterChainProxy">
<filter-chain-map path-type="ant">
<filter-chain pattern="/**" filters="sif"/>
</filter-chain-map>
</beans:bean>
<beans:bean id="sif" class="org.springframework.security.web.context.SecurityContextPersistenceFilter" />
</beans:beans>
ApplicationContext xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="healthPU"/>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect" />
</property>
<property name="jpaProperties">
<props>
<prop key="eclipselink.logging.level">FINEST</prop>
<prop key="eclipselink.ddl-generation">create-tables</prop>
<prop key="eclipselink.cache.type.default">HardWeak</prop>
<prop key="eclipselink.cache.size.default">5000</prop>
</props>
</property>
<property name="jpaVendorAdapter" ref="vendorAdapter"/>
<property name="persistenceUnitManager" ref="persistenceUnitManager" />
</bean>
<bean id="loadTimeWeaver" class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
<bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
<property name="loadTimeWeaver" ref="loadTimeWeaver"/>
<property name="persistenceXmlLocations">
<list>
<value>classpath*:META-INF/persistence.xml</value>
</list>
</property>
</bean>
<bean id="vendorAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="databasePlatform" value="org.eclipse.persistence.platform.database.oracle.Oracle11Platform" />
<property name="showSql" value="true"/>
</bean>
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<!--IOC Action Mapings beans start-->
<!-- Action Mapings beans end -->
</beans>