-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Error on Upgrade to hibernate-core 3.6.2 .final,pls!!!
PostPosted: Thu Mar 17, 2011 11:14 pm 
Newbie

Joined: Tue Mar 11, 2008 4:23 am
Posts: 8
Hi All:
I have upgraded my hibernate serials from core-3.5.6 to core-3.6.2.Final ,annotation-3.5.4-Final to annotation-3.5.6-Final,then my app throws flowwing exception on tomcat server 7.0.11 startup
Code:
     Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [jar:file:/F:/workspace-sts-2.6.0.SR1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/jackysoft-casserver/WEB-INF/lib/jackysoft-component.jar!/spring/configuration/Spring-dataAccess-local.xml]: Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.AnnotationConfiguration]: Constructor threw exception; nested exception is java.lang.VerifyError: class org.hibernate.type.WrappedMaterializedBlobType overrides final method getReturnedClass.()Ljava/lang/Class;
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
   at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:435)
   at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)
   at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)
   at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:156)
   at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
   at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)
   ... 52 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.AnnotationConfiguration]: Constructor threw exception; nested exception is java.lang.VerifyError: class org.hibernate.type.WrappedMaterializedBlobType overrides final method getReturnedClass.()Ljava/lang/Class;
   at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
   at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newConfiguration(LocalSessionFactoryBean.java:818)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:549)
   at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
   ... 64 more
Caused by: java.lang.VerifyError: class org.hibernate.type.WrappedMaterializedBlobType overrides final method getReturnedClass.()Ljava/lang/Class;
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
   at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
   at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1148)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
   at org.hibernate.type.BasicTypeRegistry.<init>(BasicTypeRegistry.java:91)
   at org.hibernate.type.TypeResolver.<init>(TypeResolver.java:59)
   at org.hibernate.cfg.Configuration.<init>(Configuration.java:250)
   at org.hibernate.cfg.Configuration.<init>(Configuration.java:302)
   at org.hibernate.cfg.AnnotationConfiguration.<init>(AnnotationConfiguration.java:168)
   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)
   ... 70 more
2011-3-18 11:09:37 org.apache.catalina.core.StandardContext startInternal
严重: Error filterStart
2011-3-18 11:09:37 org.apache.catalina.core.StandardContext startInternal
严重: Context [/cas-server-webapp] startup failed due to previous errors
2011-3-18 11:09:37 org.apa

 

and have no error on previous hibernate version
can some one tell me why!!??????


Top
 Profile  
 
 Post subject: Re: Error on Upgrade to hibernate-core 3.6.2 .final,pls!!!
PostPosted: Fri Mar 18, 2011 3:53 am 
Newbie

Joined: Tue Mar 11, 2008 4:23 am
Posts: 8
I see source of hibernate-core
Code:
   package org.hibernate.type;

/**
* <tt>materialized_blob</tt>: A type that maps an SQL BLOB to Java Byte[].
*
* @author Strong Liu
*/
public class WrappedMaterializedBlobType extends MaterializedBlobType {
   [color=#FF8000]public Class getReturnedClass() {
      return Byte[].class;
   }
[/color]
   protected Object toExternalFormat(byte[] bytes) {
      if (bytes == null)
         return null;
      return wrapPrimitive(bytes);
   }

   protected byte[] toInternalFormat(Object bytes) {
      if (bytes == null)
         return null;
      return unwrapNonPrimitive((Byte[]) bytes);
   }

   private Byte[] wrapPrimitive(byte[] bytes) {
      int length = bytes.length;
      Byte[] result = new Byte[length];
      for (int index = 0; index < length; index++) {
         result[index] = Byte.valueOf(bytes[index]);
      }
      return result;
   }

   private byte[] unwrapNonPrimitive(Byte[] bytes) {
      int length = bytes.length;
      byte[] result = new byte[length];
      for (int i = 0; i < length; i++) {
         result[i] = bytes[i].byteValue();
      }
      return result;
   }
}


his parent class
Code:
  /*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.  All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA  02110-1301  USA
*/
package org.hibernate.type;

import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;

import org.dom4j.Node;

