[Resolved] Tomcat Bundle as Windows Service

cmarguello's picture
Post submitted by cmarguello Sat, 04/16/2011 - 17:04

Hi,

I have the tomcat bundle for BOS 5.4.2-SP.

I want to install this one as windows service for production environment.



I note that service.bat and tomcat6.exe there arent in bin folder. Why is this?

How can i do what i need? Including the jvm config arguments.



Thanks.

Comments

Submitted by haojie.yuan Mon, 04/18/2011 - 04:02

Here is the way to setup Tomcat 6.0.29, BOS 5.4M2



Config files



Create bonita folder in tomcat/conf

Put jaas-standard, logging.properties, hibernate-core.properties, hibernate-history.properties, bonita-environment.xml in it

[edit]Configure launcher



Create setenv.bat in tomcat/bin with following contents:

rem Sets some variables

set BONITA_OPTS="-Dorg.ow2.bonita.environment=%CATALINA_HOME%\conf\bonita\bonita-environment.xml"

set LOG_OPTS="-Djava.util.logging.config.file=%CATALINA_HOME%\conf\bonita\logging.properties"

set SECURITY_OPTS="-Djava.security.auth.login.config=%CATALINA_HOME%\conf\bonita\jaas-standard.cfg"

set MEMORY_OPTS="-Xshare:auto -Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError"

set LIC_OPTS="-Dbonita_client_home=%CATALINA_HOME%\conf\bonita"

set JAVA_OPTS=%JAVA_OPTS% %LOG_OPTS% %SECURITY_OPTS% %BONITA_OPTS% %MEMORY_OPTS% %LIC_OPTS%

Create setenv.sh in tomcat/bin with following contents:

Sets some variables

BONITA_OPTS="-Dorg.ow2.bonita.environment=$CATALINA_HOME/conf/bonita/bonita-environment.xml"

LOG_OPTS="-Djava.util.logging.config.file=$CATALINA_HOME/conf/bonita/logging.properties"

SECURITY_OPTS="-Djava.security.auth.login.config=$CATALINA_HOME/conf/bonita/jaas-standard.cfg"

MEMORY_OPTS="-Xshare:auto -Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError"

LIC_OPTS="-Dbonita_client_home=$CATALINA_HOME\conf\bonita"

JAVA_OPTS="$JAVA_OPTS $LOG_OPTS $SECURITY_OPTS $BONITA_OPTS $MEMORY_OPTS $LIC_OPTS"

export JAVA_OPTS

[edit]Configure Datasource



In hibernate-core.properties and hibernate-history.properties:

comment hibernate.connection.driver_class, hibernate.connection.url, hibernate.connection.username, hibernate.connection.password

add hibernate.connection.datasource=java:/comp/env/bonita-core or hibernate.connection.datasource=java:/comp/env/bonita-history dependeinf in which file you are

Modify tomcat/conf/context.xml, add in it:

for h2

<Resource

name="bonita-core"

auth="Container"

type="com.mchange.v2.c3p0.ComboPooledDataSource"

factory="org.apache.naming.factory.BeanFactory"

description="DB Connection"

driverClass="org.h2.Driver"

jdbcUrl="jdbc:h2:file:${java.io.tmpdir}/bonita-db/bonita_core.db;FILE_LOCK=NO;MVCC=TRUE;DB_CLOSE_ON_EXIT=TRUE"

user="sa"

password=""

initialPoolSize="1"

maxPoolSize="15"

minPoolSize="3"

maxConnectionAge="0"

maxIdleTime="1800"

maxIdleTimeExcessConnections="120"

idleConnectionTestPeriod="30"

testConnectionOnCheckout="true"

acquireIncrement="3"/>

<ResourceLink

global="bonita-core"

name="bonita-core"

type="javax.sql.DataSource" />



<Resource

name="bonita-history"

auth="Container"

type="com.mchange.v2.c3p0.ComboPooledDataSource"

factory="org.apache.naming.factory.BeanFactory"

description="DB Connection"

driverClass="org.h2.Driver"

