Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Getting Exceptions on Startup
PostPosted: Fri Jul 16, 2010 11:35 pm 
Newbie

Joined: Thu Jul 01, 2010 11:50 am
Posts: 4
Hello...

I'm getting a nasty exception on startup. Probably configuration but I'm running out of ideas. I'm using JBoss 6 M3, hibernate3, hibernate-validator-4.1.0.Final, hibernate-jpa-2.0-api-1.0.0.Final.

Here's my entity bean:
Code:
package com.aviall.entity;

import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

@Entity
@Table(name = "AV_T_ACCOUNT")
public class AvTAccount implements java.io.Serializable {
   private BigDecimal accId;
   private String accNumber;
   private String accCompanyName;
   private String accCurrency;
   private String accEmail;

   public AvTAccount() {
   }

   @Id
   @Column(name = "ACC_ID", nullable = false, precision = 22, scale = 0)
   @NotNull
   public BigDecimal getAccId() {
      return this.accId;
   }

   public void setAccId(BigDecimal accId) {
      this.accId = accId;
   }

   @Column(name = "ACC_NUMBER", nullable = false, length = 9)
   @NotNull
   @Length(max = 9)
   public String getAccNumber() {
      return this.accNumber;
   }

   public void setAccNumber(String accNumber) {
      this.accNumber = accNumber;
   }

   @Column(name = "ACC_COMPANY_NAME", nullable = false, length = 50)
   @NotNull
   @Length(max = 50)
   public String getAccCompanyName() {
      return this.accCompanyName;
   }

   public void setAccCompanyName(String accCompanyName) {
      this.accCompanyName = accCompanyName;
   }

   @Column(name = "ACC_CURRENCY", length = 20)
   @Length(max = 20)
   public String getAccCurrency() {
      return this.accCurrency;
   }

   public void setAccCurrency(String accCurrency) {
      this.accCurrency = accCurrency;
   }

   @Column(name = "ACC_EMAIL", length = 75)
   @Length(max = 75)
   public String getAccEmail() {
      return this.accEmail;
   }

   public void setAccEmail(String accEmail) {
      this.accEmail = accEmail;
   }
}


Here's my persistence.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for dev profile -->
<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_1_0.xsd"
             version="1.0">
             
   <persistence-unit name="aviall" transaction-type="JTA">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/aviallDatasource</jta-data-source>
      <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>         
      <property name="javax.persistence.validation.group.pre-persist" value="javax.validation.groups.Default"/>
      <property name="javax.persistence.validation.group.pre-update" value="javax.validation.groups.Default"/>
      <property name="javax.persistence.validation.group.pre-remove" value=""/>
      </properties>
   </persistence-unit>
</persistence>


