2 Replies Latest reply on May 4, 2007 7:06 PM by Ricardo Harari

    CMS - UnsupportedOperationException: Blobs are not cacheable

    Ricardo Harari Newbie

      Hi Folks,

      The CMS module is throwing the exception below when deploying the portal-cms.sar for the first time.

      03:00:35,933 ERROR [STDERR] Caused by: java.lang.UnsupportedOperationException: Blobs are not cacheable
      03:00:35,933 ERROR [STDERR] at org.hibernate.type.BlobType.disassemble(BlobType.java:83)
      03:00:35,933 ERROR [STDERR] at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:80)
      03:00:35,933 ERROR [STDERR] at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2118)
      03:00:35,964 ERROR [STDERR] at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2062)
      03:00:35,964 ERROR [STDERR] at org.hibernate.loader.Loader.list(Loader.java:2020)
      03:00:35,964 ERROR [STDERR] at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
      03:00:35,964 ERROR [STDERR] at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
      03:00:35,964 ERROR [STDERR] at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
      03:00:35,995 ERROR [STDERR] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
      03:00:35,995 ERROR [STDERR] at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      03:00:35,995 ERROR [STDERR] at org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager$DbBLOBStore.get(Hibe
      rnatePersistenceManager.java:1033)

      To avoid this exception I´ve changed the default caching attributes in hibernate.cfg.xml to false as follows:

      <property name="cache.use_second_level_cache">false</property>
      <property name="cache.use_query_cache">false</property>
      


      The environment is:
      - PortalDS is pointing to a MySQL 5.0 database
      - Jboss-Portal 2.6.0 CR2
      - jdk1.6

      I think another solution is changing setCacheable to false in this line (haven´t try yet):

      List rs = session.createQuery(blobSelectData).setCacheable(false)
      .setString(0, blobId).list();


        • 1. Re: CMS - UnsupportedOperationException: Blobs are not cache
          Sohil Shah Master

          rharari:

          I recommend two solutions:

          * Cleanest: Use the new JBossCachePeriststenceManager instead of the HibernatePersistenceManager. It performs better as well.

          To do this: replace HibernatePeristenceManager in jboss-portal.sar/portal-cms.sar/META-INF/jboss-service.xml with JBossCachePersistenceManager.

          wipe out your server/data directory and restart portal.

          * If you want to continue using HibernatePersistenceManager, modify your jboss-portal.sar/portal-cms.sar/conf/hibernate.cms/domain.hbm.xml mapping to like the following:

          <?xml version="1.0"?>
          <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           ~ JBoss, a division of Red Hat ~
           ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
           ~ contributors as indicated by the @authors tag. See the ~
           ~ copyright.txt in the distribution for a full listing of ~
           ~ individual contributors. ~
           ~ ~
           ~ This is free software; you can redistribute it and/or modify it ~
           ~ under the terms of the GNU Lesser General Public License as ~
           ~ published by the Free Software Foundation; either version 2.1 of ~
           ~ the License, or (at your option) any later version. ~
           ~ ~
           ~ This software 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 software; if not, write to the Free ~
           ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
           ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
          
          <!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.jboss.portal.cms.hibernate.state.VersionBinVal" table="jbp_cms_version_binval" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="id"
           column="BINVAL_ID"
           type="string"
           length="255"/>
           <property
           name="data"
           column="BINVAL_DATA"
           type="blob"
           length="100000000"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.state.VersionNode" table="jbp_cms_version_node" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="nodeId"
           column="NODE_ID"
           type="string"
           length="36"/>
           <property
           name="data"
           column="NODE_DATA"
           type="binary"
           length="100000000"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.state.VersionProp" table="jbp_cms_version_prop" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="propId"
           column="PROP_ID"
           type="string"
           length="255"/>
           <property
           name="data"
           column="PROP_DATA"
           type="binary"
           length="100000000"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.state.VersionRefs" table="jbp_cms_version_refs" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="refId"
           column="NODE_ID"
           type="string"
           length="36"/>
           <property
           name="data"
           column="REFS_DATA"
           type="binary"
           length="100000000"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.state.WSPBinVal" table="jbp_cms_wsp_binval" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="id"
           column="BINVAL_ID"
           type="string"
           length="255"/>
           <property
           name="data"
           column="BINVAL_DATA"
           type="blob"
           length="100000000"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.state.WSPNode" table="jbp_cms_wsp_node" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="nodeId"
           column="NODE_ID"
           type="string"
           length="36"/>
           <property
           name="data"
           column="NODE_DATA"
           type="binary"
           length="100000000"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.state.WSPProp" table="jbp_cms_wsp_prop" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="propId"
           column="PROP_ID"
           type="string"
           length="255"/>
           <property
           name="data"
           column="PROP_DATA"
           type="binary"
           length="100000000"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.state.WSPRefs" table="jbp_cms_wsp_refs" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="refId"
           column="NODE_ID"
           type="string"
           length="36"/>
           <property
           name="data"
           column="REFS_DATA"
           type="binary"
           length="100000000"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.CMSEntry" table="jbp_cms_cmsentry" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="name"
           column="FSENTRY_NAME"
           type="string"
           length="255"
           not-null="false"/>
           <property name="path"
           column="FSENTRY_PATH"
           type="string"
           not-null="true"
           length="245"/>
           <property name="data"
           column="FSENTRY_DATA"
           type="blob"
           length="100000000"
           not-null="false"/>
           <property name="lastmod"
           column="FSENTRY_LASTMOD"
           type="long"
           not-null="true"/>
           <property name="length"
           column="FSENTRY_LENGTH"
           type="long"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.RepositoryEntry" table="jbp_cms_repositoryentry" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="name"
           column="FSENTRY_NAME"
           type="string"
           length="255"
           not-null="false"/>
           <property name="path"
           column="FSENTRY_PATH"
           type="string"
           not-null="true"
           length="245"/>
           <property name="data"
           column="FSENTRY_DATA"
           type="blob"
           length="100000000"
           not-null="false"/>
           <property name="lastmod"
           column="FSENTRY_LASTMOD"
           type="long"
           not-null="true"/>
           <property name="length"
           column="FSENTRY_LENGTH"
           type="long"
           not-null="true"/>
           </class>
           <class name="org.jboss.portal.cms.hibernate.VersionEntry" table="jbp_cms_versionentry" lazy="true">
           <id
           name="key"
           column="PK"
           type="java.lang.Integer">
           <generator class="native"/>
           </id>
           <property
           name="name"
           column="FSENTRY_NAME"
           type="string"
           length="255"
           not-null="false"/>
           <property name="path"
           column="FSENTRY_PATH"
           type="string"
           not-null="true"
           length="245"/>
           <property name="data"
           column="FSENTRY_DATA"
           type="blob"
           length="100000000"
           not-null="false"/>
           <property name="lastmod"
           column="FSENTRY_LASTMOD"
           type="long"
           not-null="true"/>
           <property name="length"
           column="FSENTRY_LENGTH"
           type="long"
           not-null="true"/>
           </class>
          
           <!-- mapping to persist CMS Fine Grained Security related objects -->
           <class name="org.jboss.portal.cms.security.PermRoleAssoc" table="jbp_cms_perm_role">
           <cache usage="read-write"/>
           <id
           name="id"
           column="ID"
           type="java.lang.Long">
           <generator class="native"/>
           </id>
           <property
           name="roleId"
           column="ROLE_ID"
           type="string"
           not-null="true"
           />
           </class>
           <class name="org.jboss.portal.cms.security.PermUserAssoc" table="jbp_cms_perm_user">
           <cache usage="read-write"/>
           <id
           name="id"
           column="ID"
           type="java.lang.Long">
           <generator class="native"/>
           </id>
           <property
           name="userId"
           column="USER_ID"
           type="string"
           not-null="true"
           />
           </class>
           <class name="org.jboss.portal.cms.security.Criteria" table="jbp_cms_perm_criteria">
           <cache usage="read-write"/>
           <id
           name="id"
           column="ID"
           type="java.lang.Long">
           <generator class="native"/>
           </id>
           <property
           name="name"
           column="NAME"
           type="string"
           not-null="true"
           />
           <property
           name="value"
           column="VALUE"
           type="string"
           not-null="true"
           />
           </class>
           <class name="org.jboss.portal.cms.security.Permission" table="jbp_cms_perm">
           <cache usage="read-write"/>
           <id
           name="id"
           column="ID"
           type="java.lang.Long">
           <generator class="native"/>
           </id>
           <!-- one-to-many association with the criteria object -->
           <set name="criteria" lazy="false" table="jbp_cms_perm_criteria" cascade="all-delete-orphan">
           <cache usage="read-write"/>
           <key column="CMS_PERM_ID"/>
           <one-to-many class="org.jboss.portal.cms.security.Criteria"/>
           </set>
           <!-- many-to-many association with the role object -->
           <set name="roleAssoc" lazy="false" cascade="all-delete-orphan">
           <cache usage="read-write"/>
           <key column="CMS_PERM_ID"/>
           <one-to-many class="org.jboss.portal.cms.security.PermRoleAssoc"/>
           </set>
           <!-- many-to-many association with the user object -->
           <set name="userAssoc" lazy="false" cascade="all-delete-orphan">
           <cache usage="read-write"/>
           <key column="CMS_PERM_ID"/>
           <one-to-many class="org.jboss.portal.cms.security.PermUserAssoc"/>
           </set>
           <property
           name="service"
           column="NAME"
           type="string"
           not-null="true"
           />
           <property
           name="action"
           column="ACTION"
           type="string"
           not-null="true"
           />
           <property
           name="negated"
           column="NEGATED"
           type="boolean"
           not-null="true"
           />
           </class>
          </hibernate-mapping>
          


          This will take care of your blob caching issue.

          Thanks

          • 2. Re: CMS - UnsupportedOperationException: Blobs are not cache
            Ricardo Harari Newbie

            Thanks Sohil,

            I´ve changed to JBossCachePeriststenceManager and worked fine.