4 Replies Latest reply on Aug 10, 2011 4:03 AM by sjahan

    Hibernate problem since using federation connector


      Hi everyone,


      I didn't try to debug it deeply yet, prefering starting a thread if someone already experienced that, it could be faster to do this way.

      Here's the case:


      We got a Jpa connector which works fine.


      We wanna keep the Jpa connector and add a SVN connector, setting both connectors using the federation one.

      I set my configuration file to get this config, i assume this is right, at least for the Jpa part (SVN will be another part to deal with later), but the Jpa part doesn't work anymore and i don't know why. This seems to be ok at the beggining since i get some hibernate stuff but a weird problem happens.

      I get as usual some hibernate trace and it freezes til the timeout.

      Here is the stacktrace i finally get:



      11:33:43,631 INFO  [STDOUT] Hibernate:

          /* insert org.modeshape.connector.store.jpa.model.simple.SubgraphQueryEntity

              */ insert



                  (ROOT_UUID, WORKSPACE_ID)


                  (?, ?)

      11:33:43,632 INFO  [STDOUT] Hibernate:

          /* insert org.modeshape.connector.store.jpa.model.simple.SubgraphNodeEntity

              */ insert





                  (?, ?, ?, ?, ?)

      11:34:34,087 WARN  [JDBCExceptionReporter] SQL Error: 1205, SQLState: 41000

      11:34:34,087 ERROR [JDBCExceptionReporter] Lock wait timeout exceeded; try restarting transaction

      11:34:34,090 ERROR [AssertionFailure] an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)

      org.hibernate.AssertionFailure: null id in org.modeshape.connector.store.jpa.model.simple.SubgraphNodeEntity entry (don't flush the Session after an exception occurs)

          at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:78)

          at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:187)

          at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:143)

          at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)

          at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)

          at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58)

          at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996)

          at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1163)

          at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117)

          at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:51)

          at org.modeshape.connector.store.jpa.model.simple.SubgraphQuery.create(SubgraphQuery.java:95)

          at org.modeshape.connector.store.jpa.model.simple.SimpleJpaRepository$Workspace.getBranch(SimpleJpaRepository.java:500)

          at org.modeshape.connector.store.jpa.model.simple.SimpleRequestProcessor.process(SimpleRequestProcessor.java:63)

          at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:291)

          at org.modeshape.connector.store.jpa.model.simple.SimpleJpaConnection.execute(SimpleJpaConnection.java:133)

          at org.modeshape.graph.connector.RepositoryConnectionPool$ConnectionWrapper.execute(RepositoryConnectionPool.java:1129)

          at org.modeshape.graph.Graph.execute(Graph.java:288)

          at org.modeshape.graph.Graph$5.process(Graph.java:231)

          at org.modeshape.graph.request.RequestBuilder.readBranch(RequestBuilder.java:214)

          at org.modeshape.graph.Graph$27.at(Graph.java:2557)

          at org.modeshape.graph.Graph$27.at(Graph.java:2565)

          at org.modeshape.graph.Graph$27.at(Graph.java:2555)

          at org.modeshape.graph.property.basic.GraphNamespaceRegistry.initializeCacheFromStore(GraphNamespaceRegistry.java:268)

          at org.modeshape.graph.property.basic.GraphNamespaceRegistry.<init>(GraphNamespaceRegistry.java:92)

          at org.modeshape.jcr.JcrRepository.<init>(JcrRepository.java:767)

          at org.modeshape.jcr.JcrEngine.doCreateJcrRepository(JcrEngine.java:484)

          at org.modeshape.jcr.JcrEngine.getRepository(JcrEngine.java:298)

          at org.oea.jcr.storage.AbstractStorage.getRepository(AbstractStorage.java:57) //Our stuff

          at org.oea.jcr.storage.AbstractStorage.login(AbstractStorage.java:64) //Our stuff


      Here is the configuration file we use:


      <?xml version="1.0" encoding="UTF-8"?>
      <configuration xmlns:mode="http://www.modeshape.org/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
          <mode:sources jcr:primaryType="nt:unstructured">
              <!-- Portal source -->
              <mode:source jcr:name="Portal" mode:classname="org.modeshape.connector.store.jpa.JpaSource" mode:dataSourceJndiName="java:OEAPortal" mode:dialect="org.hibernate.dialect.MySQL5InnoDBDialect" mode:model="Simple" mode:maximumConnectionsInPool="1" mode:largeValueSizeInBytes="10000" mode:retryLimit="3" mode:compressData="false" mode:showSql="true" mode:autoGenerateSchema="validate" mode:creatingWorkspacesAllowed="true" mode:defaultWorkspaceName="workspace">
              <mode:source jcr:name="SVN Store" mode:classname="org.modeshape.connector.svn.SvnRepositorySource" mode:description="The ModeShape SVN repository (anonymous access)" mode:repositoryRootUrl="https://svn.fr/svn/pa/trunk/OEA-SVN" mode:defaultWorkspaceName="workspace" username="sebastien.jahan" password="*******" >
                <!-- If desired, specify a cache policy that caches items in memory for 5 minutes (300000 ms). This fragment can be left out if the connector should not cache any content.-->
                <mode:cachePolicy jcr:name="cachePolicy" mode:classname="org.modeshape.graph.connector.path.cache.InMemoryWorkspaceCache$InMemoryCachePolicy" mode:timeToLiveInMilliseconds="300000" />
              <mode:source jcr:name="OEA">
                      <mode:workspace jcr:name="workspace">
                              <mode:projection jcr:name="MySQL portal repository projection" mode:source="Portal" mode:workspaceName="workspace">
                                  <mode:projectionRules>/ => /</mode:projectionRules>
                              <mode:projection jcr:name="SVN for attachment projection" mode:source="SVN Store" mode:workspaceName="workspace">
                                  <mode:projectionRules>/ => /SVNRepo</mode:projectionRules>
                              <!-- Project the 'System' content. Only needed when this source is accessed through JCR. -->
                              <!-- mode:projection jcr:name="System projection" mode:source="System" mode:workspaceName="default">
      <mode:projectionRules>/jcr:system => /</mode:projectionRules>
              <!--mode:sequencer jcr:name="Image Sequencer" mode:classname="org.modeshape.sequencer.image.ImageMetadataSequencer">
                  <mode:description>Image metadata sequencer</mode:description>        
                  <mode:pathExpression>/foo/source => /foo/target</mode:pathExpression>
                  <mode:pathExpression>/bar/source => /bar/target</mode:pathExpression>
              <mode:mimeTypeDetector jcr:name="Detector">
                  <mode:description>Standard extension-based MIME type detector</mode:description>
              <mode:repository jcr:name="Portal">
                  <!-- Specify the source that should be used for the repository -->
                  <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names -->
                  <mode:options jcr:primaryType="mode:options">
                      <systemSourceName jcr:primaryType="mode:option" mode:value="system@Portal"/>
                      <jaasLoginConfigName jcr:primaryType="mode:option" mode:value="modeshape-jcr"/>
                  <!-- Define any custom node types. Importing CND files via JcrConfiguration is equivalent to specifying here. -->
                  <mode:nodeTypes jcr:primaryType="mode:nodeTypes"/>
                  <!-- Define any namespaces for this repository, other than those already defined by JCR or ModeShape -->
                  <namespaces jcr:primaryType="mode:namespaces">
                      <ea jcr:primaryType="mode:namespace" mode:uri="http://www.oea.org"/>

      Hoping someone already experienced this kind of trouble...

      We're currently using Modeshape 2.5.0.


      Thank you for your support and have a very good day



        • 1. Re: Hibernate problem since using federation connector

          After a few tests, i am able to be more accurate on the matter:


          If i use the federation connector with only my jpa connector, it's ok.

          The trouble only happens when i add the svn repository.


          I found out that i was wrong with the projection's direction: it's federated => source, so i switched / => /Attachments to /Attachments => /.

          The projection for the jpa connector is ok since it's / => /, no directions' issue.


          I'll try the SVN connector only if i'm able too, but since i never used it and our server isn't totally supporting it, i don't know if i will be able too.

          Any way, for now, either it's the SVN connector, either it's the federation with several connectors.

          My guess is the second options is more likely since the problem happens with the jpa connector (

          org.hibernate.AssertionFailure: null id in  org.modeshape.connector.store.jpa.model.simple.SubgraphNodeEntity entry  (don't flush the Session after an exception occurs))


          I'll update the thread as soon as i can with more details on the problem.


          Thank you very much,



          • 2. Re: Hibernate problem since using federation connector

            This is now nearly over, i got through with a better understanding of the workspaces. The SVN connector first had a wrong workspace, then i had hard times to get it with the federation connector added to the configuration.

            I didn't completely resolved my problem: i have to make a correct projection for the jcr:system, but i think i'll work it out on my own finally


            Thank you very much for your support,



            • 3. Re: Hibernate problem since using federation connector

              I'm curious as to what you finally ended up with for your projections.


              And a suggestion for the future - whenever you're trying to configure federation, always start by making sure you can (temporarily) configure a repository on top of every source before trying to federate those sources (and removing the temporary repositories from your configuration). Getting the federation configuration is unfortunately hard enough, but it's infinitely more complicated when the sources you're federating are not configured correctly.

              • 4. Re: Hibernate problem since using federation connector

                Well, good news to start the day, i've managed to set this up correctly!

                I could not work on it yesterday's afternoon, but i have tried to get it this early morning and it appears i got confused between repositories and sources names. They're often quite the same, and according to the place we have to type them, we are confused and eventually get wrong.


                The last troublesome place was: <systemSourceName jcr:primaryType="mode:option" mode:value="system@OEA"/> where OEA is the federated source, previously correctly mapped with / => / from JPA system workspace to OEA system workspace!


                Hoping this could help someone one day!


                Have a very nice day,