getting error Invalid Oracle URL specified: OracleDataSource.makeURL


Looks like you have mistakenly given the url two times and the property name is not correct.

<property name="Url" value="jdbc:oracle:thin:@" />  
<property name="URL" value="jdbc:oracle:thin:@" /> 

It should be

<property name="url" value="jdbc:oracle:thin:@" /> 

Also it would be a good idea to refer to the documentation of glassfish 4.1 to get the correct property names you can use in glassfish-resources.xml

For Glassfish 3.1 the options are given here

Author by


A solution-oriented well balanced technical IT Professional with a rich experience of 8 years + in software development covering multiple technologies. I keep atop of new developments within the industry and can adapt quickly to new coding conventions. I am happy working independently or in a close team environment, and apply a positive attitude to every task I undertake. I possess a broad range of technical skills which I refresh on a regular basis, allowing me to respond to new issues with considerable speed.

Updated on June 04, 2022


  • Basit
    Basit over 1 year

    I am getting error when I try to run my application on Server. I am suing eclipse and glass fish server 4. I made a glassfish-resources.xml file and put it in the WEB-INF directory. When I try to run on server. I get the following exception

    Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: 
    Connection could not be allocated because: Invalid Oracle URL specified: 
    Error Code: 0
    at org.eclipse.persistence.exceptions.DatabaseException.sqlException(
    at org.eclipse.persistence.sessions.JNDIConnector.connect(
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(

    Here is my glassfish-resources.xml file

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE resources PUBLIC "-// GlassFish Application Server 3.1  
    Resource Definitions//EN" "">  
        <jdbc-connection-pool name="java:app/myOracleConnectionPool"  
            <property name="User" value="system" />  
            <property name="Port" value="1521" />  
            <property name="DatabaseName" value="XE" />  
            <property name="ServerName" value="" />  
            <property name="Url" value="jdbc:oracle:thin:@" />  
            <property name="URL" value="jdbc:oracle:thin:@" /> 
            <property name="Password" value="xxxx" />  
        <jdbc-resource enabled="true"  
            <description />  

    here is my persistence.xml file

    <persistence-unit name="chapter11PU" transaction-type="JTA">
            <property name="" value="Oracle"/>
            <property name="javax.persistence.schema-generation-action" value="drop-and-create"/>
            <property name="javax.persistence.schema-generation-target" value="scripts"/> 
            <property name="javax.persistence.ddl-create-script-target" value="createfoo.sql"/> 
            <property name="javax.persistence.ddl-drop-script-target" value="dropfoo.sql"/> 
            <property name="eclipselink.deploy-on-startup" value="true"/>
            <property name="eclipselink.application-location" value="/tmp"/>
            <!-- To log SQL queries -->
            <property name="eclipselink.logging.level.sql" value="FINE"/>
            <property name="eclipselink.logging.parameters" value="true"/>
            <property name="eclipselink.logging.level" value="INFO"/>

    I have also put ojdbc6.jar in the lib/ext folder. I am using oracle 11g release 2. Why I am getting invalid url error?

    I have also check the connection in the SQL Developer and it is working, with user system and my password.