Thanks, looking forward to it.
Most probably we’ll include this example in the collection at GitHub - jmix-framework/jmix-samples-2: Examples of solving typical problems in Jmix applications.
Thanks, looking forward to it.
Most probably we’ll include this example in the collection at GitHub - jmix-framework/jmix-samples-2: Examples of solving typical problems in Jmix applications.
Hi,
We have changed the project a little bit as folowing:
Here it is the modified version:
https://github.com/sorinfederiga/multidbmt
It works as expected but here are some of the problems I think we have to deal with later and all of them are related :
1.You cannot set the rights on screens separatly by tenant database, only by all of them. I suppose all the rights works the same so we have to make another layer of managining user rights separately. I am not sure if this can be done other than by doing in a inhouse solution.
2.This one is a little bit more tricky as on search box if you save one filter it will remain on all databases. This one it will raise some problems as it mess together different filters that are not suitable from one database tenant to another. I am not sure how it can be done yet.
3. Same is on reports but you can use directly with jasper and do it custom without the jmix addon so this is not so big deal.
What do you think ?
Regards Camil Ghircoias
Hi Camil,
All these issues stem from the fact that entities used by these features (ResourcePolicyEntity
, ResourceRoleEntity
, FilterConfiguration
, Report
and so on) are located in the main data store, which is shared. And there is no way to put them in the additional one, which is tenant-specific. So all configuration data is now shared between tenants.
I have an idea to rework the application in such a way that the Main Data Store will become tenant-specific, and an additional shared data store will contain users and tenants. So all built-in configuration entities will be tenant-specific. And if you need a shared entity, you will create it in the additional data store.
Is there any potential issue you foresee with this solution?
Regards,
Konstantin
I beleive this would be the right solution.
Users and tenants in one shared database and the rest database specific. That’s how i deal with specific database now in our winform app. One database for users and some general configuration like rights for one tenant database or another - and the rest like reports, rights on forms and menus all are set in specific database.
If you can make it this way it will solve the tenant problems.
Done. Now the main data store is used for tenant data and the additional shared one stores the lists of users and tenants.
Looking forward to your review and comments!
Regards,
Konstantin
Hi,
I’ve run the app and from what i saw it looks good.
Flow ui data is stored in tenant1,2,3 database not in main database. That is perfect.
Users are stored in shared database.
What method did you used to change where user data like flowui is saved ( from main database in specific tenant database 1,2,3 ) ?
Will do some more tests after the Easter vacation but things looks good so far.
Regards,
Camil
Interesting solution. I have a question, @krivopustov if I wanted to share the information of any table should be marked as @Store(name = "shared")
to be used by all tenants?
Another thing, how would REST services work?
Nothing special. All standard Jmix subsystems (the core modules and add-ons) store data in the main data store. So as soon as it became tenant-specific (with the help of RoutingDatasource
), the Flow UI settings and filters are now stored in tenant databases.
Yes. Then the entity will be stored in the additional data store shared between tenants.
Generic REST won’t work with tenant databases, all requests will go to the default main database. The proper handling of REST requests needs further R&D. We’ll address it later.
I built application based on this project and it is working fine on localhost, but when i install this on server, it gives 404 error. below is catalina log -
server - tocat 10.0.21 zulujdk 17.03 (I have other app in flow witch is working on this configuration)
TE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
24-May-2024 07:50:11.811 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin Match [Server/Service/Connector] failed to set property [compressableMimeType] to [text/html,text/xml,text/plain,text/css,application/xml,application/xhtml+xml,application/rss+xml,application/javascript,application/x-javascript,image/svg+xml]
24-May-2024 07:50:11.841 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin Match [Server/Service/Connector] failed to set property [compressableMimeType] to [text/html,text/xml,text/plain,text/css,application/xml,application/xhtml+xml,application/rss+xml,application/javascript,application/x-javascript,image/svg+xml]
24-May-2024 07:50:11.974 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/10.0.21
24-May-2024 07:50:11.974 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: May 10 2022 21:53:12 UTC
24-May-2024 07:50:11.975 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 10.0.21.0
24-May-2024 07:50:11.975 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
24-May-2024 07:50:11.976 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0
24-May-2024 07:50:11.977 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
24-May-2024 07:50:11.977 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/java/zulu-17.0.3
24-May-2024 07:50:11.978 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 17.0.3+7-LTS
24-May-2024 07:50:11.978 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Azul Systems, Inc.
24-May-2024 07:50:11.979 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /opt/tomcat
24-May-2024 07:50:11.980 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/tomcat
24-May-2024 07:50:11.982 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
24-May-2024 07:50:11.982 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
24-May-2024 07:50:11.984 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
24-May-2024 07:50:11.984 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
24-May-2024 07:50:11.985 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
24-May-2024 07:50:11.986 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UnlockExperimentalVMOptions
24-May-2024 07:50:11.986 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:G1PeriodicGCSystemLoadThreshold=0.3
24-May-2024 07:50:11.986 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:G1PeriodicGCInterval=900k
24-May-2024 07:50:11.986 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseStringDeduplication
24-May-2024 07:50:11.987 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseG1GC
24-May-2024 07:50:11.987 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmaxf0.3
24-May-2024 07:50:11.988 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xminf0.1
24-May-2024 07:50:11.988 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms32M
24-May-2024 07:50:11.989 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx614M
24-May-2024 07:50:11.989 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
24-May-2024 07:50:11.990 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
24-May-2024 07:50:11.990 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DReceiverIp=
24-May-2024 07:50:11.991 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DMagicPort=
24-May-2024 07:50:11.991 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseCompressedOops
24-May-2024 07:50:11.992 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djvm=tomcat
24-May-2024 07:50:11.992 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
24-May-2024 07:50:11.993 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.net.preferIPv4Stack=false
24-May-2024 07:50:11.994 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DjvmRid=
24-May-2024 07:50:11.994 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
24-May-2024 07:50:11.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
24-May-2024 07:50:11.999 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
24-May-2024 07:50:12.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
24-May-2024 07:50:12.014 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
24-May-2024 07:50:12.014 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
24-May-2024 07:50:12.015 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
24-May-2024 07:50:12.026 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent An older version [1.2.23] of the Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of [1.2.30]
24-May-2024 07:50:12.027 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [1.2.23] using APR version [1.4.8].
24-May-2024 07:50:12.027 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [false].
24-May-2024 07:50:12.032 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2k-fips 26 Jan 2017]
24-May-2024 07:50:13.058 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-80"]
24-May-2024 07:50:13.148 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
24-May-2024 07:50:13.149 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [1820] milliseconds
24-May-2024 07:50:13.270 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
24-May-2024 07:50:13.271 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/10.0.21]
24-May-2024 07:50:13.324 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/ROOT]
24-May-2024 07:50:14.078 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/ROOT] has finished in [745] ms
24-May-2024 07:50:14.082 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-80"]
24-May-2024 07:50:14.169 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
24-May-2024 07:50:14.175 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [1025] milliseconds
24-May-2024 08:30:26.011 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.
24-May-2024 08:30:26.013 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-80"]
24-May-2024 08:30:26.022 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
24-May-2024 08:30:26.025 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
24-May-2024 08:30:26.086 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-80"]
24-May-2024 08:30:26.101 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
24-May-2024 08:30:26.106 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-80"]
24-May-2024 08:30:26.107 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
24-May-2024 08:30:30.535 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin Match [Server/Service/Connector] failed to set property [compressableMimeType] to [text/html,text/xml,text/plain,text/css,application/xml,application/xhtml+xml,application/rss+xml,application/javascript,application/x-javascript,image/svg+xml]
24-May-2024 08:30:30.553 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin Match [Server/Service/Connector] failed to set property [compressableMimeType] to [text/html,text/xml,text/plain,text/css,application/xml,application/xhtml+xml,application/rss+xml,application/javascript,application/x-javascript,image/svg+xml]
24-May-2024 08:30:30.639 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/10.0.21
24-May-2024 08:30:30.640 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: May 10 2022 21:53:12 UTC
24-May-2024 08:30:30.640 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 10.0.21.0
24-May-2024 08:30:30.640 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
24-May-2024 08:30:30.641 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0
24-May-2024 08:30:30.642 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
24-May-2024 08:30:30.647 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/java/zulu-17.0.3
24-May-2024 08:30:30.647 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 17.0.3+7-LTS
24-May-2024 08:30:30.647 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Azul Systems, Inc.
24-May-2024 08:30:30.648 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /opt/tomcat
24-May-2024 08:30:30.648 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/tomcat
24-May-2024 08:30:30.650 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
24-May-2024 08:30:30.650 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
24-May-2024 08:30:30.651 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
24-May-2024 08:30:30.651 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
24-May-2024 08:30:30.652 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
24-May-2024 08:30:30.652 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UnlockExperimentalVMOptions
24-May-2024 08:30:30.653 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:G1PeriodicGCSystemLoadThreshold=0.3
24-May-2024 08:30:30.653 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:G1PeriodicGCInterval=900k
24-May-2024 08:30:30.653 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseStringDeduplication
24-May-2024 08:30:30.654 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseG1GC
24-May-2024 08:30:30.654 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmaxf0.3
24-May-2024 08:30:30.655 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xminf0.1
24-May-2024 08:30:30.655 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms32M
24-May-2024 08:30:30.655 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx614M
24-May-2024 08:30:30.656 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
24-May-2024 08:30:30.656 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
24-May-2024 08:30:30.656 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DReceiverIp=
24-May-2024 08:30:30.656 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DMagicPort=
24-May-2024 08:30:30.657 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseCompressedOops
24-May-2024 08:30:30.657 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djvm=tomcat
24-May-2024 08:30:30.658 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
24-May-2024 08:30:30.658 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.net.preferIPv4Stack=false
24-May-2024 08:30:30.658 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DjvmRid=
24-May-2024 08:30:30.658 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
24-May-2024 08:30:30.659 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
24-May-2024 08:30:30.660 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
24-May-2024 08:30:30.660 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
24-May-2024 08:30:30.660 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
24-May-2024 08:30:30.661 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
24-May-2024 08:30:30.661 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
24-May-2024 08:30:30.672 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent An older version [1.2.23] of the Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of [1.2.30]
24-May-2024 08:30:30.672 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [1.2.23] using APR version [1.4.8].
24-May-2024 08:30:30.672 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [false].
24-May-2024 08:30:30.676 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2k-fips 26 Jan 2017]
24-May-2024 08:30:31.773 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-80"]
24-May-2024 08:30:31.878 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
24-May-2024 08:30:31.880 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [1795] milliseconds
24-May-2024 08:30:32.044 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
24-May-2024 08:30:32.045 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/10.0.21]
24-May-2024 08:30:32.099 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/tomcat/webapps/ROOT.war]
24-May-2024 08:30:36.894 WARNING [main] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [6.0]. Default version will be used.
24-May-2024 08:30:36.906 WARNING [main] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [6.0]. Default version will be used.
24-May-2024 08:30:59.861 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
24-May-2024 08:31:00.404 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal Error during ServletContainerInitializer processing
jakarta.servlet.ServletException: Failed to instantiate WebApplicationInitializer class
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:157)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5168)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1027)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2001)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:828)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:478)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1708)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:320)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:886)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: java.lang.NoSuchMethodException: com.sheel.managehse.ManageHSEApplication.<init>()
at java.base/java.lang.Class.getConstructor0(Class.java:3585)
at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2754)
at org.springframework.util.ReflectionUtils.accessibleConstructor(ReflectionUtils.java:185)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:154)
... 40 more
24-May-2024 08:31:00.426 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
24-May-2024 08:31:00.594 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/webapps/ROOT.war] has finished in [28,480] ms
24-May-2024 08:31:00.621 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-80"]
24-May-2024 08:31:00.743 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
24-May-2024 08:31:00.870 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [28990] milliseconds
Thanks in advance.
Hello, from that log I can see few things:
Caused by: java.lang.NoSuchMethodException: com.sheel.managehse.ManageHSEApplication.<init>()
You are working on an application to manage health, safety and environment, and in that context “sheel” is a very good choice.
24-May-2024 08:31:00.594 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/webapps/ROOT.war] has finished in [28,480] ms
Your WAR is called ROOT.war.
I would like to know which version of Jmix are you using, I will presume Jmix 2.2.
Did you check
https://docs.jmix.io/jmix/deployment/basic.html
and extended SpringBootServletInitializer as described?
I also think you need to give proper name to the war.
Kind regards,
Mladen
Yes it is extended and i am using 2.2.3
public class ManageHSEApplication extends SpringBootServletInitializer implements AppShellConfigurator
but no proper name is given,
Can you make an experiment?
Deploy as bootJar and start with java -jar
just to see if its something related to war deployment or something more general?
was deployment is working in my other projects
I tried to deploy your sample project and it is working. (but not mine)???
I am using one more additional datastore, do this can cause problem?
Any other add-on can cause problem? (i am using notification, quartz etc.
The app is running at localhost.
Please advice
@krivopustov
The problem is caused by notification addon. When i install notification addon, the app runs perfectly.
but when i copy following code in applicationmain, it start giving this problem.
@PostConstruct
public void postConstruct() {
notificationTypesRepository.registerTypes(
new NotificationType(“info”, “INFO_CIRCLE”),
new NotificationType(“warn”, “WARNING”)
);
}
Please advice.
@lalajaipur68
Try to move the notification types registration to the ApplicationStartedEvent listener:
@EventListener
public void onApplicationStarted(final ApplicationStartedEvent event) {
notificationTypesRepository.registerTypes(
new NotificationType("info", "INFO_CIRCLE"),
new NotificationType("warn", "WARNING")
);
}
The problem persist after this change also. Remove above code and application functions perfectly (even with this code app is working on localhost but not on server)