2

I searched and tried a lot but nothing helps.

I getting the "well known" -Error. (Error Code: 0 - no more information)

My persistence-.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="JPA_PU" transaction-type="RESOURCE_LOCAL">
        <non-jta-data-source>java:/comp/env/jdbc/jpaConnector</non-jta-data-source>
        <!-- <properties> -->
        <!-- <property name="eclipselink.target-database" value="SQLServer" /> -->
        <!-- <property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /> -->
        <!-- <property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://sqlserver01:1433;databaseName=DB_NAME" /> -->
        <!-- <property name="javax.persistence.jdbc.user" value="jpaUsr" /> -->
        <!-- <property name="javax.persistence.jdbc.password" value="pwd01" /> -->
        <!-- </properties> -->
    </persistence-unit>
</persistence>

my web.xml

    ...
    </servlet-mapping>
    <resource-ref>
        <res-ref-name>jdbc/jpaConnector</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
    ...
</web-app>

my server.xml (Catalina_home\conf\server.xml)

<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container" 
    type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" 
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" />

<Resource name="jdbc/jpaConnector" auth="Container" 
    type="javax.sql.DataSource" username="jpaUsr" 
    password="pwd01" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
    url="jdbc:sqlserver://sqlserver01:1433;databaseName=DB_NAME" 
    maxActive="8" maxIdle="4"/>
</GlobalNamingResources>

What I've tried:

-Use the direct way to access the Database (the comment in the persistence.xml) ... yes its works! So I think the driver and everything is working.

Versions:

Tomcat 7.0.47

Eclipse-Link 2.5.2

SQL Server 2014 Express JDBC-Driver: 4.0.2206.100

Trival
  • 553
  • 1
  • 5
  • 9
  • Maybe this one will help: http://stackoverflow.com/questions/11516747/cannot-create-jdbc-driver-of-class-for-connect-url-null-i-do-not-underst – Dmitry Apr 10 '15 at 09:07
  • If I understand it correctly the solution was to provide a context.xml? But this is exactly what I not want, I want that the configuration for the datasource is outside of the deployed app. – Trival Apr 12 '15 at 09:46
  • Can you provide a full stacktrace (if any)? – MRalwasser Apr 28 '15 at 15:13

0 Answers0