java.lang.NoClassDefFoundError:javax / validation / groups / Websphere liberty profile中的默认值

时间:2014-10-10 14:12:59

标签: hibernate validation noclassdeffounderror websphere-liberty

通过使用Websphere Liberty概要文件v8.5的最新beta版本,当hibernate尝试获取默认的Bean Validation工厂时,我有一个例外。 这是堆栈跟踪:

[ERROR   ] Uncaught.init.exception.thrown.by.servlet 
                                                                                                               CacheInit
                                                                                                               thalerngboth
                                                                                                               java.lang.ExceptionInInitializerError
    at com.cwsoft.commons.webapp.servlet.CacheInit.init(CacheInit.java:53)
    at javax.servlet.GenericServlet.init(GenericServlet.java:161)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:329)
    at [internal classes]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/cwsoft/commons/spring/resource/sessionFactories.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
    ... 18 more
Caused by: org.hibernate.HibernateException: Unable to get the default Bean Validation factory
    at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:127)
    at org.hibernate.cfg.Configuration.applyBeanValidationConstraintsOnDDL(Configuration.java:1704)
    at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1654)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1445)
    at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:720)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
    ... 16 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:118)
    ... 24 more
Caused by: java.lang.NoClassDefFoundError: javax/validation/groups/Default
    ... 32 more

[ERROR   ] SRVE0266E: Error occured while initializing servlets: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:398)
    at [internal classes]
Caused by: java.lang.ExceptionInInitializerError
    at com.cwsoft.commons.webapp.servlet.CacheInit.init(CacheInit.java:53)
    at javax.servlet.GenericServlet.init(GenericServlet.java:161)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:329)
    ... 1 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/cwsoft/commons/spring/resource/sessionFactories.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
    ... 18 more
Caused by: org.hibernate.HibernateException: Unable to get the default Bean Validation factory
    at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:127)
    at org.hibernate.cfg.Configuration.applyBeanValidationConstraintsOnDDL(Configuration.java:1704)
    at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1654)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1445)
    at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:720)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
    ... 16 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:118)
    ... 24 more
Caused by: java.lang.NoClassDefFoundError: javax/validation/groups/Default
    ... 32 more

我的server.xml如下所示:

<server description="new server">

<!-- Enable features -->
<featureManager>
    <feature>jsp-2.2</feature>
    <feature>localConnector-1.0</feature>
    <feature>ejb-3.2</feature>
    <feature>servlet-3.1</feature>
    <feature>jdbc-4.0</feature>
    <feature>jpa-2.1</feature>
    <feature>jca-1.6</feature>
    <feature>beanValidation-1.1</feature>
</featureManager>

<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>

<library id="oracle-lib"><fileset dir="${server.config.dir}/drivers" includes="ojdbc-6.0.jar"></fileset></library>

<applicationMonitor updateTrigger="mbean"/>

<webApplication id="HelloWorldApplication" location="HelloWorldApplication.war" name="HelloWorldApplication">
</webApplication>
<application id="Thaler" location="C:\Users\vroberfroid\Documents\Websphere\WebSphereLibertyProfile\thalerngboth.ear" name="thalerngboth" type="ear"/>
<dataSource isolationLevel="TRANSACTION_READ_COMMITTED" id="jthaler" jndiName="jdbc/jthaler"  type="javax.sql.XADataSource" queryTimeout="200">
    <jdbcDriver libraryRef="oracle-lib" javax.sql.XADataSource="oracle.jdbc.xa.client.OracleXADataSource"/>
    <connectionManager numConnectionsPerThreadLocal="10"  minPoolSize="1"></connectionManager> 
    <properties.oracle user="pf2" password="pf2" URL="jdbc:oracle:thin:@sabesdb01:1521:HDEVTH5" />   
</dataSource>

<resourceAdapter location="C:\Users\vroberfroid\Documents\Websphere\WebSphereLibertyProfile\tsdjcacci.rar" id="tsdjcacci" ></resourceAdapter>
</server>

先谢谢你的帮助, 文森特

1 个答案:

答案 0 :(得分:0)

这是测试版中的错误,我不认为有解决方法。我在IBM内部报告了这个问题。感谢您使用测试版进行测试!