import org.hibernate.EntityMode;
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.cfg.Environment;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.util.ArrayHelper;

/**
* TODO : javadoc
*
* @author Steve Ebersole
*/
public abstract class AbstractStandardBasicType<T>
      implements BasicType, StringRepresentableType<T>, XmlRepresentableType<T> {

   private final SqlTypeDescriptor sqlTypeDescriptor;
   private final JavaTypeDescriptor<T> javaTypeDescriptor;

   public AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) {
      this.sqlTypeDescriptor = sqlTypeDescriptor;
      this.javaTypeDescriptor = javaTypeDescriptor;
   }

   public T fromString(String string) {
      return javaTypeDescriptor.fromString( string );
   }

   public String toString(T value) {
      return javaTypeDescriptor.toString( value );
   }

   public T fromStringValue(String xml) throws HibernateException {
      return fromString( xml );
   }

   public String toXMLString(T value, SessionFactoryImplementor factory) throws HibernateException {
      return toString( value );
   }

   public T fromXMLString(String xml, Mapping factory) throws HibernateException {
      return xml == null || xml.length() == 0 ? null : fromStringValue( xml );
   }

   protected MutabilityPlan<T> getMutabilityPlan() {
      return javaTypeDescriptor.getMutabilityPlan();
   }

   protected T getReplacement(T original, T target) {
      if ( !isMutable() ) {
         return original;
      }
      else if ( isEqual( original, target ) ) {
         return original;
      }
      else {
         return deepCopy( original );
      }
   }

   public boolean[] toColumnNullness(Object value, Mapping mapping) {
      return value == null ? ArrayHelper.FALSE : ArrayHelper.TRUE;
   }

   public String[] getRegistrationKeys() {
      return registerUnderJavaType()
            ? new String[] { getName(), javaTypeDescriptor.getJavaTypeClass().getName() }
            : new String[] { getName() };
   }

   protected boolean registerUnderJavaType() {
      return false;
   }


   // final implementations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   public final JavaTypeDescriptor<T> getJavaTypeDescriptor() {
      return javaTypeDescriptor;
   }

   public final SqlTypeDescriptor getSqlTypeDescriptor() {
      return sqlTypeDescriptor;
   }

[color=#BF8000]   public final Class getReturnedClass() {
      return javaTypeDescriptor.getJavaTypeClass();
   }
