0

我正在尝试从 JBOSS Web 应用程序连接到 Maria DB。

我使用数据源进行连接。

我的 hibernate.cfg 文件

    <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
    <property name="hibernate.connection.driver_class">org.mariadb.jdbc.Driver</property>
 <property name="hibernate.connection.datasource">java:/datasources/KDCDBM</property>
    <property name="hibernate.current_session_context_class">thread</property>
    <property name="hibernate.show_sql">true</property>
    <property name="show_sql">true</property> 
    <property name="hbm2dll.auto">update</property>
    <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

    <mapping resource="com/mycompany/Contact.hbm.xml"/>

当我打开我的应用程序并尝试连接时。我收到以下错误

13:07:01,387 INFO  [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 60) HV000001: Hibernate Validator 4.3.3.Final-redhat-1
13:07:01,391 ERROR [stderr] (ServerService Thread Pool -- 60) org.hibernate.HibernateException: Error applying BeanValidation relational constraints
13:07:01,391 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:219)
13:07:01,391 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:126)
13:07:01,391 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:301)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at com.kony.p2p.services.integration.serviceimpl.batch.CronJobsImpl.startCronJob(CronJobsImpl.java:136)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at com.kony.p2p.servlet.DBSBatchJobServlet.invokeCronJobs(DBSBatchJobServlet.java:66)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at com.kony.p2p.servlet.DBSBatchJobServlet.contextInitialized(DBSBatchJobServlet.java:39)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.apache.catalina.core.StandardContext.start(StandardContext.java:3780)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:163)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:61)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.lang.Thread.run(Thread.java:745)
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.jboss.threads.JBossThread.run(JBossThread.java:122)
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60) Caused by: java.lang.reflect.InvocationTargetException
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.lang.reflect.Method.invoke(Method.java:498)
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:208)
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   ... 17 more
13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60) Caused by: java.lang.IllegalAccessError: tried to access class javax.persistence.Persistence$1 from class javax.persistence.Persistence
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at javax.persistence.Persistence.<clinit>(Persistence.java:87)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.lang.Class.newInstance(Class.java:442)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.util.privilegedactions.NewInstance.run(NewInstance.java:48)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.run(DefaultTraversableResolver.java:156)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.detectJPA(DefaultTraversableResolver.java:101)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.<init>(DefaultTraversableResolver.java:67)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:74)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:41)
13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)
13:07:01,395 ERROR [stderr] (ServerService Thread Pool -- 60)   at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
13:07:01,395 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:521)
13:07:01,395 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:119)
13:07:01,395 ERROR [stderr] (ServerService Thread Pool -- 60)   ... 22 more
4

1 回答 1

0

这个属性解决了我的问题..

没有任何

于 2017-04-03T03:10:23.850 回答