eclipselink - Glassfish: Unable to map datasource JNDI name to portable name using glassfish-web.xml -
eclipselink - Glassfish: Unable to map datasource JNDI name to portable name using glassfish-web.xml -
i'm going insane trying create java ee 6 webapp portable between glassfish 3.x , jboss 6 (and 7 when released).
because each server maps jndi names datasources differently, need specify application-private internal name datasource in persistence.xml utilize glassfish-web.xml or jboss-web.xml (as appropriate) map real datasource name in server.
the theory simple (well, ee):
use internal name in persistence.xml, eg "my-datasource" add resource-ref entry web.xml declaring app needs resource called "my-datasource" add mapping in glassfish-web.xml , jboss-web.xml appropriate server's syntax, declaring "my-datasource" should mapped app server provided info source named "real-ds-created-by-admin"unfortunately, theory far goes, because life of me cannot create work in glassfish 3.1, 3.1.1, 3.2 beta, jboss 6, or jboss 7 beta. right i'm focusing on getting working on glassfish.
glassfish reports "invalid resource : my-datasource__pm" when seek deploy app references "my-datasource" in persistence.xml:
<?xml version="1.0" encoding="utf-8"?> <persistence version="2.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_2_0.xsd"> <persistence-unit name="org.example_glassfish-webxml-datasource-jndi-mapping_war_1.0-snapshotpu" transaction-type="jta"> <jta-data-source>my-datasource</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties/> </persistence-unit> </persistence>
and maps known existing datasource via web.xml:
<?xml version="1.0" encoding="utf-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <!-- servlet declarations etc elided ... --> <resource-ref> <res-ref-name>my-datasource</res-ref-name> <res-type>javax.sql.datasource</res-type> <res-auth>container</res-auth> <res-sharing-scope>shareable</res-sharing-scope> </resource-ref> </web-app>
... , glassfish-web.xml:
<?xml version="1.0" encoding="utf-8"?> <!doctype glassfish-web-app public "-//glassfish.org//dtd glassfish application server 3.1 servlet 3.0//en" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd"> <glassfish-web-app error-url=""> <resource-ref> <res-ref-name>my-datasource</res-ref-name> <jndi-name>realdsname</jndi-name> </resource-ref> </glassfish-web-app>
"asadmin list-jndi-entries" shows actual datasource jndi name appears in glassfish-web.xml listing entry "__pm" suffix that's generated glassfish:
$ asadmin list-jndi-entries .... unrelated output .... realdsname__pm: javax.naming.reference realdsname: javax.naming.reference
needless say, driving me wall. ideas on i'm missing?
ok, here's situation.
it's not supposed work (see http://java.net/jira/browse/glassfish-17024) , apparently that's ok.
apparently defines info sources in annotations, in web.xml <data-source/> clauses, or targets 1 app server. mapping stuff non-functional jpa though works fine @resource injection, jndi lookups, spring, etc.
i've added already-way-too-long java ee 6 warts , traps page.
glassfish eclipselink java-ee-6
Comments
Post a Comment