Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317724 - EclipseLink 2.0.x throws "not a compound name" exception when using non-jta-data-source in JBoss 5.x because of non-default STRING_LOOKUP JNDI lookupType
Summary: EclipseLink 2.0.x throws "not a compound name" exception when using non-jta-d...
Status: RESOLVED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (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: 260383 302449
Blocks: 293581
  Show dependency tree
 
Reported: 2010-06-23 12:12 EDT by Doug CLA
Modified: 2022-06-09 10:29 EDT (History)
2 users (show)

See Also:


Attachments
JBoss 5.0.1 EAP non-jta-data-source application managed persistence unit on stateful session bean OK (29.03 KB, image/pjpeg)
2010-06-24 15:12 EDT, Michael OBrien CLA
no flags Details
Source: (rough) Eclipse projects (EAR, EJB, WAR) for application managed non-jta persistence unit on stateful session bean from servlet client - used to attempt reproduction - but is working fine OK (206.91 KB, application/x-zip-compressed)
2010-06-24 15:14 EDT, Michael OBrien CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug CLA 2010-06-23 12:12:05 EDT
Build Identifier: 

I encountered a datasource-not-found error when using <non-jta-data-source> in configuring a persistence unit using EclipseLink 2.0.x with the JBoss 5.x application server.

However, when using <jta-data-source> with EclipseLink 2.0.x in JBoss 5.x, everything works well.

Note that the same error with non-jta-data-source seemed to exist in EclipseLink 1.0.x and 1.1.x, but was corrected in EclipseLink 1.2.x

Reproducible: Always

Steps to Reproduce:
1.Configure a <non-jta-data-source> persistence unit in the persistence.xml file 
2.Deploy it to JBoss 5.x
3.
Comment 1 Michael OBrien CLA 2010-06-23 13:09:38 EDT
>Doug, will verify shortly on a running JBoss 5.0.0 EAP server while developing for enhancement bug # 316511 when I get back in tomorrow

Also verify setup requirements for datasource in JBoss in the EclipseLink JPA tutorial for JBoss below
http://wiki.eclipse.org/EclipseLink/Examples/JPA/JBoss_Web_Tutorial#JNDI_JTA.2Fnon-JTA_Server_DataSource_Setup
- i will add a non-jta-data-source section to 
http://wiki.eclipse.org/EclipseLink/Examples/JPA/JBoss_Web_Tutorial#Persistence.xml
Comment 2 Michael OBrien CLA 2010-06-24 15:07:11 EDT
>Running a non-jta-data-source in an application managed persistence unit
>on a @Stateful session bean is working fine
>Q) Can you post the details of your specific config and exception - as I am working ok on JBoss 5.0.1 EAP using EclipseLink 2.2 (trunk)

<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="exampleApplicationManaged" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <non-jta-data-source>java:/DefaultDS</non-jta-data-source>        
        <class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
        <class>org.eclipse.persistence.example.jpa.server.business.CellAttribute</class>
        <properties>
            <property name="eclipselink.target-server" value="JBoss"/>
            <property name="eclipselink.target-database" value="HSQL"/>
            <property name="eclipselink.logging.level" value="FINEST"/>
        </properties>       
    </persistence-unit>
    <persistence-unit name="example" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <!-- The demo will run out of the box with the DefaultDS HQSL datasource provided you have copied eclipselink.jar to the \common\lib directory.-->
        <jta-data-source>java:/DefaultDS</jta-data-source>        
        <class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
        <class>org.eclipse.persistence.example.jpa.server.business.CellAttribute</class>
        <properties>
            <property name="eclipselink.target-server" value="JBoss"/>
            <property name="eclipselink.target-database" value="HSQL"/>
            <!-- turn off DDL gen (2 properties below) for production and retest environments -->            
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
            <property name="eclipselink.ddl-generation.output-mode" value="database"/>
            <property name="eclipselink.logging.level" value="FINEST"/>
        </properties>       
    </persistence-unit>
</persistence>

>I get the following output from a standard EJBQL query
14:34:34,944 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'

