net.sf.hibernate.MappingException: Problem trying to set property type by reflection

Hibernate JIRA | Alexey Kaigorodov | 1 decade ago
  1. 0

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping schema="pkr"> <class name="edu.sdsc.pkr.orm.pkr.ProteinSequence" table="protein_sequences" > <id name="proteinSequenceId" column="protein_sequence_id" type="java.lang.Long" unsaved-value="null"> <generator class="assigned"/> </id> <property name="sequence" column="sequence" type="java.lang.TextType" not-null="true" unique="true" /> </class> </hibernate-mapping> ##The error is in the mapping in in line: -- name="sequence" column="sequence" type="java.lang.TextType" ##which should be ++name="sequence" column="sequence" type="net.sf.hibernate.type.TextType" But the error message "net.sf.hibernate.MappingException: duplicate import: ProteinSequence" is rather misleading. I believe a similar error was addressed in last release 2.1.1 <http://sourceforge.net/project/shownotes.php?group_id=40712&release_id=214960> <quote> * fixed a problem where mapping validation failure was reported as duplicate import (Michael Gloegl)"</quote> 11:53:35,323 INFO Environment:462 - Hibernate 2.1.2 11:53:35,390 INFO Environment:491 - hibernate.properties not found 11:53:35,412 INFO Environment:519 - using CGLIB reflection optimizer 11:53:35,428 INFO Configuration:854 - configuring from resource: /hibernate.cfg.xml 11:53:35,429 INFO Configuration:826 - Configuration resource: /hibernate.cfg.xml 11:53:38,080 INFO Configuration:311 - Mapping resource: edu/sdsc/pkr/orm/pkr/MasterSource.hbm.xml 11:53:38,318 INFO Binder:229 - Mapping class: edu.sdsc.pkr.orm.pkr.MasterSource -> master_source 11:53:38,407 INFO Configuration:311 - Mapping resource: edu/sdsc/pkr/orm/pkr/ProteinSequence.hbm.xml 11:53:38,671 INFO Binder:229 - Mapping class: edu.sdsc.pkr.orm.pkr.ProteinSequence -> protein_sequences 11:53:38,688 ERROR Configuration:252 - Could not compile the mapping document net.sf.hibernate.MappingException: Could not interpret type: java.lang.TextType at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:910) at net.sf.hibernate.cfg.Binder.bindSimpleValue(Binder.java:411) at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1023) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:352) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:973) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842) at edu.sdsc.pkr.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:8) at edu.sdsc.pkr.struts.ActionWithHbmSession.getSession(ActionWithHbmSession.java:33) at edu.sdsc.pkr.test.testPkrEntry.main(testPkrEntry.java:54) 11:53:38,807 INFO Configuration:311 - Mapping resource: edu/sdsc/pkr/orm/pkr/ProteinSequence.hbm.xml 11:53:39,045 ERROR Configuration:252 - Could not compile the mapping document net.sf.hibernate.MappingException: duplicate import: ProteinSequence at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85) at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:976) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842) at edu.sdsc.pkr.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:8) at edu.sdsc.pkr.struts.ActionWithHbmSession.getSession(ActionWithHbmSession.java:33) at edu.sdsc.pkr.test.testPkrEntry.main(testPkrEntry.java:54) Exception in thread "main" java.lang.ExceptionInInitializerError at edu.sdsc.pkr.struts.ActionWithHbmSession.getSession(ActionWithHbmSession.java:33) at edu.sdsc.pkr.test.testPkrEntry.main(testPkrEntry.java:54) Caused by: java.lang.RuntimeException: Exception building SessionFactory: Error reading resource: edu/sdsc/pkr/orm/pkr/ProteinSequence.hbm.xml at edu.sdsc.pkr.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:11) ... 2 more Caused by: net.sf.hibernate.MappingException: Error reading resource: edu/sdsc/pkr/orm/pkr/ProteinSequence.hbm.xml at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:318) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:976) at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842) at edu.sdsc.pkr.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:8) ... 2 more Caused by: net.sf.hibernate.MappingException: duplicate import: ProteinSequence at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85) at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285) at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315) ... 7 more

    Hibernate JIRA | 1 decade ago | R. Hannes Niedner
    net.sf.hibernate.MappingException: Could not interpret type: java.lang.TextType
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    Error Description ------------------------ %%%% Error Creating SessionFactory %%%% net.sf.hibernate.MappingException: collection foreign key mapping has wrong number of columns: com.tsystems.ecm.imaes.imadb.hibernate2.archive.ImsTable.archiveFiles type: com.tsystems.ecm.imaes.imadb.hibernate2.archive.ImsTablePK at net.sf.hibernate.mapping.Collection.validate(Collection.java:248) at net.sf.hibernate.cfg.Configuration.validate(Configuration.java:589) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:744) at helper.HibernateSession.currentSession(HibernateSession.java:52) at com.tsystems.ecm.imaes.imadb.hibernate2.archive.ImsTableDAO.save(ImsTableDAO.java:28) at test.ImsTableTest.testSaveDFolder(ImsTableTest.java:78) 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:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194) -------------------------------------------------------------------------------------------------------------------------------------------------------- Hibernate Mapping Files --------------------------------- See the attachment for 1. ImsSpecTable.hbm.xml 2. ImsTable.hbm.xml Database Table Structure ------------------------------------ 1. Table_Structure.gif

    Hibernate JIRA | 1 decade ago | Mohammed Mazhar Shaikh
    net.sf.hibernate.MappingException: collection foreign key mapping has wrong number of columns: com.tsystems.ecm.imaes.imadb.hibernate2.archive.ImsTable.archiveFiles type: com.tsystems.ecm.imaes.imadb.hibernate2.archive.ImsTablePK
  4. 0

    h2. Workaround Work around this problem by first restoring the site backup into 5.6 ([link to the archives|https://www.atlassian.com/software/confluence/download-archives/]), then re-create the backup. Doing this will "fix" the backup file to contain the correct set of fields, and therefore, can be restored into 5.7 or later (including cloud instances). h2. Detailed Description importing a site backup made from pre-5.0 (pre user-rename) into 5.7 or later fails, if there are content restrictions set. You will see an error ({{Error while importing backup: property does not exist: userName}}). i think caused by commits made for https://jira.atlassian.com/browse/CONF-35969 , which removed the handling for old fields that have been removed/changed for user-rename. Exception thrown in the logs: {noformat} ERROR [Long running task: Importing data] [confluence.importexport.actions.ImportLongRunningTask] runInternal Failure during import -- url: /wiki/rest/oci/latest/import | userName: sysadmin com.atlassian.confluence.importexport.ImportExportException: com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: property does not exist: userName at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEntities(BackupImporter.java:429) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEverything(BackupImporter.java:387) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:154) at com.atlassian.confluence.importexport.xmlimport.BackupImporter$1.doInTransactionWithoutResult(BackupImporter.java:258) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33) at com.atlassian.confluence.importexport.xmlimport.RestorePluginStateStoreTransactionCallbackDecorator.doInTransaction(RestorePluginStateStoreTransactionCallbackDecorator.java:50) at com.atlassian.confluence.importexport.xmlimport.RestoreBandanaValuesTransactionCallbackDecorator.doInTransaction(RestoreBandanaValuesTransactionCallbackDecorator.java:50) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.doImportInternal(BackupImporter.java:210) at com.atlassian.confluence.importexport.Importer.doImport(Importer.java:77) at com.atlassian.confluence.importexport.DefaultImportExportManager.performImportInternal(DefaultImportExportManager.java:85) at com.atlassian.confluence.importexport.DefaultImportExportManager.performImport(DefaultImportExportManager.java:75) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy164.performImport(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at com.sun.proxy.$Proxy270.performImport(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:136) at com.sun.proxy.$Proxy270.performImport(Unknown Source) at com.atlassian.confluence.importexport.actions.ImportLongRunningTask.runInternal(ImportLongRunningTask.java:95) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:27) at com.atlassian.ondemand.confluenceimporter.service.importer.OnDemandImportLongRunningTask.runInternal(OnDemandImportLongRunningTask.java:170) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:27) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:58) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: property does not exist: userName at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImport(DefaultXmlImporter.java:77) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEntities(BackupImporter.java:419) ... 44 more Caused by: org.xml.sax.SAXException: Error while importing backup: property does not exist: userName net.sf.hibernate.MappingException: property does not exist: userName at com.atlassian.confluence.importexport.xmlimport.parser.BackupParser.endElement(BackupParser.java:55) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at com.atlassian.security.xml.RestrictedXMLReader.parse(RestrictedXMLReader.java:103) at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.parseBackup(DefaultXmlImporter.java:103) at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImport(DefaultXmlImporter.java:61) ... 45 more Caused by: net.sf.hibernate.MappingException: property does not exist: userName at net.sf.hibernate.persister.AbstractEntityPersister.getPropertyType(AbstractEntityPersister.java:1133) at com.atlassian.confluence.importexport.xmlimport.persister.AbstractObjectPersister.getPrimitivePropertyValue(AbstractObjectPersister.java:45) at com.atlassian.confluence.importexport.xmlimport.persister.HibernateContentPermissionPersister.updateProperty(HibernateContentPermissionPersister.java:67) at com.atlassian.confluence.importexport.xmlimport.persister.HibernateContentPermissionPersister.persist(HibernateContentPermissionPersister.java:43) at com.atlassian.confluence.importexport.xmlimport.DefaultImportProcessor.persist(DefaultImportProcessor.java:47) at com.atlassian.confluence.importexport.xmlimport.DefaultImportProcessor.processObject(DefaultImportProcessor.java:37) at com.atlassian.confluence.importexport.xmlimport.parser.BackupParser.endElement(BackupParser.java:51) ... 57 more {noformat}

    Atlassian JIRA | 1 year ago | Joe Xie [atlassian]
    net.sf.hibernate.MappingException: property does not exist: userName

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. net.sf.hibernate.MappingException

      Problem trying to set property type by reflection

      at net.sf.hibernate.mapping.Value.setTypeByReflection()
    2. net.sf.hibernate
      Configuration.addJar
      1. net.sf.hibernate.mapping.Value.setTypeByReflection(Value.java:103)
      2. net.sf.hibernate.cfg.Binder.createProperty(Binder.java:953)
      3. net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:946)
      4. net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:313)
      5. net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1143)
      6. net.sf.hibernate.cfg.Configuration.add(Configuration.java:243)
      7. net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:266)
      8. net.sf.hibernate.cfg.Configuration.addJar(Configuration.java:349)
      9. net.sf.hibernate.cfg.Configuration.addJar(Configuration.java:320)
      9 frames