And finally the exception:
Code:
22:30:00,019 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=Catalog.ear/#aviall state=Create: org.hibernate.HibernateException: Unable to get the default Bean Validation factory
   at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:101) [:3.5.3-Final]
   at org.hibernate.cfg.AnnotationConfiguration.applyBeanValidationConstraintsOnDDL(AnnotationConfiguration.java:477) [:3.5.3-Final]
   at org.hibernate.cfg.AnnotationConfiguration.applyConstraintsToDDL(AnnotationConfiguration.java:429) [:3.5.3-Final]
   at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:403) [:3.5.3-Final]
   at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1206) [:3.5.3-Final]
   at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1457) [:3.5.3-Final]
   at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193) [:3.5.3-Final]
   at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1085) [:3.5.3-Final]
   at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:681) [:3.5.3-Final]
   at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [:3.5.3-Final]
   at org.jboss.jpa.builder.DefaultCEMFBuilder.build(DefaultCEMFBuilder.java:47) [:1.0.2-alpha-1]
   at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:275) [:1.0.2-alpha-1]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20]
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_20]
   at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20]
   at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59) [jboss-reflect.jar:2.2.0.Alpha4]
   at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168) [jboss-reflect.jar:2.2.0.Alpha4]
   at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [jboss-reflect.jar:2.2.0.Alpha4]
   at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257) [jboss-kernel.jar:2.2.0.Alpha9]
   at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-kernel.jar:2.2.0.Alpha9]
   at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125) [jboss-kernel.jar:2.2.0.Alpha9]
   at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72) [jboss-kernel.jar:2.2.0.Alpha9]
   at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:202) [jboss-kernel.jar:2.2.0.Alpha9]
   at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.Alpha9]
   at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:377) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2042) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1081) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1320) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1244) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1137) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:892) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:639) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:180) [:2.2.0.Alpha4]
   at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:58) [:2.2.0.Alpha4]
   at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) [:2.2.0.Alpha4]
   at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.0.Alpha4]
   at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.Alpha4]
   at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1857) [:2.2.0.Alpha4]
   at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1575) [:2.2.0.Alpha4]
   at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1596) [:2.2.0.Alpha4]
   at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1516) [:2.2.0.Alpha4]
   at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:377) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2042) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1081) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1320) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1244) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1137) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:937) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:652) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:2008) [:2.2.0.Alpha4]
   at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1101) [:2.2.0.Alpha4]
   at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.0.Alpha4]
   at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) [:6.0.0.20100429-M3]
   at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70) [:6.0.0.20100429-M3]
   at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53) [:6.0.0.20100429-M3]
   at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403) [:6.0.0.20100429-M3]
   at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:377) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2042) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1081) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1320) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1244) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1137) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:892) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:639) [jboss-dependency.jar:2.2.0.Alpha9]
   at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308) [:6.0.0.20100429-M3]
   at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256) [:6.0.0.20100429-M3]
   at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:97) [:6.0.0.20100429-M3]
   at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
   at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
   at java.lang.Thread.run(Unknown Source) [:1.6.0_20]
Caused by: java.lang.IllegalAccessException: Class org.hibernate.cfg.beanvalidation.BeanValidationActivator can not access a member of class org.hibernate.cfg.beanvalidation.TypeSafeActivator with modifiers "public static"
   at sun.reflect.Reflection.ensureMemberAccess(Unknown Source) [:1.6.0_20]
   at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_20]
   at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:95) [:3.5.3-Final]
   ... 74 more


Any ideas? I'm completely stuck. Thanks!
Greg


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Fri Aug 27, 2010 8:31 pm 
Newbie

Joined: Tue Oct 06, 2009 10:44 pm
Posts: 2
Hi,
I have the same exception. I searched the web and this is the only forum that shows up. Looks like we are the only two having the issue!
Have you found a solution to this?
I have this exception on Hibernate 3.6.Beta3

Regards,
Anand.


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Tue Oct 19, 2010 12:33 pm 
Newbie

Joined: Tue Oct 19, 2010 12:31 pm
Posts: 2
Count 3...I'm thinking that some entity bean has a static access to a data member/method...going to search for it.

Minh


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Tue Oct 19, 2010 2:41 pm 
Newbie

Joined: Tue Oct 19, 2010 12:31 pm
Posts: 2
I was able to get my projects to finally deployed.

Problem was related to Annotated class for hibernate persistence. I had a jpa 2.0 specification @ElementCollection annotation in my bean but I was on jpa 1.0 spec.

Things I tried:

1. Changed my persistence.xml file to be 2.0:
<persistence version="2.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/ ... ce_2_0.xsd ">

2. Had to use jboss 6 with this deployment because the previous jboss 5.1 was using hibernate core 3.3.1

3. Still got the same error relating to BeanValidationActivator can not access a member of "public static"

4. Searched for public static everywhere to see if I had any annotations tied to it. Found none.

5. Started deleting ejb's, annotated domain objects...nothing worked.

6. Removed the persistence.xml file and the project finally deployed but now I don't have container managed persistence with my ejb's so that's no good.

7. Said screw it, reverted back to jpa spec 1.0 in my persistence.xml, changed server back to jboss 5.1, changed my annotation in my bean to @ManyToMany(instead of @ElementCollection) for my map and everything loaded fine.

