8 Replies Latest reply on Nov 23, 2010 1:36 PM by clemensdev

    ModeShape standalone - again

    clemensdev

      I have read http://community.jboss.org/message/562539

       

      I am about to evaluate jcr implementations. So far I looked into jackrabbit(derby). Accessing the jackrabbit repo (from a simple java console app) is as simple as:

      ...

           RepositoryConfig repositoryConfiguration = RepositoryConfig
                      .create(
                              new File(
                                      "/tmp/jackrabbit/repository.xml" ),
                              new File( "/tmp/jackrabbit" ) );

       

              Repository repository = RepositoryImpl
                      .create( repositoryConfiguration );
              Credentials credentials = new SimpleCredentials( "admin", "admin"
                      .toCharArray() );

       

              Session session = repository.login( credentials );

      ...

       

      Unfortunately I haven't found an equally simple setup/installation example for ModeShape. For our needs ModeShape should make use of the jpa connector (preferably with a derby db/driver). The transient connector will not work out, because the evaluation/tests include many many nodes.

       

      General ModeShape question:

      which ModeShape-setup/connector performs/scales best, if it is only used as a jcr container (i.e. replacement for jackrabbit), no federation etc (at least not yet)?

        • 1. Re: ModeShape standalone - again
          bcarothers

          Clemens Wyss wrote:

           

          Unfortunately I haven't found an equally simple setup/installation example for ModeShape. For our needs ModeShape should make use of the jpa connector (preferably with a derby db/driver). The transient connector will not work out, because the evaluation/tests include many many nodes.

           

          JcrConfiguration config = new JcrConfiguration().loadFrom("/path/to/configRepository.xml");

          JcrEngine engine = config.build();

          engine.start();

           

          Repository repo = (Repository) engine.getRepository("repositoryNameFromConfigFile");

          Session session = repository.login(  );  // Logs in with a guest session - works by default.

           

          If you have any questions about how to set up the configRepository.xml, please feel free to post here, although there are several examples in the quickstarts and the documentation.

          Unfortunately I haven't found an equally simple setup/installation example for ModeShape. For our needs ModeShape should make use of the jpa connector (preferably with a derby db/driver). The transient connector will not work out, because the evaluation/tests include many many nodes.

          There's no scalability limit on our in-memory repository that I'm aware of.  In fact, if you're comparing ModeShape's performance to JR's transient repository, the in-memory repository is the nearest parallel.

           

          Because we use Hibernate as our JPA implementation and Hibernate currently has some open defects around Derby support, you are better off using MySQL or PostgreSQL for an open source backing store for the JPA connector at this time.

          General ModeShape question:

          which ModeShape-setup/connector performs/scales best, if it is only used as a jcr container (i.e. replacement for jackrabbit), no federation etc (at least not yet)?

          By default, the JCR container uses federation to share the jcr:system graph, so it's not an either/or decision.  I don't know that we've done any scalability tests.  If you do run some of these tests, could you share your results?

          • 2. Re: ModeShape standalone - again
            clemensdev

            Thx for you reply.

            my concrete questions are:

            1) how does the configRepository.xml look like when making use of JPAConnector->MySQL

            2) what jars do I need (in the modeshape-jcr.2.3.0.Final-jar-wirth-dependencies.jar there are no connectors...)

            • 3. Re: ModeShape standalone - again
              bcarothers

              I've attached an example configuration file that we use for integration testing against JPA databases.  You would have to tweak this file for your own use, as described in http://docs.jboss.org/modeshape/latest/manuals/reference/html/jdbc-storage-connector.html.

               

              We have built jars-with-dependencies for each of our connectors just like we have for our JCR implementation.  The one that you'd need for the JPA connector is at modeshape-2.3.0.Final-all-with-dependencies.jar.  Inside that JAR, you should find a JAR called modeshape-connector-store-jpa-2.3.0.Final-with-dependencies.jar.  Of course, you'd still need to add your JDBC driver JAR to your classpath.

              • 4. Re: ModeShape standalone - again
                clemensdev

                Thx again!

                I guess the attached configRepository.xml is used in a maven test run?

                What are your values for:

                ${jpaSource.dialect}
                ${jpaSource.driverClassName}
                ${jpaSource.url}
                ${jpaSource.maximumConnectionsInPool}
                ${jpaSource.referentialIntegrityEnforced}
                ${jpaSource.largeValueSizeInBytes}
                ${jpaSource.retryLimit}
                ${jpaSource.compressData}

                ${jpaSource.autoGenerateSchema}

                • 5. Re: ModeShape standalone - again
                  rhauch

                  Yeah, that configuration is used in some unit and/or integration tests. Here are some values when using MySQL:

                   

                  dialect = org.hibernate.dialect.MySQL5InnoDBDialect

                  driverClassName = com.mysql.jdbc.Driver

                  url = jdbc:mysql://[host][,failoverhost...][:port]/[database][?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...

                   

                  The rest of the properties are easily changed based upon your configuration and environment, but some general values might be:

                   

                  maximumConnectionsInPool = 5

                  minimumConnectionsInPool = 1

                  numberOfConnectionsToAcquireAsNeeded = 1

                  maximumSizeOfStatementCache = 50

                  maximumConnectionIdleTimeInSeconds = 10

                  referentialIntegrityEnforced = true

                  largeValueSizeInBytes = 256

                  autoGenerateSchema = create

                  retryLimit = 3

                  compressData = true

                   

                  Again, these are all explained in the first table in http://docs.jboss.org/modeshape/latest/manuals/reference/html/jdbc-storage-connector.html

                  • 6. Re: ModeShape standalone - again
                    clemensdev

                    getting closer :-)

                    ModeShape creates a schema in the MySQL database!, i.e. the connection/connector basically works. BUT now I encounter a NoSuchMethodError-Exception:

                    Exception in thread "main" java.lang.NoSuchMethodError: org.apache.lucene.analysis.snowball.SnowballAnalyzer.setOverridesTokenStreamMethod(Ljava/lang/Class;)V
                        at org.apache.lucene.analysis.snowball.SnowballAnalyzer.<init>(SnowballAnalyzer.java:46)
                        at org.modeshape.jcr.RepositoryQueryManager$SelfContained.<init>(RepositoryQueryManager.java:286)
                        at org.modeshape.jcr.JcrRepository.<init>(JcrRepository.java:650)
                        at org.modeshape.jcr.JcrEngine.doCreateJcrRepository(JcrEngine.java:370)
                        at org.modeshape.jcr.JcrEngine.getRepository(JcrEngine.java:270)
                        at ch.mysign.tools.proj2sling.ModeShapeAccess.setupSession(ModeShapeAccess.java:98)
                        at ch.mysign.tools.proj2sling.ProjectJcrTester.<init>(ProjectJcrTester.java:64)
                        at ch.mysign.tools.proj2sling.Proj2SlingApp.main(Proj2SlingApp.java:83)

                     

                    ModeShapeAccess#setupSession looks alike:

                    ...

                    JcrConfiguration config = new JcrConfiguration().loadFrom(MODESHAPE_XML_FILE);
                    JcrEngine engine = config.build();
                    engine.start();
                            
                    Repository repo = (Repository) engine.getRepository("Project Repository Source"); // <- the exception occurs here!
                    Session session = repo.login(  );

                    ....

                    and my modeshape.xml file is attached.

                     

                    PS: thanks :-)

                    • 7. Re: ModeShape standalone - again
                      rhauch

                      This looks like there's a different (probably older) version of the Lucene Snowball JAR already on the classpath, perhaps provided by your application or another library (maybe Sling??). ModeShape currently uses 3.0.2 (the latest).

                      • 8. Re: ModeShape standalone - again
                        clemensdev

                        bingo! I've got jackrabbit-jars in my path...