3 Replies Latest reply on Aug 11, 2005 2:26 AM by mazz

    error with CMS hibernate store passing

    mazz

      I'm in the process of hacking up JBoss Portal and using only its CMS component - so let me throw that caveat out there first thing :-) Oh, and I'm putting it in a JBoss 3.2.3. Using Postgres 8.0 DB. The purpose was to pick up the new Hibernate store for the Slide WebDAV repo.

      After building from the 2.0 branch (took the snapshot today), putting in the necessary hibernate3 jars in my deployment directory and setting up my data source, I was able to start JBossAS and I saw my database tables created for me automatically (I believe hibernate does this for me when it detects the tables do not exist). I got some warning messages from hibernate saying something like it couldn't validate something because it couldn't find some of the portal POJO classes (like SlideVersionPreds and SlideVersionHistory). But, it didn't seem like anything bad really happened, it all started up fine. I am not sure what those warnings were all about, but obviously, its picking up the portal-cms-lib.jar because it couldn't get the hibernate store otherwise. Anyway, all of my slide_XXX tables looked to be created fine - they were populated with data that looked correct.

      I then shutdown JBossAS and immediately restarted it. I now get the following error... note that from the looks of it, the SQL it is generating seems to be putting a value of "/" where an int is expected. Below in orange is the SQL and in red is the error message. The exception stack follows.

      Question is - was there anything I did to cause this problem?


      01:19:04,341 INFO [Namespace] Loading namespace slide base data
      01:19:05,513 INFO [STDOUT] Hibernate: select slideuri0_.URI_ID as col_0_0_ from slide_uri slideuri0_ where slideuri0_.URI_STRING=?
      01:19:05,573 INFO [STDOUT] Hibernate: select slideobjec0_.URI_ID as URI1_, slideobjec0_.CLASS_NAME as CLASS2_5_ from slide_object slideobjec0_, slide_uri slideuri1_ where slideobjec0_.URI_ID=slideuri1_.URI_ID and slideuri1_.URI_STRING=?
      01:19:05,693 INFO [Namespace] Init namespace slide configuration
      01:19:05,693 INFO [Namespace] Import data into namespace slide
      01:19:05,713 INFO [XMLUnmarshaller] Loading object /
      01:19:05,733 INFO [STDOUT] Hibernate: select slideobjec0_.URI_ID as URI1_, slideobjec0_.CLASS_NAME as CLASS2_5_ from slide_object slideobjec0_, slide_uri slideuri1_ where slideobjec0_.URI_ID=slideuri1_.URI_ID and slideuri1_.URI_STRING=?
      01:19:05,753 INFO [STDOUT] Hibernate: select slidebindi2_.NAME as col_0_0_, slideuri1_.URI_STRING as col_1_0_ from slide_uri slideuri0_, slide_uri slideuri1_, slide_binding slidebindi2_ where slideuri1_.URI_ID=slidebindi2_.CHILD_UURI_ID and slidebindi2_.URI_ID=slideuri0_.URI_ID and slideuri0_.URI_STRING=?
      01:19:05,793 INFO [STDOUT] Hibernate: select slideparen2_.NAME as col_0_0_, slideuri1_.URI_STRING as col_1_0_ from slide_uri slideuri0_, slide_uri slideuri1_, slide_parent_binding slideparen2_ where slideuri1_.URI_ID=slideparen2_.PARENT_UURI_ID and slideparen2_.URI_ID=slideuri0_.URI_ID and slideuri0_.URI_STRING=?
      01:19:05,833 INFO [STDOUT] Hibernate: select slideuri1_.URI_STRING as col_0_0_ from slide_uri slideuri0_, slide_uri slideuri1_, slide_links slidelinks2_ where slideuri1_.URI_ID=slidelinks2_.URI_ID and slidelinks2_.LINK_TO_ID=slideuri0_.URI_ID and slideuri0_.URI_STRING=?
      01:19:05,863 INFO [XMLUnmarshaller] Object already exists at /
      01:19:05,993 INFO [STDOUT] Hibernate: select slideuri1_.URI_STRING as col_0_0_, slideuri2_.URI_STRING as col_1_0_, slideuri3_.URI_STRING as col_2_0_, slidepermi0_.VERSION_NO as col_3_0_, slidepermi0_.IS_INHERITABLE as col_4_0_, slidepermi0_.IS_NEGATIVE as col_5_0_ from slide_permissions slidepermi0_, slide_uri slideuri1_, slide_uri slideuri2_, slide_uri slideuri3_ where slidepermi0_.OBJECT_ID=slideuri1_.URI_ID and slideuri1_.URI_STRING=? and slidepermi0_.SUBJECT_ID=slideuri2_.URI_ID and slidepermi0_.ACTION_ID=slideuri3_.URI_ID order by slidepermi0_.SUCCESSION
      01:19:06,033 INFO [STDOUT] Hibernate: select slideversi0_.IS_VERSIONED as col_0_0_ from slide_version slideversi0_, slide_uri slideuri1_ where slideversi0_.URI_ID=slideuri1_.URI_ID and slideuri1_.URI_STRING=?
      01:19:06,063 INFO [STDOUT] Hibernate: select slideversi0_.REVISION_NO as col_0_0_, slidebranc1_.BRANCH_STRING as col_1_0_ from slide_version_history slideversi0_, slide_branch slidebranc1_, slide_uri slideuri2_ where slideversi0_.BRANCH_ID=slidebranc1_.BRANCH_ID and slideversi0_.URI_ID=slideuri2_.URI_ID and slideuri2_.URI_STRING=? order by slideversi0_.REVISION_NO
      01:19:06,124 INFO [STDOUT] Hibernate: select distinct slideversi1_.REVISION_NO as col_0_0_ from slide_version_history slideversi0_, slide_version_history slideversi1_, slide_version_preds slideversi2_, slide_uri slideuri3_ where slideversi1_.VERSION_ID=slideversi2_.VERSION_ID and slideversi2_.VERSION_ID=slideversi0_.VERSION_ID and slideversi0_.URI_ID=slideuri3_.URI_ID and slideuri3_.URI_ID=? and slideversi0_.REVISION_NO=?
      01:19:06,154 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 22P02
      01:19:06,154 ERROR [JDBCExceptionReporter] ERROR: invalid input syntax for integer: "/"
      
      01:19:06,154 ERROR [AbstractRDBMSStore] HQL error on /: could not execute query
      01:19:06,164 ERROR [STDERR] org.apache.slide.common.ServiceAccessException: Service org.jboss.portal.cms.slide.store.hibernate.HibernateStore@e1ccdf access error : could not execute query
      01:19:06,164 ERROR [STDERR] at org.jboss.portal.cms.slide.store.hibernate.HibernateStore.createException(HibernateStore.java:3351)
      01:19:06,164 ERROR [STDERR] at org.jboss.portal.cms.slide.store.hibernate.HibernateStore.retrieveRevisionDescriptors(HibernateStore.java:2532)
      01:19:06,164 ERROR [STDERR] at org.jboss.portal.cms.slide.store.hibernate.HibernateStore.retrieveRevisionDescriptors(HibernateStore.java:425)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.store.AbstractStore.retrieveRevisionDescriptors(AbstractStore.java:996)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.store.ExtendedStore.retrieveRevisionDescriptors(ExtendedStore.java:816)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.content.ContentImpl.retrieve(ContentImpl.java:168)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.common.XMLUnmarshaller.loadObjectRevision(XMLUnmarshaller.java:340)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.common.XMLUnmarshaller.loadDefaultObjectRevision(XMLUnmarshaller.java:307)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.common.XMLUnmarshaller.loadObjectNode(XMLUnmarshaller.java:237)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.common.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:90)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.common.NamespaceAccessTokenImpl.importData(NamespaceAccessTokenImpl.java:272)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.common.Namespace.loadBaseData(Namespace.java:808)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.common.Domain.initNamespace(Domain.java:845)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.common.Domain.init(Domain.java:432)
      01:19:06,164 ERROR [STDERR] at org.apache.slide.common.Domain.init(Domain.java:366)
      01:19:06,164 ERROR [STDERR] at org.jboss.portal.cms.CMS.startService(CMS.java:136)
      


        • 1. Re: error with CMS hibernate store passing
          mazz

          the subject line got cut off... guess you can't have quotes in there.

          it did said:

          error with CMS hibernate store passing / in int column

          • 2. Re: error with CMS hibernate store passing
            mazz

            Just peeked at the code based on the stack trace and found the following.

            In HibernateStore, line 2500:

             String queryString = "select distinct pvh.revision_no from SlideVersionHistory vh, SlideVersionHistory pvh, SlideVersionPreds vp, SlideURI u where pvh.version_id = vp.version_id and vp.version_id = vh.version_id and vh.uri_id = u.uri_id and u.uri_id = ? and vh.revision_no = ?";
             List rs = session.createQuery(queryString)
             .setString(0, uri.toString())
             .setString(1, revisionNumber.toString())
             .list();
            


            I believe this is the SQL that is generating the error. Note that argument 0 is being set to a string (uri.toString()).

            But look at the hibernate mapping as defined in SlideURI.hbm.xml, specifically the type of uri_id column (which is of type "long" here):

            <hibernate-mapping
             package="org.jboss.portal.cms.slide.store.hibernate">
            
             <class name="SlideURI" table="slide_uri" lazy="true">
             <id
             name="uri_id"
             column="URI_ID"
             type="long">
             <generator class="native"/>
             </id>
             <property name="uri_string"
             column="URI_STRING"
             type="string"/>
             </class>
            </hibernate-mapping>
            


            So, based on this, something isn't right. Am I misreading this hibernate code/mapping or is that URI string improperly getting passed to the long uri_id column?

            • 3. Re: error with CMS hibernate store passing
              mazz

              That's what it was. I changed the source on my box, rebuilt Portal and it starts up fine now. So, the fix is in HibernateStore, line 2500... change "u.uri_id = ?" to "u.uri_string = ?" in that query string.