7 Replies Latest reply on Apr 20, 2011 6:29 AM by Tom Seidel

    Error with MySQL when creating file-nodes

    Tom Seidel Newbie

      Hi all,

       

      I have a problem with the usage of Modeshape in combination with a JPASource and MySQL. If I use the Modeshape-rest-client library to upload files via JSON into a MySQL based repository (exactly the same code like in the documention) I get the following error-message:

       

      javax.jcr.RepositoryException: org.modeshape.graph.connector.RepositorySourceException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Request is frozen and may not be changed: [CompositeRequest (4)

          create in the "testWork" workspace the node "/{}Chrysanthemum.jpg" with properties [{http://www.jcp.org/jcr/1.0}primaryType = {http://www.jcp.org/jcr/nt/1.0}file, {http://www.jcp.org/jcr/1.0}uuid = b3d4fa55-c793-41c8-a7df-631fc7294803, {http://www.modeshape.org/internal/1.0}nodeDefinition = {httpwww.modeshape.org1.0}root//{httpwww.jcp.orgjcrnt1.0}base]

          update properties on </{}Chrysanthemum.jpg && [{http://www.modeshape.org/1.0}uuid = b3d4fa55-c793-41c8-a7df-631fc7294803]> in the "testWork" workspace to {{http://www.jcp.org/jcr/1.0}createdBy={http://www.jcp.org/jcr/1.0}createdBy = tomcat, {http://www.jcp.org/jcr/1.0}created={http://www.jcp.org/jcr/1.0}created = 2011-03-25T00:59:10.982+01:00}

          create in the "testWork" workspace the node "/{}Chrysanthemum.jpg/{http://www.jcp.org/jcr/1.0}content" with properties [{http://www.jcp.org/jcr/1.0}primaryType = {http://www.jcp.org/jcr/nt/1.0}resource, {http://www.jcp.org/jcr/1.0}uuid = edad003b-bf0a-42f4-bbad-84da3d8b4445, {http://www.modeshape.org/internal/1.0}nodeDefinition = {httpwww.jcp.orgjcrnt1.0}file/{httpwww.jcp.orgjcr1.0}content/{httpwww.jcp.orgjcrnt1.0}base]

          update properties on </{}Chrysanthemum.jpg/{http://www.jcp.org/jcr/1.0}content && [{http://www.modeshape.org/1.0}uuid = edad003b-bf0a-42f4-bbad-84da3d8b4445]> in the "testWork" workspace to {{http://www.jcp.org/jcr/1.0}mimeType={http://www.jcp.org/jcr/1.0}mimeType = image/jpeg, {http://www.jcp.org/jcr/1.0}lastModifiedBy={http://www.jcp.org/jcr/1.0}lastModifiedBy = tomcat, {http://www.jcp.org/jcr/1.0}data={http://www.jcp.org/jcr/1.0}data = binary (858,78KB, SHA1=f5f8ad26819a471318d24631fa5055036712a87e), {http://www.jcp.org/jcr/1.0}lastModified={http://www.jcp.org/jcr/1.0}lastModified = 2009-07-14T07:32:31.674+02:00}]

       

      this problem does not occur if the filesize is about 100K and smaller. I've tried the same code with a HSQL database and didn't run into this problems. Do you have an idea what's the reason for this issue?

       

      Thanks in advance,

      Tom

        • 1. Error with MySQL when creating file-nodes
          Randall Hauch Master

          If it works with HSQL, then I'd guess that the problem is either with your MySQL database or the configuration of the JPA connector.

           

          What does your ModeShape configuration look like?

           

          Also, be sure that the dialect correctly matches the MySQL database. For example, there are three Hibernate dialects for MySQL, depending upon whether your database is configured to use InnoDB or MyISAM. Be sure you have selected the right one. (See this thread.)

          • 2. Error with MySQL when creating file-nodes
            Tom Seidel Newbie

            Randall,

             

            The configuration is based on the getting started example. Here it is:

             

            <?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">

                    <mode:source jcr:name="Aircraft"

                        mode:classname="org.modeshape.connector.store.jpa.JpaSource"

                        mode:model="Simple" mode:username="root" mode:password="root"

                        mode:maximumConnectionsInPool="3" mode:driverClassName="com.mysql.jdbc.Driver"

                        mode:url="jdbc:mysql://localhost:3306/jcr?autoReconnect=true"

                        mode:dialect="org.hibernate.dialect.MySQL5Dialect"

                        mode:referentialIntegrityEnforced="true" mode:largeValueSizeInBytes="1000"

                        mode:retryLimit="3" mode:compressData="false"

                        mode:defaultWorkspaceName="testWork" mode:showSql="true"

                        mode:autoGenerateSchema="create" mode:creatingWorkspacesAllowed="true" />

                </mode:sources>

                <mode:sequencers>

                </mode:sequencers>

                <mode:mimeTypeDetectors>

                    <mode:mimeTypeDetector jcr:name="Detector">

                        <mode:description>Standard extension-based MIME type detector

                        </mode:description>

                        <mode:classname>org.modeshape.graph.mimetype.ExtensionBasedMimeTypeDetector

                        </mode:classname>

                    </mode:mimeTypeDetector>

                </mode:mimeTypeDetectors>

                <mode:repositories>

                    <mode:repository jcr:name="Aircraft">

                        <mode:source>Aircraft</mode:source>

                        <jcr:nodeTypes mode:resource="/mynamespaces.cnd" />

                        <namespaces jcr:primaryType="mode:namespaces">

                            <remus jcr:primaryType="mode:namespace" mode:uri="http://www.example.org/mynamespaces/1.0" />

                        </namespaces>

                    </mode:repository>

                </mode:repositories>

            </configuration>

             

            Thanks,

            Tom

            • 3. Error with MySQL when creating file-nodes
              Randall Hauch Master

              Is your MySQL database using ISAM? If so, you need to use the "org.hibernate.dialect.MySQLInnoDBDialect".

              • 4. Error with MySQL when creating file-nodes
                Tom Seidel Newbie

                No it's not. I double-checked it with the InnoDBDialect, but with this dialect nothing is working..

                • 5. Re: Error with MySQL when creating file-nodes
                  Tom Seidel Newbie

                  Randall,

                   

                  Could you reproduce the problem? - I've changed the configuration of MySQL to consume more memory and I also tried the 2.5 release, but still get this error...

                  Any ideas?

                   

                  Tom

                  • 6. Re: Error with MySQL when creating file-nodes
                    Randall Hauch Master

                    Tom,

                     

                    I've not been able to, though I've not really been able to dedicate much time to it. What version of MySQL and the MySQL JConnect JDBC driver are you using? Are you using a different Hibernate version than '3.5.2-Final'?

                     

                    It'd be interesting to know if you can successfully run an integration build of ModeShape using your MySQL instance. If you can get the ModeShape build working locally (using HSQLDB), then having the tests run against MySQL is as simple as creating a database that our unit tests can use, and then running the build using that database.

                     

                    Our parent POM already is configured with a Maven profile that uses a local MySQL database (see our parent POM on line 444). Alternatively, you can create another profile or modify an existing profile to suit your needs.

                     

                    Then just run the build using "mvn clean install -Pintegration -Ddatabase=mysql5_local"

                    • 7. Re: Error with MySQL when creating file-nodes
                      Tom Seidel Newbie

                      Finally found the reason for this error, increasing the max_allowed_packet configuration in MySQL resolved it.

                       

                      Thanks for your help

                      Tom