Я разрабатываю приложение, используя SPRING 3.0.4, JPA 2, Hibernate 3.5.5.
Я пытаюсь использовать существующий пример, приведенный по ссылке http://www.javacodegeeks.com/2010/05/jboss-42x-spring-3-jpa-hibernate.html.
, единственное отличие состоит в том, чтоЯ использую последние версии библиотек и сервера JBOSS.
Ниже приведен список файлов моего каталога / WEB-INF / lib
antlr-2.7.6.jar
aopalliance.jar
c3p0-0.9.1.jar
commons-collection-3.1.jar
commons-logging-1.1.1.jar
dom4j-1.6.1.jar
gwt-dev.jar
gwt-user.jar
hibernate3.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
hsqldb.jar
javassist-3.9.0.GA.jar
jta-1.1.jar
log4j-1.2.16.jar
org.springframework.aop-3.0.4.RELEASE.jar
org.springframework.asm-3.0.4.RELEASE.jar
org.springframework.aspects-3.0.4.RELEASE.jar
org.springframework.beans-3.0.4.RELEASE.jar
org.springframework.context.support-3.0.4.RELEASE.jar
org.springframework.context-3.0.4.RELEASE.jar
org.springframework.core-3.0.4.RELEASE.jar
org.springframework.expression-3.0.4.RELEASE.jar
org.springframework.instrument.tomcat-3.0.4.RELEASE.jar
org.springframework.instrument-3.0.4.RELEASE.jar
org.springframework.jdbc-3.0.4.RELEASE.jar
org.springframework.jms-3.0.4.RELEASE.jar
org.springframework.orm-3.0.4.RELEASE.jar
org.springframework.oxm-3.0.4.RELEASE.jar
org.springframework.test-3.0.4.RELEASE.jar
org.springframework.transaction-3.0.4.RELEASE.jar
org.springframework.web.portlet-3.0.4.RELEASE.jar
org.springframework.web.servlet-3.0.4.RELEASE.jar
org.springframework.web.struts-3.0.4.RELEASE.jar
org.springframework.web-3.0.4.RELEASE.jar
slf4j-api-1.5.8.jar
slf4j-log4j12-1.6.1.jar
spring4gwt-0.0.1.jar
Ниже мой файл /WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8"?>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Servlets -->
<servlet>
<servlet-name>springGwtRemoteServiceServlet</servlet-name>
<servlet-class>org.spring4gwt.server.SpringGwtRemoteServiceServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>springGwtRemoteServiceServlet</servlet-name>
<url-pattern>/gwtspring/springGwtServices/*</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>GWTSpring.html</welcome-file>
</welcome-file-list>
Ниже мой /Файл WEB-INF / applicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-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/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<context:component-scan base-package="com.javacodegeeks.gwtspring" />
<task:annotation-driven executor="myExecutor" scheduler="myScheduler" />
<task:executor id="myExecutor" pool-size="5" />
<task:scheduler id="myScheduler" pool-size="10" />
<tx:annotation-driven />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="MyPersistenceUnit" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
Ниже приведен мой файл /src/resources/META-INF/petsistence.xml
<persistence 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"
version="2.0">
<persistence-unit name="MyPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>java:/gwtDS</non-jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:salvation" />
<property name="hibernate.connection.username" value="sa" />
<property name="hibernate.connection.password" value="" />
<property name="hibernate.c3p0.min_size" value="5" />
<property name="hibernate.c3p0.max_size" value="20" />
<property name="hibernate.c3p0.timeout" value="300" />
<property name="hibernate.c3p0.max_statements" value="50" />
<property name="hibernate.c3p0.idle_test_period" value="3000" />
</properties>
</persistence-unit>
Теперь, когда я пытаюсь скомпилировать его с использованием сервера JBOSS, он выдает мне следующую ошибку
11: 34: 17,828 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build): SVNTag = JBoss_5_1_0_GA date = 200905221053)] Начато в 19 с: 985 мс 11: 34: 28 437 INFO [PersistenceUnitDeployment] Запуск единицы сохраняемости persistence.unit: unitName = # MyPersistenceUnit 11: 34: 29 046 ОШИБКА при установке [AbstractKernelController]: имя_контроллера ошибки]persistence.unit: unitName = # MyPersistenceUnit state = Создать java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence не может быть приведен к javax.persistence.spi.PersistenceProvider в org.jboss.jpa.deployment.PersistenceUnitDeployment.PersistenceUnitDeployment.Java: 300) в sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) в sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) в sun.reflect.DelegatingMethodAccessorImpl.jetj.jj.Method.invoke (Method.java:597) в org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke (ReflectionUtils.java:59) в org.jboss.reflect.plugins.introspection.ReflectMethodInfokempljl: 150) в org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch (BasicMethodJoinPoint.java:66) в org.jboss.kernel.plugins.dependency.KernelControllerContextAction $ JoinpointDispatchWrass.ontj.j.jerbo.Agkernel.plugins.dependency.ExecutionWrapper.execute (ExecutionWrapper.java:47)в org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper (KernelControllerContextAction.java:109)
в org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint (KernelControllerContextAction.java:70)
в org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal (LifecycleAction.java:221)
в org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction (InstallsAwareAction.java:54)
в org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction (InstallsAwareAction.java:42)
в org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction (SimpleControllerContextAction.java:62)
в org.jboss.dependency.plugins.action.AccessControllerContextAction.install (AccessControllerContextAction.java:71)
в org.jboss.dependency.plugins.AbstractControllerContextActions.install (AbstractControllerContextActions.java:51)
в org.jboss.dependency.plugins.AbstractControllerContext.install (AbstractControllerContext.java:348)
в org.jboss.dependency.plugins.AbstractController.install (AbstractController.java:1631)
в org.jboss.dependency.plugins.AbstractController.incrementState (AbstractController.java:934)
в org.jboss.dependency.plugins.AbstractController.resolveContexts (AbstractController.java:1082)
в org.jboss.dependency.plugins.AbstractController.resolveContexts (AbstractController.java:984)
в org.jboss.dependency.plugins.AbstractController.install (AbstractController.java:774)
в org.jboss.dependency.plugins.AbstractController.install (AbstractController.java:540)
в org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy (BeanMetaDataDeployer.java:121)
в org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy (BeanMetaDataDeployer.java:51)
в org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy (AbstractSimpleRealDeployer.java:62)
в org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy (AbstractRealDeployer.java:50)
в org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy (DeployerWrapper.java:171)
в org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy (DeployersImpl.java:1439)
в org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst (DeployersImpl.java:1157)
в org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst (DeployersImpl.java:1178)
в org.jboss.deployers.plugins.deployers.DeployersImpl.install (DeployersImpl.java:1098)
в org.jboss.dependency.plugins.AbstractControllerContext.install (AbstractControllerContext.java:348)
в org.jboss.dependency.plugins.AbstractController.install (AbstractController.java:1631)
в org.jboss.dependency.plugins.AbstractController.incrementState (AbstractController.java:934)
в org.jboss.dependency.plugins.AbstractController.resolveContexts (AbstractController.java:1082)
в org.jboss.dependency.plugins.AbstractController.resolveContexts (AbstractController.java:984)
в org.jboss.dependency.plugins.AbstractController.change (AbstractController.java:822)
в org.jboss.dependency.plugins.AbstractController.change (AbstractController.java:553)
в org.jboss.deployers.plugins.deployers.DeployersImpl.process (DeployersImpl.java:781)
в org.jboss.deployers.plugins.main.MainDeployerImpl.process (MainDeployerImpl.java:702)
в org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process (MainDeployerAdapter.java:117)
в org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan (HDScanner.java:362)
в org.jboss.system.server.profileservice.hotdeploy.HDScanner.run (HDScanner.java:255)
в java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java:441)
at java.util.concurrent.FutureTask $ Sync.innerRunAndReset (FutureTask.java:317)по адресу java.util.concurrent.FutureTask.runAndReset (FutureTask.java:150) по адресу java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 101 (ScheduledThreadPoolExecutor.java:98).ScheduledThreadPoolExecutor.java:181) в java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:205) в java.util.concurrent.ThreadPoolExecutor.java.jun.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:908) в java.lang.Thread.run (Thread.java:619)
Может ли кто-нибудь здесь помочь мне решить проблему.
Пожалуйста, дайте мне знать, если вам нужно что-нибудь еще от меня.
Спасибо.