Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-3767

tomee plume ignore jndi datasource in persistence.xml

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 7.0.0
    • None
    • None
    • tomee plume 1.7.5
      eclipselink 2.4.2
      jpa 2.0

      tomee plume 8.0.8
      eclipselink 2.7.7
      jpa 2.0

    Description

      Eclipselink ignore JNDI name context in persistence.xml file since tomee 7.0

      I create 2 project on github with equal source, but different version of tomee 1.7.5 - lust success work and 8.0.8 - last avaliable in maven repository

      8.0.8 just ignore JNDI name context connection and get default hsql db connection, but 1.7.5 work currectly

      1, with good job project - https://github.com/alexanderbobrov/tomee1.7jpa

      2, fail project - https://github.com/alexanderbobrov/tomee8jpa

      In this project I try compare connection string that i give from directly from JNDI and from entity manager
      context.xml work local on machines with trusted connection postgresql server

      <Resource name="jdbc/test_ds" auth="Container" type="javax.sql.DataSource" username="postgres" password="" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/postgres?currentSchema=public" maxTotal="25000" maxIdle="1000" validationQuery="select 1" />
      

      persistence.xml

      <non-jta-data-source>test_ds</non-jta-data-source>
      

      and java code

      @PersistenceUnit(unitName="persunit")
      private EntityManagerFactory factory;
      
      @Resource(name="jdbc/test_ds")
      private DataSource dataSource;
      
      .....
      
      PrintWriter out = response.getWriter();
      
      Connection con = dataSource.getConnection();
      out.println("connection url from datasource resource\n"+con.getMetaData().getURL()+"\n");
      
      EntityManager em = factory.createEntityManager();
      Connection con = em.unwrap(java.sql.Connection.class);
      out.println("connection url from entity manager\n"+con.getMetaData().getURL()+"\n");
      

      an tomee plume 1.7.5 i get equally connection string at both way


      connection url from datasource resource
      jdbc:postgresql://localhost:5432/postgres?currentSchema=public

      connection url from entity manager
      jdbc:postgresql://localhost:5432/postgres?currentSchema=public


      but in tomee plume 8.0.8 connection string be different


      connection url from datasource resource
      jdbc:postgresql://localhost:5432/postgres?currentSchema=public

      connection url from entity manager
      jdbc:hsqldb:file:\git\tomee8jpa\target\apache-tomee\data\hsqldb\hsqldb


      Attachments

        Activity

          People

            Unassigned Unassigned
            alexandr.bobrov@gmail.com Alexander Bobrov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: