This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 260383 - datasource lookup should default to string JNDIConnector.STRING_LOOKUP
Summary: datasource lookup should default to string JNDIConnector.STRING_LOOKUP
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL: http://wiki.eclipse.org/EclipseLink/E...
Whiteboard:
Keywords:
Depends on: 252965
Blocks: 302449 317724
  Show dependency tree
 
Reported: 2009-01-08 07:47 EST by James Sutherland CLA
Modified: 2022-06-09 10:25 EDT (History)
7 users (show)

See Also:
michael.f.obrien: documentation+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Sutherland CLA 2009-01-08 07:47:59 EST
By default we lookup the datasource in JNDI using a composite name, which does not work on several (tomcat, jboss, geronimo, was?, most?) environments.  We should instead default to looking up using string (assuming it works in everything, need to test wls, glassfish, oc4j, was).  If it does not work in everything, then the serverplatform should auto set the lookup type.

We should also make configuring the lookup type easier from jpa.
Comment 1 Michael OBrien CLA 2009-02-24 13:33:23 EST
JBoss 5.0 GA update:
As part of the JBoss 5.0 GA verification of EJB 3.0 support in bug# 252965
We need to reverify whether JBoss 5 functions fine using the default COMPOSITE_NAME_LOOKUP of 2 instead of STRING_LOOKUP of 1 - it looks like a SessionCustomizer may not be needed (only in the case of JBoss 5).
 
Comment 2 Tom Ware CLA 2009-04-16 11:05:14 EDT
Updating priority due to revised bug categorization process.  See the following page for details:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines#Priority_and_Target_Milestone 

If you feel the updated priority is incorrect, please send an email to eclipselink-users@eclipse.org.
Comment 3 Michael OBrien CLA 2009-06-01 16:38:00 EDT
>Reverified Tomcat 6.0.18 using a non-JTA external connection pool datasource - the SessionCustomizer is still required.

javax.persistence.PersistenceException: Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.0.0.qualifier): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [java:comp/env/ds/OracleDS].
Internal Exception: javax.naming.NamingException: This context must be accessed throught a java: URL
	org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:276)


The false result in JBoss may be the result of the fact that Direct Connection JDBC properties were present in the persistence.xml for transaction-type="RESOURCE_LOCAL" - so in effect no non-JTA datasource was actually tested.
Comment 4 Ulrich Romahn CLA 2009-06-03 14:02:37 EDT
I successfully deployed our JEE5 application to JBoss 5.1.0GA using EclipseLink as persistence provider without having to provide the SessionCustomizer.
So, it looks like COMPOSITE_NAME_LOOKUP works in the latest JBoss version.

Here is my persistence.xml as reference:
<?xml version="1.0" encoding="windows-1252" ?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="ReferenceData" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>java:/XARefDataDS</jta-data-source>         
    <properties>
		<property name="eclipselink.target-server" value="JBoss"/>
		<property name="eclipselink.target-database" value="Oracle"/>
		<property name="eclipselink.logging.logger" value="DefaultLogger" />
		<property name="eclipselink.logging.level" value="FINEST"/>
		<property name="eclipselink.weaving" value="false"/>
		<!-- Fully cache Company/Distributor because it's a vocabulary -->
		<property name="eclipselink.cache.type.Company" value="Full" />
		<property name="eclipselink.cache.type.Distributor" value="Full" />
		<!-- Fully cache License for performance -->
		<property name="eclipselink.cache.type.License" value="Full" />
		<property name="eclipselink.cache.type.LicensedSources" value="Full" />
    </properties>
  </persistence-unit>
</persistence>
Comment 5 Michael OBrien CLA 2010-03-01 09:59:11 EST
>See possible required catalina on JBoss 5.1.0 non-jta-datasource (jta-datasource is fine) datasource session customizer STRING_LOOKUP required for bug# 303063
Comment 6 Michael OBrien CLA 2010-06-25 11:12:37 EDT
>For JBoss 5.0.1 EAP, use of a non-jta-data-source is working without a SessionCustomizer - for reference
>However there is at least one user configuration that still hits the "Not a compound name:" exception when doing a context lookup
see bug# 317724
see deprecated catalina workaround for lookupType == STRING_LOOKUP 
http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_Tutorial#Session_Customizer
>See similar "Not a compound name:" exception post in the EclipseLink newsgroup from Feb 2009
http://old.nabble.com/EclipseLink-cannot-acquire-datasource-in-JBoss-5.0-td22163382.html
Comment 7 Michael OBrien CLA 2010-06-25 11:20:01 EDT
>upping priority to p3 - as we have 2 customers that optionally can vote on this issue
>Summary: The issue is normally all JTA and non-JTA connectors work fine
>Some server/configuration environments for non-JTA only - need STRING_LOOKUP set via SessionCustomizer
Comment 8 Michael OBrien CLA 2010-06-25 11:47:47 EDT
>change target to "-" from future to get reprioritized.
>2 users still have issues with non-JTA COMPOSITE_NAME_LOOKUP

>change
public class JNDIConnector implements Connector {
    protected DataSource dataSource;
    protected Context context;
    protected String name;
    public static final int STRING_LOOKUP = 1;
    public static final int COMPOSITE_NAME_LOOKUP = 2;
    public static final int COMPOUND_NAME_LOOKUP = 3;
		//default setting is composite name to be consistent with previous TopLink versions
    protected int lookupType = COMPOSITE_NAME_LOOKUP;

>to
    protected int lookupType = STRING_LOOKUP;
Comment 9 Peter Krogh CLA 2011-06-20 14:10:14 EDT
bug scrubbing to 2.4
Comment 10 Tom Ware CLA 2012-05-29 09:59:49 EDT
Deferring.  Please vote for this issue if it is still a problem for you.
Comment 11 Eclipse Webmaster CLA 2022-06-09 10:15:43 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 12 Eclipse Webmaster CLA 2022-06-09 10:25:33 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink