JBoss проблема загрузки классов - PullRequest
2 голосов
/ 10 января 2011

У меня есть веб-приложение (war-файл), которое отлично работает на tomcat.Теперь мне нужно поставить это же приложение для работы на JBoss 4.2.2.На том же экземпляре JBoss работают другие приложения.

Проблема в том, что я пытаюсь развернуть приложение war на JBoss.Это исключение, которое я получаю:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'postmanTask' defined in file [/Users/lorenooliveira/dev/jboss-4.2.2.GA/server/default/./tmp/deploy/tmp7909128750527758246vraptor-blank-project-exp.war/WEB-INF/classes/br/org/ampb/jobs/PostmanTask.class]: Unsatisfied dependency expressed through constructor argument with index 2 of type [br.org.ampb.util.ConfiguracoesSistema]: : Error creating bean with name 'configuracoesSistema' defined in file [/Users/lorenooliveira/dev/jboss-4.2.2.GA/server/default/./tmp/deploy/tmp7909128750527758246vraptor-blank-project-exp.war/WEB-INF/classes/br/org/ampb/util/ConfiguracoesSistema.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [br.org.ampb.util.ConfiguracoesSistema]: Constructor threw exception; nested exception is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configuracoesSistema' defined in file [/Users/lorenooliveira/dev/jboss-4.2.2.GA/server/default/./tmp/deploy/tmp7909128750527758246vraptor-blank-project-exp.war/WEB-INF/classes/br/org/ampb/util/ConfiguracoesSistema.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [br.org.ampb.util.ConfiguracoesSistema]: Constructor threw exception; nested exception is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:698)
 at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:192)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:984)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:886)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
 at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.start(SpringBasedContainer.java:68)
 at br.com.caelum.vraptor.ioc.spring.SpringProvider.start(SpringProvider.java:82)
 at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:110)
 at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:103)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3722)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4367)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
 at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
 at org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
 at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
 at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
 at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
 at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
 at org.jboss.web.WebModule.startModule(WebModule.java:83)
 at org.jboss.web.WebModule.startService(WebModule.java:61)
 at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
 at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
 at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
 at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
 at $Proxy0.start(Unknown Source)
 at org.jboss.system.ServiceController.start(ServiceController.java:417)
 at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
 at $Proxy44.start(Unknown Source)
 at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
 at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
 at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
 at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
 at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
 at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
 at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
 at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
 at $Proxy45.start(Unknown Source)
 at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
 at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
 at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
 at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
 at $Proxy9.deploy(Unknown Source)
 at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
 at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
 at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
 at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
 at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
 at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
 at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
 at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
 at $Proxy0.start(Unknown Source)
 at org.jboss.system.ServiceController.start(ServiceController.java:417)
 at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
 at $Proxy4.start(Unknown Source)
 at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
 at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
 at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
 at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
 at $Proxy5.deploy(Unknown Source)
 at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
 at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
 at org.jboss.Main.boot(Main.java:200)
 at org.jboss.Main$1.run(Main.java:508)
 at java.lang.Thread.run(Thread.java:680)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configuracoesSistema' defined in file [/Users/lorenooliveira/dev/jboss-4.2.2.GA/server/default/./tmp/deploy/tmp7909128750527758246vraptor-blank-project-exp.war/WEB-INF/classes/br/org/ampb/util/ConfiguracoesSistema.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [br.org.ampb.util.ConfiguracoesSistema]: Constructor threw exception; nested exception is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:946)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:820)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:762)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:680)
 at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:771)
 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:691)
 ... 154 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [br.org.ampb.util.ConfiguracoesSistema]: Constructor threw exception; nested exception is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
 at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:938)
 ... 166 more
Caused by: org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
 at org.hibernate.cfg.Configuration.applyHibernateValidatorLegacyConstraintsOnDDL(Configuration.java:1651)
 at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1623)
 at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1415)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1826)
 at br.org.ampb.util.ConfiguracoesSistema.atualizarConfiguracoes(ConfiguracoesSistema.java:26)
 at br.org.ampb.util.ConfiguracoesSistema.<init>(ConfiguracoesSistema.java:22)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
 ... 168 more
Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
 at java.lang.Class.getConstructor0(Class.java:2706)
 at java.lang.Class.getDeclaredConstructor(Class.java:1985)
 at org.hibernate.cfg.Configuration.applyHibernateValidatorLegacyConstraintsOnDDL(Configuration.java:1639)
 ... 178 more

Что ж, после некоторого поиска в Google я обнаружил, что это конфликт между банками спящего режима как в моем файле войны, так и в контейнере.

