Announcement Announcement Module
Collapse
No announcement yet.
JBOSS Connection Pool Usage Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JBOSS Connection Pool Usage

    Hi,
    We are trying to use JBOSS connection pool in Spring framework. We are getting some weired exception when I try to refer JBOSS connection pool in the configuration file through JNDI name.

    Environment:
    Spring 2.5
    JBOSS 4.2

    Configuration XML:
    <jee:jndi-lookup id="dataSource" jndi-name="java:/jdbc/xxxxxxxx" resource-ref="true" />

    Error:
    18:22:23,388 ERROR [TransactionInterceptor] Application exception overridden by rollback exception
    org.springframework.jdbc.UncategorizedSQLException : StatementCallback; uncategorized SQLException for SQL [select id, description, price from springapp_produ
    cts]; SQL state [null]; error code [17029]; setReadOnly: Read-only connections not supported; nested exception is java.sql.SQLException: setReadOnly: Read-on
    ly connections not supported

    But when I use same JBOSS connection pool details using DriverManagerDataSource in the configuration, it is working fine.

    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource"
    destroy-method="close">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@xxxxxx:1521:xxx"/>
    <property name="username" value="xxx"/>
    <property name="password" value="xxxx"/>
    </bean>


    The existing jboss connection pooling is working fine with other applications.

    Anybody have clue on this excepetion?

  • #2
    It probably is a configuration issue in your JBoss datasource. Can you post the configuration? Also it can very well be that the jboss connection pooling (datasource) doesn't support read-only connections. You can always try another connection pool like C3P0.

    Comment


    • #3
      Hi mdeinum,
      Thanks for your reply and help. Please find the JBOSS connection pool data source configuration xml below.

      <datasources>
      <local-tx-datasource>
      <jndi-name>jdbc/xxxxxxxx</jndi-name>
      <connection-url>jdbc:oracle:thin:@xxxx:1521:xxx</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>xxxx</user-name>
      <password>xxxxx</password>
      <min-pool-size>0</min-pool-size>
      <max-pool-size>50</max-pool-size>
      <blocking-timeout-millis>5000</blocking-timeout-millis>
      <idle-timeout-minutes>15</idle-timeout-minutes>
      <readonly>false</readonly>
      </local-tx-datasource>

      </datasources>


      We have been using this data source from JBOSS for our other applications since many days and it is working without any issues. We use the same data source for all kind of database activity like select, update and other procedure calls. We don't have any pool setup for read-only connections.

      What do you mean by read-only connection? Is spring configuration looks for read only connections while using select queries?

      Thanks
      Raju

      Comment


      • #4
        setting readonly on a connection is just an indication to the underlying connection. It may or may not do something with it. If a Connection is marked read-only depends on your transaction configuration.

        Comment


        • #5
          Hi mdeinum,

          Thanks for your reply. It looks like JBOSS connection pool doesn't allow request for read-only connection. Do you know how to configure spring to request for a normal connection instead of read-only connection.

          Thanks
          Raju

          Comment


          • #6
            I don't think the problem is in spring - the error comes from oracle, not from jboss connection pool. It's the pool implementation that tries to invoke setReadOnly method, not spring. Try to delete the readonly property from jboss datasource configuration.

            Comment


            • #7
              Hi,
              Initially there was no read only property set in my jboss ds file. When I saw this error, I thought this read only set to false might help. But after setting this also, I am getting the same error. I am not sure what else I need to set?

              Comment


              • #8
                Can you please post the entire stacktrace?

                Comment


                • #9
                  Thank you all for your responses. Finally I was able to find the issue, the issue is related to my applicationcontext.xml configuration. There is advice set with read only parameter as fallows which I got from some examples.

                  <tx:advice id="txAdvice">
                  <tx:attributes>
                  <tx:method name="save*"/>
                  <tx:method name="*" read-only="true"/>
                  </tx:attributes>
                  </tx:advice>

                  When I try to use JBOSS connection pool, jboss is not allowing for read only connections. When I remove this flag, everything is working fine.

                  Comment

                  Working...
                  X