[/color]
   public final int[] sqlTypes(Mapping mapping) throws MappingException {
      return new int[] { sqlTypeDescriptor.getSqlType() };
   }

   public final int getColumnSpan(Mapping mapping) throws MappingException {
      return sqlTypes( mapping ).length;
   }

   public final boolean isAssociationType() {
      return false;
   }

   public final boolean isCollectionType() {
      return false;
   }

   public final boolean isComponentType() {
      return false;
   }

   public final boolean isEntityType() {
      return false;
   }

   public final boolean isAnyType() {
      return false;
   }

   public final boolean isXMLElement() {
      return false;
   }

   public final boolean isSame(Object x, Object y, EntityMode entityMode) {
      return isSame( x, y );
   }

   @SuppressWarnings({ "unchecked" })
   protected final boolean isSame(Object x, Object y) {
      return isEqual( (T) x, (T) y );
   }

   @SuppressWarnings({ "unchecked" })
   public final boolean isEqual(Object x, Object y, EntityMode entityMode) {
      return isEqual( (T) x, (T) y );
   }

   @SuppressWarnings({ "unchecked" })
   public final boolean isEqual(Object x, Object y, EntityMode entityMode, SessionFactoryImplementor factory) {
      return isEqual( (T) x, (T) y );
   }

   @SuppressWarnings({ "unchecked" })
   public final boolean isEqual(T one, T another) {
      return javaTypeDescriptor.areEqual( one, another );
   }

   public final int getHashCode(Object x, EntityMode entityMode) {
      return getHashCode( x );
   }

   public final int getHashCode(Object x, EntityMode entityMode, SessionFactoryImplementor factory) {
      return getHashCode( x );
   }

   @SuppressWarnings({ "unchecked" })
   protected final int getHashCode(Object x) {
      return javaTypeDescriptor.extractHashCode( (T) x );
   }

   @SuppressWarnings({ "unchecked" })
   public final int compare(Object x, Object y, EntityMode entityMode) {
      return javaTypeDescriptor.getComparator().compare( (T) x, (T) y );
   }

   public final boolean isDirty(Object old, Object current, SessionImplementor session) {
      return isDirty( old, current );
   }

   public final boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session) {
      return checkable[0] && isDirty( old, current );
   }

   protected final boolean isDirty(Object old, Object current) {
      return !isSame( old, current );
   }

   public final boolean isModified(
         Object oldHydratedState,
         Object currentState,
         boolean[] checkable,
         SessionImplementor session) {
      return isDirty( oldHydratedState, currentState );
   }

   public final Object nullSafeGet(
         ResultSet rs,
         String[] names,
         SessionImplementor session,
         Object owner) throws SQLException {
      return nullSafeGet( rs, names[0], session );
   }

   public final Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner)
         throws SQLException {
      return nullSafeGet( rs, name, session );
   }

   public final T nullSafeGet(ResultSet rs, String name, final SessionImplementor session) throws SQLException {
      // todo : have SessionImplementor extend WrapperOptions
      final WrapperOptions options = new WrapperOptions() {
         public boolean useStreamForLobBinding() {
            return Environment.useStreamsForBinary();
         }

         public LobCreator getLobCreator() {
            return Hibernate.getLobCreator( session );
         }
      };

      return nullSafeGet( rs, name, options );
   }

   protected final T nullSafeGet(ResultSet rs, String name, WrapperOptions options) throws SQLException {
      return sqlTypeDescriptor.getExtractor( javaTypeDescriptor ).extract( rs, name, options );
   }

   public Object get(ResultSet rs, String name, SessionImplementor session) throws HibernateException, SQLException {
      return nullSafeGet( rs, name, session );
   }

   @SuppressWarnings({ "unchecked" })
   public final void nullSafeSet(
         PreparedStatement st,
         Object value,
         int index,
         final SessionImplementor session) throws SQLException {
      // todo : have SessionImplementor extend WrapperOptions
      final WrapperOptions options = new WrapperOptions() {
         public boolean useStreamForLobBinding() {
            return Environment.useStreamsForBinary();
         }

         public LobCreator getLobCreator() {
            return Hibernate.getLobCreator( session );
         }
      };

      nullSafeSet( st, value, index, options );
   }

   @SuppressWarnings({ "unchecked" })
   protected final void nullSafeSet(PreparedStatement st, Object value, int index, WrapperOptions options) throws SQLException {
      sqlTypeDescriptor.getBinder( javaTypeDescriptor ).bind( st, (T) value, index, options );
   }

   public void set(PreparedStatement st, T value, int index, SessionImplementor session) throws HibernateException, SQLException {
      nullSafeSet( st, value, index, session );
   }

   @SuppressWarnings({ "unchecked" })
   public final String toLoggableString(Object value, SessionFactoryImplementor factory) {
      return javaTypeDescriptor.extractLoggableRepresentation( (T) value );
   }

   @SuppressWarnings({ "unchecked" })
   public final void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) {
      node.setText( toString( (T) value ) );
   }

   public final Object fromXMLNode(Node xml, Mapping factory) {
      return fromString( xml.getText() );
   }

   public final boolean isMutable() {
      return getMutabilityPlan().isMutable();
   }

   @SuppressWarnings({ "unchecked" })
   public final Object deepCopy(Object value, EntityMode entityMode, SessionFactoryImplementor factory) {
      return deepCopy( (T) value );
   }

   protected final T deepCopy(T value) {
      return getMutabilityPlan().deepCopy( value );
   }

   @SuppressWarnings({ "unchecked" })
   public final Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException {
      return getMutabilityPlan().disassemble( (T) value );
   }

   public final Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException {
      return getMutabilityPlan().assemble( cached );
   }

   public final void beforeAssemble(Serializable cached, SessionImplementor session) {
   }

   public final Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner)
         throws HibernateException, SQLException {
      return nullSafeGet(rs, names, session, owner);
   }

   public final Object resolve(Object value, SessionImplementor session, Object owner) throws HibernateException {
      return value;
   }

   public final Object semiResolve(Object value, SessionImplementor session, Object owner) throws HibernateException {
      return value;
   }

   public final Type getSemiResolvedType(SessionFactoryImplementor factory) {
      return this;
   }

   @SuppressWarnings({ "unchecked" })
   public final Object replace(Object original, Object target, SessionImplementor session, Object owner, Map copyCache) {
      return getReplacement( (T) original, (T) target );
   }

   @SuppressWarnings({ "unchecked" })
   public Object replace(
         Object original,
         Object target,
         SessionImplementor session,
         Object owner,
         Map copyCache,
         ForeignKeyDirection foreignKeyDirection) {
      return ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT == foreignKeyDirection
            ? getReplacement( (T) original, (T) target )
            : target;
   }
}