14:34:38,396 INFO  [JBossASKernel] installing bean: jboss.j2ee:ear=org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEAR.ear,jar=org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEJB.jar,name=ApplicationService,service=EJB3
14:34:38,396 INFO  [JBossASKernel]   with dependencies:
14:34:38,396 INFO  [JBossASKernel]   and demands:
14:34:38,396 INFO  [JBossASKernel] 	jboss.ejb:service=EJBTimerService
14:34:38,396 INFO  [JBossASKernel] 	persistence.unit:unitName=org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEJB.jar#exampleApplicationManaged

14:34:39,497 INFO  [EJBContainer] STARTED EJB: org.eclipse.persistence.example.jpa.server.business.ApplicationService ejbName: ApplicationService

14:34:44,058 INFO  [STDOUT] [EL Finest]: 2010-06-24 14:34:44.058--ServerSession(29865054)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--Begin deploying Persistence Unit exampleApplicationManaged; session vfszip:/C:/opt/jboss-eap-5.0b/jboss-as/server/default/deploy/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEJB.jar/_exampleApplicationManaged; state Predeployed; factoryCount 1
14:34:44,598 INFO  [STDOUT] [EL Config]: 2010-06-24 14:34:44.598--ServerSession(29865054)--Connection(13945008)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--connecting(DatabaseLogin(
	platform=>HSQLPlatform
	user name=> ""
	connector=>JNDIConnector datasource name=>null
))
14:34:44,618 INFO  [STDOUT] [EL Config]: 2010-06-24 14:34:44.618--ServerSession(29865054)--Connection(29608557)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--Connected: jdbc:hsqldb:C:\opt\jboss-eap-5.0b\jboss-as\server\default\data\hypersonic\localDB
	User: SA
	Database: HSQL Database Engine  Version: 1.8.0
	Driver: HSQL Database Engine Driver  Version: 1.8.0
14:34:44,618 INFO  [STDOUT] [EL Config]: 2010-06-24 14:34:44.618--ServerSession(29865054)--Connection(11021090)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--connecting(DatabaseLogin(
	platform=>HSQLPlatform
	user name=> ""
	connector=>JNDIConnector datasource name=>null
))
14:34:44,618 INFO  [STDOUT] [EL Config]: 2010-06-24 14:34:44.618--ServerSession(29865054)--Connection(11002691)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--Connected: jdbc:hsqldb:C:\opt\jboss-eap-5.0b\jboss-as\server\default\data\hypersonic\localDB
	User: SA
	Database: HSQL Database Engine  Version: 1.8.0
	Driver: HSQL Database Engine Driver  Version: 1.8.0
14:34:44,628 INFO  [STDOUT] [EL Finest]: 2010-06-24 14:34:44.628--ServerSession(29865054)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--sequencing connected, state is Preallocation_NoTransaction_State
14:34:44,628 INFO  [STDOUT] [EL Finest]: 2010-06-24 14:34:44.628--ServerSession(29865054)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--sequence EL_CELL_SEQ: preallocation size 25
14:34:44,678 INFO  [STDOUT] [EL Info]: 2010-06-24 14:34:44.678--ServerSession(29865054)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--vfszip:/C:/opt/jboss-eap-5.0b/jboss-as/server/default/deploy/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEJB.jar/_exampleApplicationManaged login successful
14:34:44,728 INFO  [STDOUT] [EL Finest]: 2010-06-24 14:34:44.728--ServerSession(29865054)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--End deploying Persistence Unit exampleApplicationManaged; session vfszip:/C:/opt/jboss-eap-5.0b/jboss-as/server/default/deploy/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEJB.jar/_exampleApplicationManaged; state Deployed; factoryCount 1

