web.xml data-source url tag not recognized

65 views
Skip to first unread message

Alessandro de Manzano

unread,
Jul 4, 2019, 7:09:49 AM7/4/19
to Payara Forum
Hi!

I'm trying to port a Java EE 8 app from Wildfly to Payara 5.x  and I'm having a weird issue with the data source definition in web.xml.

Seems that tag <url> is not recognized / used by Payara, example:

  <data-source>
        <name>java:global/psicogest</name>
        <class-name>org.postgresql.ds.PGSimpleDataSource</class-name>
        <url>jdbc:postgresql://database/dbname</url>
        <user>dbuser</user>
        <password>dbpasswd</password>
    </data-source>



This config does NOT work with Payara 5.192, I MUST convert the <url> tag in <server-name> and <database-name> tags.

Why this incompatibility ? the <url> tag is defined in web.xml XSD so it should be standard..

Any hint is very welcome!

many thanks

Ale

Ondro Mihályi

unread,
Jul 4, 2019, 9:54:05 AM7/4/19
to Alessandro de Manzano, Payara Forum
Hi,

I'm not sure why url would be ignored in Payara Server. It's only ignored when at least one of server-name, database-name or port-number is specified, more info in the Payara code: https://github.com/payara/Payara/blob/70e98fbe94cd3bb72b4e1b6f88f87f9eedab459e/appserver/jdbc/jdbc-runtime/src/main/java/org/glassfish/jdbc/deployer/DataSourceDefinitionDeployer.java#L1031


Your definition doesn't contain any of the above tags so the <url> tag should be taken into account.

It might be a bug in other place of Payara code. If you think it's a bug, you should raise an issue with a reproducer project (it can be based on the embedded H2 DB so that PostgreSQL is not necessary, with url jdbc:h2:mem:test

All the best,
Ondro

št 4. 7. 2019 o 13:09 Alessandro de Manzano <dema...@dqmicro.it> napísal(a):
--
You received this message because you are subscribed to the Google Groups "Payara Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/be2f1a78-c72b-48c2-8a6b-3b2fd7cd6225%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alessandro de Manzano

unread,
Jul 4, 2019, 11:52:56 AM7/4/19
to Payara Forum
Hi!

thanks for answer !

I did more tests, I see that if I leave the url tag (as my example) Payara actually tries to connect to "localhost:5432" instead of correct hostname, so I think there may be a bug with the url value parsing and/or with some defaults (where "localhost" come from ? not from me..)
I'll try to dig into source code before opening an issue.

Many thanks!

Ale

To unsubscribe from this group and stop receiving emails from it, send an email to payara...@googlegroups.com.

Alessandro de Manzano

unread,
Jul 4, 2019, 12:49:43 PM7/4/19
to Payara Forum
Hi!

I digged a bit into source code, I found something that could be related to this issue.

the class
org.glassfish.jdbcruntime.deployment.annotation.handlers.DataSourceDefinitionHandler

at line 232 begins the merge() method.

It seems to me that the logic never process the URL value, it checks URL presence many times (same for serverName etc.) but if I understand the code correctly it, actually, ignores the URL..

If you agree I'll raise an issue :)

thanks again!

Ale

Ondro Mihályi

unread,
Jul 5, 2019, 5:49:01 PM7/5/19
to Payara Forum
Yes, please, raise an issue on github. It would certainly help if you also attached an example application to reproduce it.

Ondro

ondrej....@gmail.com

unread,
Jul 6, 2019, 8:46:44 AM7/6/19
to Alessandro de Manzano, Payara Forum

It's possible there's a bug then. Please raise an issue, ideally with an example app that reproduces it.

 

Ondro

To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/1e074a4a-4300-400c-beb1-a050d01a7818%40googlegroups.com.

Arjan Tijms

unread,
Jul 10, 2019, 3:39:59 PM7/10/19
to Payara Forum
You could possibly use this project to base the reproducer on:


Interestingly, that one also uses just the URL.


Reply all
Reply to author
Forward
0 new messages