as above i show when i start tomcat7 throw
Quote:
Caused by: java.lang.VerifyError: class org.hibernate.type.WrappedMaterializedBlobType overrides final method getReturnedClass.()Ljava/lang/Class;


is this a bug!!!!??!!


Top
 Profile  
 
 Post subject: Re: Error on Upgrade to hibernate-core 3.6.2 .final,pls!!!
PostPosted: Fri Mar 18, 2011 6:31 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi, the sourcecode in hibernate-core 3.6.2 is fine (as you can see). You are having duplicate hibernate jar versions in your classpath, so loading 3.6.2 and also some older incompatible version.
I'd recommend you to use Tattletale, it's a simple command line tool which find duplicate classes and builds a nice report.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Error on Upgrade to hibernate-core 3.6.2 .final,pls!!!
PostPosted: Sun Mar 20, 2011 11:41 pm 
Newbie

Joined: Tue Mar 11, 2008 4:23 am
Posts: 8
Hi ,my dear friend !
after i remove dependy of annotation-3.5.6-Final ,it's works
when i open core3.6.2.Final i had found it contains all of the classes of annotation-3.5.6-Final !!!

I had found the confiliction , just between annotation-3.5.6-Final and core-3.6.2.Final ,did annotation-3.5.6-Final never needed later!!!


Top
 Profile  
 
 Post subject: Re: Error on Upgrade to hibernate-core 3.6.2 .final,pls!!!
PostPosted: Mon Mar 21, 2011 11:32 am 
Newbie

Joined: Mon Mar 21, 2011 11:29 am
Posts: 1
I had found the confiliction , just between annotation-3.5.6-Final and core-3.6.2.Final ,did annotation-3.5.6-Final never needed later!!!

when is annotation-3.6.2.Final will be available ?


Top
 Profile  
 
 Post subject: Re: Error on Upgrade to hibernate-core 3.6.2 .final,pls!!!
PostPosted: Mon Mar 21, 2011 11:41 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
doesn't exist anymore, it's incorporated in core, just remove it from classpath.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Error on Upgrade to hibernate-core 3.6.2 .final,pls!!!
PostPosted: Mon Mar 21, 2011 9:59 pm 
Newbie

Joined: Tue Mar 11, 2008 4:23 am
Posts: 8
oh,i did it ,then my project works fine,thanks a lot!!!


Top
 Profile  
 
 Post subject: Re: Error on Upgrade to hibernate-core 3.6.2 .final,pls!!!
PostPosted: Thu Jun 02, 2011 9:15 am 
Newbie

Joined: Thu Jun 02, 2011 9:12 am
Posts: 1
Excellent - Thanks!


Top
 Profile  
 
 Post subject: Re: Error on Upgrade to hibernate-core 3.6.2 .final,pls!!!
PostPosted: Fri Aug 19, 2011 11:48 am 
Newbie

Joined: Mon Feb 21, 2011 6:57 am
Posts: 8
I run in the same exception while updating from hibernate-core 3.3.0.GA to 3.6.7.Final.
I updated also the dependency hibernate-annotations to the last version available, 3.5.6-Final; removing that dependency from my pom resolved the issue :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.