jdbcUrl="jdbc:h2:file:${java.io.tmpdir}/bonita-db/bonita_history.db;FILE_LOCK=NO;MVCC=TRUE;DB_CLOSE_ON_EXIT=TRUE"

user="sa"

password=""

initialPoolSize="1"

maxPoolSize="15"

minPoolSize="3"

maxConnectionAge="0"

maxIdleTime="1800"

maxIdleTimeExcessConnections="120"

idleConnectionTestPeriod="30"

testConnectionOnCheckout="true"

acquireIncrement="3"/>

<ResourceLink

global="bonita-history"

name="bonita-history"

type="javax.sql.DataSource" />

for Oracle:


auth="Container"

type="javax.sql.DataSource"

maxActive="100"

minIdle="10"

maxWait="10000"

initialSize="2"

removeAbandonedTimeout="60"

removeAbandoned="true"

logAbandoned="true"

username="XXX"

password="XXX"

driverClassName="oracle.jdbc.OracleDriver"

url="jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=ON)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=pollux-vip.dc1.enzimm)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=castor-vip.dc1.enzimm)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=oracdb1.dc1.enzimm)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=180)(DELAY=5))))"/>




auth="Container"

type="javax.sql.DataSource"

maxActive="100"

minIdle="10"

maxWait="10000"

initialSize="2"

removeAbandonedTimeout="60"

removeAbandoned="true"

logAbandoned="true"

username="XXX"

password="XXX"

driverClassName="oracle.jdbc.OracleDriver"

url="jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=ON)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=pollux-vip.dc1.enzimm)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=castor-vip.dc1.enzimm)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=oracdb1.dc1.enzimm)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=180)(DELAY=5))))"/>

[edit]Use c3p0



You need to use c3p0 with MySQL. copy some libs to tomcat/lib:

c3p0 (0.9.1.2)

hibernate-c3p0 (3.3.2.GA)

some properties need to be set [...]To complete, Matthieu?

[edit]SP Specific



Remove jdtcore*.jar of the console war lib

Submitted by anthony.birembaut Mon, 04/18/2011 - 15:21

Hi,

indeed we do not provide the .exe and the service.bat for windows as the distribution we provide is platform independent.

If you need them, I guess you can download the tomcat distribution for windows in the same version as the one we use (6.0.29) and paste them in the bin directory.

Submitted by cmarguello Fri, 04/29/2011 - 20:40

Thanks anthony.

I could.

But i have another problem.

I configure to run over ssl.

[quote]
maxThreads="150" scheme="https" secure="true"

clientAuth="false" sslProtocol="TLS"

keystoreFile="${user.home}/.keystore" keystorePass="pass"/>

[/quote]

When i start tomcat with start.bat

I can access to the app throw

https:\localhost:8443\bonita

and

http:\localhost:8080\bonita



But whe i start the tomcat service

I can access throw

http:\localhost:8080\bonita

but i cant over https

https:\localhost:8443\bonita



is there something else that should be set?



thanks

Submitted by cmarguello Thu, 05/05/2011 - 03:56

The problem was in the keystoreFile.

[quote]

keystoreFile="${user.home}/.keystore"

[/quote]

when i run tomcat as windows service, it dont understand ${user.home}, so, i change it with absolute path to the keystore file, and it works.

Submitted by DavidB Wed, 06/08/2011 - 07:59

Hi everybody,



I'm trying to have tomcat as a windows service. I've copied the .exe and the service.bat in

a tomcat folder.



Then I install the service with cmd service.bat install.



Now when I try to connect to Bonita i recive this error: .... Unable to locate a login configuration



Can somebody tell me exactly what I have to do?



I'm working with bonita bundel 5.5



Thanks

David

Submitted by doaa.farouk Thu, 02/09/2012 - 10:57

Hi all,



One more solution to install bonita in windows service tomcat:

Copy all the environment settings in /bin/setenv.bat, starting with "-D....".

Then open the Apache tomcat properties (in Windows appearing as an icon in the right of the taskbar),

go to the 'Java' tab then paste the env setting above inside the 'Java Options:' text-area.



Restart the tomcat, the bonta app should be running with the default authentication (admin/bpm).



Thanks,