14:34:44,938 INFO  [STDOUT] [EL Finest]: 2010-06-24 14:34:44.938--UnitOfWork(19973008)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--Execute query ReadAllQuery(referenceClass=Cell sql="SELECT ID, STATE, TSEQ, ACELLATTRIBUTE_ID, RIGHT_ID FROM EL_CELL")
14:34:44,948 INFO  [STDOUT] [EL Finest]: 2010-06-24 14:34:44.948--ServerSession(29865054)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--reconnecting to external connection pool
14:34:44,948 INFO  [STDOUT] [EL Fine]: 2010-06-24 14:34:44.948--ServerSession(29865054)--Connection(23896594)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--SELECT ID, STATE, TSEQ, ACELLATTRIBUTE_ID, RIGHT_ID FROM EL_CELL
14:34:44,980 INFO  [STDOUT] [EL Finest]: 2010-06-24 14:34:44.98--ServerSession(29865054)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--Execute query ReadAllQuery(name="references" referenceClass=Cell sql="SELECT t1.ID, t1.STATE, t1.TSEQ, t1.ACELLATTRIBUTE_ID, t1.RIGHT_ID FROM EL_CELL_EL_CELL t0, EL_CELL t1 WHERE ((t0.peers_ID = ?) AND (t1.ID = t0.references_ID))")
14:34:44,980 INFO  [STDOUT] [EL Finest]: 2010-06-24 14:34:44.98--ServerSession(29865054)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--reconnecting to external connection pool
14:34:44,980 INFO  [STDOUT] [EL Fine]: 2010-06-24 14:34:44.98--ServerSession(29865054)--Connection(1204646)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--SELECT t1.ID, t1.STATE, t1.TSEQ, t1.ACELLATTRIBUTE_ID, t1.RIGHT_ID FROM EL_CELL_EL_CELL t0, EL_CELL t1 WHERE ((t0.peers_ID = ?) AND (t1.ID = t0.references_ID))
	bind => [1]
14:34:45,000 INFO  [STDOUT] [EL Finest]: 2010-06-24 14:34:45.0--UnitOfWork(19973008)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--Register the existing object org.eclipse.persistence.example.jpa.server.business.Cell@11437483( id: 2 state: null left: null right: null parent: HashSet@29739708 references: HashSet@29739708)

>running on the following session bean / servlet client
public class FrontController extends HttpServlet implements Servlet {
    public static final String APPLICATION_SERVICE_JNDI_NAME = "org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEAR/ApplicationService/remote-org.eclipse.persistence.example.jpa.server.business.ApplicationServiceRemote";      private ApplicationServiceRemote applicationService;
...}

@Stateful(name="ApplicationService", mappedName="ApplicationService")
@Remote(ApplicationServiceRemote.class)
public class ApplicationService implements ApplicationServiceRemote  {
    private EntityManager entityManager;
    @PersistenceUnit(unitName="exampleApplicationManaged")
..}

>see ongoing tutorial at
http://wiki.eclipse.org/EclipseLink/Examples/JPA/JBoss_Web_Tutorial#non-JTA_Persistence.xml

>If your specific configuration error is reproducable - the bug will be reopened and prioritized
Comment 3 Michael OBrien CLA 2010-06-24 15:12:10 EDT
Created attachment 172669 [details]
JBoss 5.0.1 EAP non-jta-data-source application managed persistence unit on stateful session bean OK
Comment 4 Michael OBrien CLA 2010-06-24 15:14:08 EDT
Created attachment 172671 [details]
Source: (rough) Eclipse projects (EAR, EJB, WAR) for application managed non-jta persistence unit on stateful session bean from servlet client - used to attempt reproduction - but is working fine OK
Comment 5 Michael OBrien CLA 2010-06-25 11:16:57 EDT
>In reply to the email containing the trace - this is a catalina based issue with JNDI lookup defaults
08:59:03,468 INFO  [STDOUT] [EL Severe]: 2010-06-25 08:59:03.468--ServerSession(17200981)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--Local Exception Stack:
Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [java:/jpaTestDS].
Internal Exception: javax.naming.InvalidNameException: Not a compound name: jpaTestDS
    at org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:451)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:116)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:327)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:295)
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:415)
    at org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:155)
    at org.eclipse.persistence.sessions.server.ExternalConnectionPool.startUp(ExternalConnectionPool.java:118)
    at org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:495)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:632)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:230)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:369)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:151)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:195)
    at jpatest.web.TestBean.testVehicleNonJta(TestBean.java:119)
    at jpatest.web.TestBean.doSubmit(TestBean.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:170)
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    at javax.faces.component.UICommand.broadcast(UICommand.java:387)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

>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
>here I suggested that you set the lookupType on both connectors to STRING_LOOKUP
- this was fixed a while ago but may still occur for old versions of catalina based JBoss 5 servers.

http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_Tutorial#Session_Customizer
Comment 6 Michael OBrien CLA 2010-06-25 11:20:17 EDT
>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 7 Eclipse Webmaster CLA 2022-06-09 10:29:14 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink