tagbangers / wallride

multilingual easy-to-customize open source CMS made by Java
http://wallride.org/
Apache License 2.0
95 stars 80 forks source link

Deploy in tomcat #69

Closed bevrard closed 7 years ago

bevrard commented 7 years ago

I'm trying to deploy a war in Tomcat, but there is no ressources (html,css, js, etc) in the war.

I've developped using spring boot, but at the end I'm building the application. I was thinking to use the war build in the target repository of wallride-bootstrap.

Do you know what I'm missing to have the ressources in the war? or I should declare something like this in the pom of wallride-bootstrap?

<properties>        
    <start-class>mypackage.App</start-class>
</properties>

Thanks

bevrard commented 7 years ago

The war application (gamedella.war) is placed in :

/opt/tomcat8/webapps

The configuration file is :

/opt/tomcat8/conf/Catalina/localhost/gamedella.xml

In this file:

<Context docBase="gamedella">
  <Parameter name="wallride.home" value="/usr/share/tomcat8/gamedella"
         override="false"/>
  <Environment name="wallride.home" value="/usr/share/tomcat8/gamedella/" type="java.lang.String" override="false"/>
</Context>

But when I try to start the service, I have this error:

06-Nov-2016 11:45:26.529 GRAVE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerB
ase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].Stan
dardContext[/gamedella]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1798)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: wallride.home is empty
    at org.wallride.autoconfigure.WallRideInitializer.createEnvironment(WallRideInitializer.java:46)
    at org.wallride.autoconfigure.WallRideInitializer.onApplicationEvent(WallRideInitializer.java:37)
    at org.wallride.autoconfigure.WallRideInitializer.onApplicationEvent(WallRideInitializer.java:33)

Do you know what I'm missing?

bourbonizable commented 7 years ago

Hi @bevrard,

In the latest WallRide version the startup logic has been changed. Due to this, setting wallride.home by init-parameter in Tomcat is not supported now. For the deployment war archive to Tomcat, please set System property by setenv.[sh|bat] file.

For example: Linux

<Tomcat installation directory>/bin/setenv.sh
export JAVA_OPTS="-Dwallride.home=file:/path/to/home/"

Windows

<Tomcat installation directory>/bin/setenv.bat
set JAVA_OPTS=-Dwallride.home=file:/path/to/home/

In case you set the file system path to wallride.home, don't forget to set prefix "file:" We're sorry we haven't update the document right away! Hope that helps.

bevrard commented 7 years ago

After trying multiple "solutions", I'm using yours ;-). I'm defining the path in the WallrideInitializer with different values following the environment and I use the JAVA_OPTS to define the environment (DEV,UAT, PROD).
It's not the best solution, I can deploy multiple websites in the same Tomcat.

Thanks!