Есть ли способ сказать JBoss: «Эй, моему приложению не нужны ваши библиотеки гибернации, все, что ему нужно, уже есть внутри». ??

== Обновление 1 ==

Это полная версия моего текущего hibernate.cfg.xml:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>
        <!-- Database connection settings -->
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost/[my schema]</property>
        <property name="hibernate.connection.username">[login]</property>
        <property name="hibernate.connection.password">[password]</property>

        <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
        <property name="hibernate.hbm2ddl.auto">validate</property>

        <property name="show_sql">true</property>
        <property name="format_sql">true</property>

        <property name="hibernate.validator.autoregister_listeners">false</property>
        <property name="hibernate.search.autoregister_listeners">false</property>

        <mapping class="br.org.ampb.model.TipoUsuario" />
        <mapping class="br.org.ampb.model.Esporte" />
        <mapping class="br.org.ampb.model.Cargo" />
        <mapping class="br.org.ampb.model.EstadoCivil" />
        <mapping class="br.org.ampb.model.Parentesco" />
        <mapping class="br.org.ampb.model.RamoAtividade" />
        <mapping class="br.org.ampb.model.SituacaoProfissional" />
        <mapping class="br.org.ampb.model.TipoSanguineo" />
        <mapping class="br.org.ampb.model.TipoTelefone" />
        <mapping class="br.org.ampb.model.UnidadeFederacao" />

        <mapping class="br.org.ampb.model.Usuario" />
        <mapping class="br.org.ampb.model.Associado" />
        <mapping class="br.org.ampb.model.Dependente" />
        <mapping class="br.org.ampb.model.Endereco" />
        <mapping class="br.org.ampb.model.AcessoClube" />
        <mapping class="br.org.ampb.model.AnexoEmail" />
        <mapping class="br.org.ampb.model.Email" />
        <mapping class="br.org.ampb.model.SituacaoEnvio" />
        <mapping class="br.org.ampb.model.PeriodoAfastamento" />
        <mapping class="br.org.ampb.model.Telefone" />

        <mapping class="br.org.ampb.model.ConfiguracaoSistema" />
        <mapping class="br.org.ampb.model.TipoConfiguracaoSistema" />
    </session-factory>

</hibernate-configuration>

Ответы [ 3 ]

1 голос
/ 14 января 2011

Возможно, у вас есть 2 версии hibernate-validator в вашем classpath, поэтому в tomcat одна загружается первой, а в jboss - вторая.Попробуйте удалить один из них.

0 голосов
/ 23 мая 2011

Частичное решение здесь: http://jaitechwriteups.blogspot.com/2008/08/how-to-upgrade-hibernate-in-jboss.html

Проблема в том, что вашей библиотеке hibernate требуется новая версия hibernate-validator.Возможно, вы поставили hibernate-validator-4.xx. Проблема с этой версией заключается в том, что у нее нет класса org.hibernate.validator.ClassValidator, поэтому вместо версии 4.xx

* необходимо установить версию 3.1.0.GA.1005 * Когда вы делаете это, возникает новая проблема, вам нужен поставщик jsr-303: поэтому вы должны также установить версию 4.xx.

Если вы используете maven, проблематично иметь 2 артефакта с одинаковой версией,так что вы можете использовать другие реализации jsr303 (см. реализации jsr303 ) в качестве зависимости.Так что в этом случае используйте:

            <!-- jsr 303 (javax.validation) provider-->
    <dependency>
        <groupId>org.apache.bval</groupId>
        <artifactId>bval-core</artifactId>
        <version>0.3-incubating</version>
    </dependency>

    <dependency>
        <groupId>org.apache.bval</groupId>
        <artifactId>bval-jsr303</artifactId>
        <version>0.3-incubating</version>
    </dependency>
0 голосов
/ 10 января 2011

При использовании EAR вы можете выполнять этот вид перехватов в загрузчике классов, но я не верю, что он работает с развертываниями WAR (хотя я хочу показать иное).

Эта конкретная проблема, я полагаю, вызвана попыткой Hibernate автоматически определить местонахождение библиотеки Hibernate Validator на пути к классам. Версия Validator внутри JBoss 4.2 довольно старая и не совместима с новой версией Hibernate в вашей WAR.

Более переносимым решением вашей проблемы является настройка среды выполнения вашего приложения Hibernate, чтобы не пытаться автоматически находить Hibernate Search или Hibernate Validator.

Вы делаете это, передавая два свойства в конфигурацию Hibernate:

hibernate.validator.autoregister_listeners = false
hibernate.search.autoregister_listeners = false

Из вашего вопроса не ясно как вы настраиваете SessionFactory в Hibernate, так что вам решать, как добавить эти свойства

...