cancel
Showing results for 
Search instead for 
Did you mean: 

Error in Hibernate with two new tables

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hi there

We need to create two new tables in the Alfresco DB in MySQL for an extension we are building. In then we need to save the Id of a Company and the Company Name (that is the  first table) and in another one the Id of the company and special invoice patterns.

We have created the two tables in the alfresco db and now we are trying to access them using hibernate, however when I start alfresco this is what I get:
09:26:51,453 INFO [org.alfresco.config.xml.XMLConfigService$PropertyConfigurer] Loading properties file from class path resource [alfresco/file-servers.properties]
09:26:55,687 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftsIndexerTrigger' defined in class path resource [alfresco/scheduled-jobs-context.xml]: Cannot create inner bean 'ftsIndexerJobDetail' of type [org.springframework.scheduling.quartz.JobDetailBean] while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftsIndexerJobDetail' defined in class path resource [alfresco/scheduled-jobs-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.scheduling.quartz.JobDetailBean]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.commons.collections.SetUtils.orderedSet(Ljava/util/SetSmiley WinkLjava/util/Set;
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftsIndexerJobDetail' defined in class path resource [alfresco/scheduled-jobs-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.scheduling.quartz.JobDetailBean]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.commons.collections.SetUtils.orderedSet(Ljava/util/SetSmiley WinkLjava/util/Set;
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.scheduling.quartz.JobDetailBean]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.commons.collections.SetUtils.orderedSet(Ljava/util/SetSmiley WinkLjava/util/Set;
Caused by: java.lang.NoSuchMethodError: org.apache.commons.collections.SetUtils.orderedSet(Ljava/util/SetSmiley WinkLjava/util/Set;
at org.quartz.JobDetail.<init>(JobDetail.java:85)
at org.springframework.scheduling.quartz.JobDetailBean.<init>(JobDetailBean.java:45)
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:85)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:756)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:721)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:384)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:215)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
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.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

I dont see exactly what the error is, any ideas or suggestions you might find??

Here I pass you also the XML mapping files I have configured to get access to these tables :

NombreEmpresa.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
   <class name="org.alfresco.model.CifPatronesVO" table="patrones_cif">
      <id name="CIF" column="CIF" type="string">
         <generator class="assigned" />
      </id>
      <property name="patrones" column="patrones" type="string" not-null="true"/>
   </class>
</hibernate-mapping>

and Patrones.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  
<hibernate-mapping>
   <class name="org.alfresco.model.CifEmpresasVO" table="nombre_empresas">
      <id name="CIF" column="CIF" type="string">
         <generator class="assigned" />
      </id>
      <property name="nombre" column="nombre" type="string" not-null="true"/>
   </class>
</hibernate-mapping>

Any idea or suggestion will be much appreciated!!  Smiley Happy

Thanks a lot in advance guys!!
4 REPLIES 4

mrey
Champ in-the-making
Champ in-the-making
Hello all

We are trying to do something similar and are interested knowing how to access alfresco database directly to read and write in customized tables.

Thanks a lot in advance.

mrogers
Star Contributor
Star Contributor
That particular error does not look like anything to do with your database.

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hi there

Hey thanks for the spot!!… when you mean "that particular error"… is it because you know what the error is related to  Smiley Happy ?  if so would you mind pointing me where should I drive my review to??

Thanks again!

jlabuelo
Champ on-the-rise
Champ on-the-rise
Sorry to bother again, but I am quite stuck with this issue. If you mean it is not related to the way I am trying to access the DB in this configuration I created… any ideas of what it could be??… any directions from your side will be much appreciated

Thanks again :wink: