BTM
  1. BTM
  2. BTM-110

OperationNotSupportedException for Hibernate 4.x datasource lookup

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.1.2
    • Labels:
      None
    • Environment:
      Hibernate 4.0.0.CR3
    • Number of attachments :
      0

      Description

      Hibernate 4 (unlike Hibernate 3) uses the following code to lookup a JNDI datasource:

      return context.getNameParser( "" ).parse( jndiName );

      This throws an exception in BTM:

      Caused by: org.hibernate.service.jndi.JndiException: Error parsing JNDI name [myDS]
      at org.hibernate.service.jndi.internal.JndiServiceImpl.parseName(JndiServiceImpl.java:92)
      at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:63)
      at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:115)
      at org.hibernate.service.internal.BasicServiceRegistryImpl.configureService(BasicServiceRegistryImpl.java:81)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:145)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:118)
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:208)
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:85)
      at org.hibernate.service.internal.BasicServiceRegistryImpl.configureService(BasicServiceRegistryImpl.java:81)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:145)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:118)
      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:70)
      at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2256)
      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2252)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1721)
      at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76)
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
      ... 34 more
      Caused by: javax.naming.OperationNotSupportedException
      at bitronix.tm.jndi.BitronixContext.getNameParser(BitronixContext.java:168)
      at javax.naming.InitialContext.getNameParser(InitialContext.java:480)
      at org.hibernate.service.jndi.internal.JndiServiceImpl.parseName(JndiServiceImpl.java:86)
      ... 50 more

        Activity

        Hide
        Ludovic Orban added a comment -

        My opinion is that this extra feature is worth a minor release to make sure BTM will still work flawlessly with Hibernate 4 as the next BTM major one is still far from being released.

        I can make a candidate build of 2.1.2 with the JNDI name parser implemented in it. Would you be able to test it?

        Thanks for the report!

        Show
        Ludovic Orban added a comment - My opinion is that this extra feature is worth a minor release to make sure BTM will still work flawlessly with Hibernate 4 as the next BTM major one is still far from being released. I can make a candidate build of 2.1.2 with the JNDI name parser implemented in it. Would you be able to test it? Thanks for the report!
        Hide
        Christian Bauer added a comment -

        Sure, I can test it. A workaround is to override the Hibernate JndiServiceImpl's method that does the lookup, the parseName() is not really needed there. It's quite trivial in theory but in practice I've been stuck in the new Hibernate bootstrap code for a few hours.

        Show
        Christian Bauer added a comment - Sure, I can test it. A workaround is to override the Hibernate JndiServiceImpl's method that does the lookup, the parseName() is not really needed there. It's quite trivial in theory but in practice I've been stuck in the new Hibernate bootstrap code for a few hours.
        Hide
        Ludovic Orban added a comment -

        I've deployed a 2.1.2-SNAPSHOT build containing the code for the JNDI name parser.

        You can easily test it by telling maven to use Codehaus' Nexus, as is summarized here: http://docs.codehaus.org/display/BTM/Maven2#Maven2-Earlyversions

        I'd be very happy to know how BTM works with Hibernate 4.

        Thanks!

        Show
        Ludovic Orban added a comment - I've deployed a 2.1.2-SNAPSHOT build containing the code for the JNDI name parser. You can easily test it by telling maven to use Codehaus' Nexus, as is summarized here: http://docs.codehaus.org/display/BTM/Maven2#Maven2-Earlyversions I'd be very happy to know how BTM works with Hibernate 4. Thanks!
        Hide
        Christian Bauer added a comment -

        Tested with Hibernate 4.0.0.CR3, works. Thanks

        Show
        Christian Bauer added a comment - Tested with Hibernate 4.0.0.CR3, works. Thanks

          People

          • Assignee:
            Ludovic Orban
            Reporter:
            Christian Bauer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: