Hi,

thank you for your fast response.

It is now solved, the problem was that there is another pom.xml in the 
ear-project, and there the driver was excluded by marking it as provided.
I had to delete the following lines:

<dependency>
   <groupId>org.postgresql</groupId>
   <artifactId>postgresql</artifactId>
   <scope>provided</scope>
</dependency>

Best regards
Stefan


Von: Andrea Aime <andrea.a...@geo-solutions.it>
Gesendet: Donnerstag, 11. Juli 2019 14:30
An: Schuster Stefan <stefan.schus...@gevas.de>
Cc: geotools-gt2-users@lists.sourceforge.net
Betreff: Re: [Geotools-gt2-users] datastore for postigis in wildfly

Hi,
I have no experience with wildfly, but the situation you're seeing it often 
associated
with the JDBC driver for postgresql not being in the classpath, or not being 
visible
due to container classpath restrictions

Cheers
Andrea


On Thu, Jul 11, 2019 at 2:04 PM Schuster Stefan 
<stefan.schus...@gevas.de<mailto:stefan.schus...@gevas.de>> wrote:
Hello,

I use geotools for accessing a postigs-db. This works fine in a standalone java 
application. But in doesn’t in a wildfly application.
In pom.xml the dependency is included:

    <dependency>
     <groupId>org.geotools.jdbc</groupId>
     <artifactId>gt-jdbc-postgis</artifactId>
    </dependency>

I use the following sample code (internal values replaced by X)

    Map<String, Object> params = new HashMap<>();
    params.put("dbtype", "postgis");
    params.put("host", "X.X.X.X");
    params.put("port", 5432);
    params.put("schema", "gis");
    params.put("database", "postgis");
    params.put("user", "XXX");
    params.put("passwd", "XXX");

    DataStore store = DataStoreFinder.getDataStore(params);
    System.out.println("params" + params);
    System.out.println("store:" + store);

    Iterator it = DataStoreFinder.getAvailableDataStores();
    while(it.hasNext()){
      System.out.println(it.next());
    }


In a Standalone java application the output is the following:
params{schema=gis, database=postgis, port=5432, passwd=XXX, dbtype=postgis, 
host=X.X.X.X, user=XXX}
store:org.geotools.jdbc.JDBCDataStore@4516af24
org.geotools.data.postgis.PostgisNGDataStoreFactory@35bbe5e8<mailto:org.geotools.data.postgis.PostgisNGDataStoreFactory@35bbe5e8>
org.geotools.data.postgis.PostgisNGJNDIDataStoreFactory@2d209079<mailto:org.geotools.data.postgis.PostgisNGJNDIDataStoreFactory@2d209079>

running the same in a wilfly application returns:

params: {schema=gis, database=postgis, port=5432, passwd=XXX, dbtype=postgis, 
host=X.X.X.X, user=XXX}
store:null
org.geotools.data.postgis.PostgisNGJNDIDataStoreFactory@19230b4d<mailto:org.geotools.data.postgis.PostgisNGJNDIDataStoreFactory@19230b4d>

Why is store null in second case? Why is there only one StoreFinder in second 
case, but two StoreFinder in first case?

I’m using geotools 20.1, java 8, wildfly 10.1

Thank you for any ideas.

Stefan
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net<mailto:GeoTools-GT2-Users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


--

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit 
http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf 
Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) 
phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 
http://www.geo-solutions.it http://twitter.com/geosolutions_it 
------------------------------------------------------- Con riferimento alla 
normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento 
generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza 
inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è 
un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo 
scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, 
ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene 
notizia. This email is intended only for the person or entity to which it is 
addressed and may contain information that is privileged, confidential or 
otherwise protected from disclosure. We remind that - as provided by European 
Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or 
the information herein by anyone other than the intended recipient is 
prohibited. If you have received this email by mistake, please notify us 
immediately by telephone or e-mail.
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to