This is not an ideal solution for me and I'm not sure if this will even work because my project uses hibernate 3.6 but jboss 5.1 has 3.3.1 as a core lib dependency. I could replace it but I don't want to mess with the cross dependency versions so I'm going to do more testing to see if there are any problems.

If someone has figured out why this error occurs: Class org.hibernate.cfg.beanvalidation.BeanValidationActivator can not access a member of "public static" PLEASE SHARE

I'm baffled as to the exact problem and my solution is a super hack level 1million!!!!!!!!

Minh


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Mon Nov 08, 2010 7:35 am 
Newbie

Joined: Wed Sep 09, 2009 4:15 am
Posts: 14
I think i have the same problem on startup:


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: protected void com.dsi.lari0.dao.BaseDao.init(org.hibernate.SessionFactory); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [file:/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory


I'm trying to add the validation to Spring MVC. Can you please help us?

Thank you.


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Sun Nov 21, 2010 12:56 pm 
Newbie

Joined: Sun Nov 21, 2010 9:03 am
Posts: 1
Same here, I'm using Hibernate 3.6.0 and spring 3.0.4

Code:
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
<bean class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">
        <property name="validator" ref="validator" />
</bean>


Code:
<dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-validator</artifactId>
           <version>4.1.0.Final</version>
       </dependency>
      
      <dependency>
         <groupId>javax.validation</groupId>
          <artifactId>validation-api</artifactId>
           <version>1.0.0.GA</version>
           <scope>provided</scope>
       </dependency>



Quote:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/hibernate-spring.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Tue Nov 30, 2010 12:58 pm 
Regular
Regular

Joined: Sun Apr 13, 2008 3:04 am
Posts: 71
Location: Bangalore
Same here.. what is the root cause..

Fun is it works for one of my application and fails for another .. not sure what annotation I am using in the other application which is causing this exception..

_________________
Raja Nagendra Kumar,
C.T.O
http://www.tejasoft.com
TejaSoft - Specialists in Code Audit, Unit Testing and Merciless Re-factoring - Engineering Crisis Turnaround Experts


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Tue Jan 04, 2011 12:53 am 
Newbie

Joined: Wed Oct 27, 2010 12:50 am
Posts: 2
I am also getting same exception.Any solution for this.I am using jboss 6 final hibernate 3.6


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Tue Mar 08, 2011 5:00 pm 
Newbie

Joined: Fri Aug 25, 2006 8:35 am
Posts: 4
I am getting the same exceptions. Oddly, I only started having the issue when I added hibernate-search 3.3.0.Final to my deployement.


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Sun May 01, 2011 4:33 pm 
Newbie

Joined: Sun May 01, 2011 4:23 pm
Posts: 1
you have a version conflict with hibernate-core. Check your dependencies and exclude it from other dependencies. I had the same error with jboss and hibernate-search (it depends on hibernate-core).


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Sun May 01, 2011 5:01 pm 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 176
The best is to create an issue with a testcase demonstrating the problem at Hibernate Validator's JIRA instance. That said, I also tend to think that this isn't a problem with HV/BV itself but maybe a versioning problem with other libraries as horasikus already said.

-- Gunnar

Btw. that's not really the right forum for this kind of questions (this forum is intended for questions related to the JSR 303 specification), better use viewforum.php?f=9 instead.

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
 Post subject: Re: Getting Exceptions on Startup
PostPosted: Thu Sep 22, 2011 4:34 pm 
Newbie

Joined: Thu Sep 22, 2011 4:27 pm
Posts: 2
I was facing same issue in JBoss 6 and i am able to solve it by removing validation-api-1.0.0.GA.jar from my applcation war file. hibernate-validator-4.1.0.Final.jar is still part of application war. For Jboss 5 both jar files works together


Last edited by ashafqat on Thu Sep 22, 2011 10:06 pm, edited 1 time in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.