2 Replies Latest reply on Apr 23, 2014 1:59 AM by kuzmenkov_leonid

    Modeshape binary repository and Websphere datasources

    kuzmenkov_leonid

      Hello, all!

      I have another question regarding modeshape.

       

      Have someone ever tried to use modeshape on Websphere Application server, and using websphere jdbc-datasources in modeshape configuration for binary repository? If yes, how did you configure those datasources? Any special settings\hacks?

       

      I am getting next error, when I try to add something to repository:

       

      [4/21/14 9:59:10:188 GMT+03:00] 000003d2 BusinessExcep E   CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "addFile" on bean "BeanId(modeshape-integration#modeshape-integration-filerepository.jar#ModeShapeFileRepository, null)". Exception data: org.modeshape.jcr.value.ValueFormatException: Error converting InputStream to a BinaryValue

          at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:254)

          at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:57)

          at org.modeshape.jcr.JcrValueFactory.createBinary(JcrValueFactory.java:147)

          at org.modeshape.jcr.JcrValueFactory.createBinary(JcrValueFactory.java:47)

      <..>

      Caused by: com.ibm.websphere.ce.cm.ObjectClosedException: DSRA9110E: Statement is closed.

          at com.ibm.ws.rsadapter.jdbc.WSJdbcWrapper.createClosedException(WSJdbcWrapper.java:122)

          at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.runtimeXIfNotClosed(WSJdbcStatement.java:1857)

          at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setString(WSJdbcPreparedStatement.java:2680)

          at org.modeshape.jcr.value.binary.Database.retrieveContentSQL(Database.java:394)

          ... 95 more

      (complete logs in the attached files)

       

      Some facts that are true for this case:

      1. for other types of binary repository, for example, "file", it works fine.
      2. Same JNDI name for same websphere datasource is used in infinispan configuration, and it works fine too. Also that is a proof that jndi name is valid and exist.
      3. If I specify a direct connection to DB in modeshape configuration - it works fine again.
      4. Same application with same configuration files works fine on Jboss eap 6.1.

       

      I have tried to debug this error, and log above doesn't lie, it happens on the accessing prepared statement (initialization goes without error)

      Line 393 of Database.class, procedure retrieveContentSQL inside org.modeshape.jcr.value.binary

       

      I have tried to google this websphere error (about "statement is closed"), but there either:

      • unrelated to my case causes
      • no solution for same cause described (meaning error happens on access to previously prepared statement)
      • suggestion to reinitialize prepared statement as a local variable (that is not good solution since I have to modify modeshape package myself, and the sole purpose of prepared statement is defeated, if I will reinitialize it every time).

       

      Since none other parts of application I'm working on is using modeshape database in anyway, and it is unlikely that I will get inconsistent changes, I can use modeshape configured for direct database connection in this case

      But I would be greatful for possible reasons of this error, or settings that I should set for Websphere datasource, or what is the difference between datasouces of Websphere and Jboss, that causes this problem.

       


      Working environment:

       

      Application server: Websphere Standalone server 8.5.5, with  Java SDK 1.7_64 installed

      Modeshape version: 3.7.2 Final

      Database: Oracle 11g r2 \ MS SQL Server 2012 (tested on both, everything above is true for both databases)

        • 1. Re: Modeshape binary repository and Websphere datasources
          hchiorean

          I suspect the exception is raised because of the fact that WebSphere will close idle db connections (and the Database class holds on to prepared statements). This is not ideal, so may look at changing this in the future.

           

          In the meantime, one thing you can try is configuring your WebSphere datasource idle connection timeout and setting a large value (or investigate if it's possible to keep connections alive).

          • 2. Re: Modeshape binary repository and Websphere datasources
            kuzmenkov_leonid

            I may be mistaken, but errors "Connection is closed" and "Statement is closed" are different (at least I have seen each of them on the Internet separately), thought it is true that they have same error code in websphere.

             

            I have following settings for connection pool of datasource in question in Websphere (timeoutes are in seconds):

             

            Min connections: 1

            Max connections: 10

            Connection timeout: 180

            Unused timeout: 1800

            Aged timeout: 0

            Reap time: 180 (<- maintenance period time, at what aged and unused connection are checked)

             

            In my case none of this timeouts should be reached before I get an error.

            There are also some advanced connection pool properties, mostly related to stack\trashholds, and possibility to add custom parameter (key\value pair).