Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image gs-stable-2.24.x does not start due to missing GeoDBDialect #141

Closed
hbruch opened this issue Apr 29, 2024 · 5 comments
Closed
Assignees

Comments

@hbruch
Copy link

hbruch commented Apr 29, 2024

As the latest geosolutionsit/geoserver:2.24.2 does not yet contain #139, I tried geosolutionsit/geoserver:gs-stable-2.24.x.

The geoserver does no start, due to apparently installed geofence-plugin:

/usr/local/tomcat$ ls -l webapps/geoserver/WEB-INF/lib/ | grep geofence
-rw-r--r-- 1 tomcat tomcat    58624 Nov  9 14:27 geofence-model-internal-3.7.1.jar
-rw-r--r-- 1 tomcat tomcat    38243 Nov  9 14:27 geofence-persistence-3.7.1.jar
-rw-r--r-- 1 tomcat tomcat    41088 Nov  9 14:27 geofence-services-api-3.7.1.jar
-rw-r--r-- 1 tomcat tomcat    51285 Nov  9 14:27 geofence-services-impl-3.7.1.jar
-rw-r--r-- 1 tomcat tomcat 13984739 Apr 24 07:34 geoserver-2.24-SNAPSHOT-geofence-server-plugin.zip
-rw-r--r-- 1 tomcat tomcat   101531 Apr 24 07:34 gs-geofence-2.24-SNAPSHOT.jar
-rw-r--r-- 1 tomcat tomcat   167541 Apr 24 07:34 gs-geofence-server-2.24-SNAPSHOT.jar

The exception

29-Apr-2024 17:51:00.444 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.geoserver.platform.GeoServerContextLoaderListener]
	org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'geofenceEntityManagerFactory' defined in URL [jar:file:/usr/local/tomcat/webapps/geoserver/WEB-INF/lib/geofence-persistence-3.7.1.jar!/applicationContext-geofenceDatasource.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: geofence] Unable to build EntityManagerFactory
		at 
...
	Caused by: javax.persistence.PersistenceException: [PersistenceUnit: geofence] Unable to build EntityManagerFactory
		at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
		at org.springframework.orm.jpa.vendor.SpringHibernateEjbPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateEjbPersistenceProvider.java:51)
		at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
		at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:319)
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
		... 54 more
	Caused by: org.hibernate.HibernateException: Dialect class not found: org.hibernatespatial.geodb.GeoDBDialect
		at org.hibernate.dialect.resolver.DialectFactory.constructDialect(DialectFactory.java:159)
		at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:99)
		at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:117)
		at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
		at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
		at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
		at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
		... 59 more
	Caused by: java.lang.ClassNotFoundException: org.hibernatespatial.geodb.GeoDBDialect
		at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1412)
		at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)
		at java.base/java.lang.Class.forName0(Native Method)
		at java.base/java.lang.Class.forName(Class.java:315)
		at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)
		at org.hibernate.dialect.resolver.DialectFactory.constructDialect(DialectFactory.java:156)
		... 65 more
29-Apr-2024 17:51:00.459 INFO [main] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext

suggests that org.hibernatespatial.geodb.GeoDBDialect is missing.

The installed hibernate jars are:

ls -l webapps/geoserver/WEB-INF/lib/ | grep hibernate
-rw-r--r-- 1 tomcat tomcat    71283 May  4  2020 hibernate-commons-annotations-3.2.0.Final.jar
-rw-r--r-- 1 tomcat tomcat  3119700 May  4  2020 hibernate-core-3.6.9.Final.jar
-rw-r--r-- 1 tomcat tomcat    11280 May  4  2020 hibernate-ehcache-3.6.9.Final.jar
-rw-r--r-- 1 tomcat tomcat   426314 May  4  2020 hibernate-entitymanager-3.6.9.Final.jar
-rw-r--r-- 1 tomcat tomcat   102661 May  4  2020 hibernate-jpa-2.0-api-1.0.1.Final.jar
-rw-r--r-- 1 tomcat tomcat    92968 Feb  8  2021 hibernate-spatial-1.1.3.2.jar
-rw-r--r-- 1 root   root      15969 Feb  8  2021 hibernate-spatial-postgis-1.1.3.2.jar
-rw-r--r-- 1 tomcat tomcat    15520 May  4  2020 search-hibernate-1.1.0.jar
-rw-r--r-- 1 tomcat tomcat     3261 May  4  2020 search-jpa-hibernate-1.1.0.jar

As this repo has the geofence plugins commented out, I wonder what the source of the gs-stable-2.24.x image is(?)

@randomorder
Copy link
Member

Hi @hbruch

I'll take a look. If it is just a matter of missing unzip package then a rebuild of the images should fix it

@hbruch
Copy link
Author

hbruch commented May 2, 2024

Thanks! I'm not sure, if the missing unzip is the cause. In the nightly stable build, it's already included, but to me it seems that the geofence-plugin misses a dependency(?). I see that the nightly images are built via hooks/build, but not with which plugins it is built, as this is a env var externally defined. Is the geofence-server plugin specified as additional plugin?

@david7378
Copy link
Contributor

david7378 commented May 7, 2024

I managed to make it work. Here's what I did:

  1. Cloned docker-geoserver repository.
  2. Built a test image with the following parameters.
docker build -t geoserver:test-2.24.x \
--build-arg  GEOSERVER_WEBAPP_SRC=https://build.geoserver.org/geoserver/2.24.x/geoserver-2.24.x-latest-war.zip \
--build-arg PLUG_IN_URLS="https://build.geoserver.org/geoserver/2.24.x/ext-latest/geoserver-2.24-SNAPSHOT-geofence-server-plugin.zip" .
  1. Ran the test image with the following parameters.
    Note: I added this parameter -Dgwc.context.suffix=gwc because when I accessed /geoserver, it redirected to geowebcache.
docker run -e EXTRA_GEOSERVER_OPTS='-Dgwc.context.suffix=gwc' --name gs -p 8080:8080 geoserver:test-2.24.x
  1. Tested it on the browser.

Image

Image

@randomorder
Copy link
Member

Hi @hbruch

I see that the nightly images are built via hooks/build, but not with which plugins it is built, as this is a env var externally defined. Is the geofence-server plugin specified as additional plugin?

The only plugins included by default are: monitor, controlflow and libjpegturbo: https://github.com/geosolutions-it/docker-geoserver/blob/master/hooks/build#L3

We were only able to reproduce your error if installing both the geofence AND the geofence-server plugin. That should be avoided you either install one or the other. Typically the geofence-server plugin only is installed in order to integrate geofence into geoserver. The other plugin is used only if you have a running external standalone geofence and you want geoserver to connect to it.
More info here: https://docs.geoserver.org/main/en/user/extensions/geofence-server/installing.html

Can you confirm you were trying to add both plugins at the same time?

The need to add the system variable "'-Dgwc.context.suffix=gwc" to the JAVA_OPTS is also covered by the documentation. Without that JAVA_OPT set you will have issues accessing the geoserver UI @david7378

@randomorder
Copy link
Member

Closing the issue due to lack of feedback. Do let us know if you still have issues @hbruch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants