Running Tomcat as a service

Post any questions regarding Installing or Upgrading Ebase, including problems starting up the Ebase Xi Server or Designer

Moderators: Jon, Steve, Ian, Dave

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Running Tomcat as a service

#1

Postby Segi » Thu Oct 02, 2014 7:33 pm

I installed the Apache Tomcat 7 service by running the batch file service.bat install. I am using the embedded derby database.

I started the service and tried loading an Ebase form and received this error:

"Unexpected exception setting up form languages - No language was found. Should have at least found the default".

I can still run Tomcat as an application.

How can I fix this ?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Fri Oct 03, 2014 6:47 am

I think the error means that the system can't connect to the derby database - there will be more details in the log files in tomcat/logs. Which implies that something is not correct with the configuration. This document describes how to set up Ebase/Tomcat as a Windows service http://forum.ebasetech.com/forum/viewtopic.php?t=292.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#3

Postby Segi » Fri Oct 03, 2014 3:36 pm

It is still not working.

From ufsserver.log

Fri Oct 03 09:47:45: UFS Designer server component initialised successfully
Fri Oct 03 09:47:45: Workflow servlet component initialised successfully
Fri Oct 03 09:47:46: Error starting system service ebaseAssignmentService - com.ebasetech.ufs.utility.PersistenceException: Error getting connection from datasource UFSREPOSITORY, SQLException in StandardPoolDataSource:getConnection exception: java.sql.SQLException: SQLException in StandardPoolDataSource:getConnection no connection available java.sql.SQLException: Cannot get connection for URL jdbc:derby:UFS;create=false : Database 'UFS' not found.
Fri Oct 03 09:47:46: Error starting system service ebaseLogonService - com.ebasetech.ufs.utility.PersistenceException: Error getting connection from datasource UFSREPOSITORY, SQLException in StandardPoolDataSource:getConnection exception: java.sql.SQLException: SQLException in StandardPoolDataSource:getConnection no connection available java.sql.SQLException: Cannot get connection for URL jdbc:derby:UFS;create=false : Database 'UFS' not found.
Fri Oct 03 09:47:46: FormCacheLoader: start
Fri Oct 03 09:47:46: FormCacheLoader: end
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Mon Oct 06, 2014 6:49 am

This is the same problem, the system can't access the derby database - probably the embedded derby service is not configured. Can you check that you have the -D parameters for the derby configuration set correctly - see the Tomcat as a service document link earlier in this post.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#5

Postby Segi » Mon Oct 06, 2014 3:28 pm

This is my service.bat. I have bolded the section that I added:


@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem NT Service Install/Uninstall script
rem
rem Options
rem install Install the service using Tomcat7 as service name.
rem Service is installed using default settings.
rem remove Remove the service from the System.
rem
rem name (optional) If the second argument is present it is considered
rem to be new service name
rem
rem $Id: service.bat 1000718 2010-09-24 06:00:00Z mturk $
rem ---------------------------------------------------------------------------
set JRE_HOME=C:\ebaseXi\jre

set "SELF=%~dp0%service.bat"
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%cd%"
if exist "%CATALINA_HOME%\bin\tomcat7.exe" goto okHome
rem CD to the upper dir
cd ..
set "CATALINA_HOME=%cd%"
:gotHome
if exist "%CATALINA_HOME%\bin\tomcat7.exe" goto okHome
echo The tomcat.exe was not found...
echo The CATALINA_HOME environment variable is not defined correctly.
echo This environment variable is needed to run this program
goto end
:okHome
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJdkHome
if not "%JRE_HOME%" == "" goto gotJreHome
echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
echo Service will try to guess them from the registry.
goto okJavaHome
:gotJreHome
if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome
goto okJavaHome
:gotJdkHome
if not exist "%JAVA_HOME%\jre\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\jre\bin\javaw.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
if not "%JRE_HOME%" == "" goto okJavaHome
set "JRE_HOME=%JAVA_HOME%\jre"
goto okJavaHome
:noJavaHome
echo The JAVA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
echo NB: JAVA_HOME should point to a JDK not a JRE
goto end
:okJavaHome
if not "%CATALINA_BASE%" == "" goto gotBase
set "CATALINA_BASE=%CATALINA_HOME%"
:gotBase

set "EXECUTABLE=%CATALINA_HOME%\bin\tomcat7.exe"

rem Set default Service name
set SERVICE_NAME=Tomcat7
set PR_DISPLAYNAME=Apache Tomcat 7

if "x%1x" == "xx" goto displayUsage
set SERVICE_CMD=%1
shift
if "x%1x" == "xx" goto checkServiceCmd
:checkUser
if "x%1x" == "x/userx" goto runAsUser
if "x%1x" == "x--userx" goto runAsUser
set SERVICE_NAME=%1
set PR_DISPLAYNAME=Apache Tomcat %1
shift
if "x%1x" == "xx" goto checkServiceCmd
goto checkUser
:runAsUser
shift
if "x%1x" == "xx" goto displayUsage
set SERVICE_USER=%1
shift
runas /env /savecred /user:%SERVICE_USER% "%COMSPEC% /K \"%SELF%\" %SERVICE_CMD% %SERVICE_NAME%"
goto end
:checkServiceCmd
if /i %SERVICE_CMD% == install goto doInstall
if /i %SERVICE_CMD% == remove goto doRemove
if /i %SERVICE_CMD% == uninstall goto doRemove
echo Unknown parameter "%1"
:displayUsage
echo.
echo Usage: service.bat install/remove [service_name] [/user username]
goto end

:doRemove
rem Remove the service
"%EXECUTABLE%" //DS//%SERVICE_NAME%
if not errorlevel 1 goto removed
echo Failed removing '%SERVICE_NAME%' service
goto end
:removed
echo The service '%SERVICE_NAME%' has been removed
goto end

:doInstall
rem Install the service
echo Installing the service '%SERVICE_NAME%' ...
echo Using CATALINA_HOME: "%CATALINA_HOME%"
echo Using CATALINA_BASE: "%CATALINA_BASE%"
echo Using JAVA_HOME: "%JAVA_HOME%"
echo Using JRE_HOME: "%JRE_HOME%"

rem Use the environment variables as an example
rem Each command line option is prefixed with PR_

set PR_DESCRIPTION=Apache Tomcat 7.0.27 Server - http://tomcat.apache.org/
set "PR_INSTALL=%EXECUTABLE%"
set "PR_LOGPATH=%CATALINA_BASE%\logs"
set "PR_CLASSPATH=%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_BASE%\bin\tomcat-juli.jar;%CATALINA_HOME%\bin\tomcat-juli.jar"
rem Set the server jvm from JAVA_HOME
set "PR_JVM=%JRE_HOME%\bin\server\jvm.dll"
if exist "%PR_JVM%" goto foundJvm
rem Set the client jvm from JAVA_HOME
set "PR_JVM=%JRE_HOME%\bin\client\jvm.dll"
if exist "%PR_JVM%" goto foundJvm
set PR_JVM=auto
:foundJvm
echo Using JVM: "%PR_JVM%"
"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass org.apache.catalina.startup.Bootstrap --StopClass org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop
if not errorlevel 1 goto installed
echo Failed installing '%SERVICE_NAME%' service
goto end
:installed
rem Clear the environment variables. They are not needed any more.
set PR_DISPLAYNAME=
set PR_DESCRIPTION=
set PR_INSTALL=
set PR_LOGPATH=
set PR_CLASSPATH=
set PR_JVM=
rem Set extra parameters

"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Dderby.system.home=c:\ebasexi\UfsServer\DB;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" --StartMode jvm --StopMode jvm
rem More extra parameters
set "PR_LOGPATH=%CATALINA_BASE%\logs"
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties" --JvmMs 128 --JvmMx 256
echo The service '%SERVICE_NAME%' has been installed.

:end
cd "%CURRENT_DIR%"
0 x

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

#6

Postby Hovik » Wed Oct 08, 2014 9:28 am

Hi Segi,

Your settings in service.bat are fine as far as I can see.

I assume your Ebase is installed in folder ebasexi on the c: drive?

Does the Ebase server start when using the .bat file?

Can I have your ufs.xml please - email it to support@ebasetech.com

Thanks,
Hovik
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#7

Postby Segi » Wed Oct 08, 2014 2:03 pm

Wai,

It is installed in c:\ebasexi

I email you my ufs.xml.

I start eBase using the batch file start_ebase_server.bat located in c:\ebasexi\ufsserver

This is the contents of the batch file:

REM Run this command to start the EBASE environment

REM To run : open a DOS command window, cd to this directory, then issue the command start_ebase_server

REM Start the tomcat application server


set JRE_HOME=%~dsp0..\jre

set CATALINA_HOME=%~dsp0\tomcat

set BASEDIR=%~dsp0\tomcat

set JAVA_OPTS=-Xms1024m -Xmx4096m -XX:MaxPermSize=1024m -Djava.net.preferIPv4Stack=true -Dderby.system.home=%~dsp0/DB -Dhttp.nonProxyHosts="localhost|127.0.0.1"

cd tomcat\bin

startup

cd ..\..
0 x

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

#8

Postby Hovik » Mon Oct 13, 2014 6:53 am

Hi Segi,

I know that the Windows service doesn't start. But does the Ebase server start when using start_ebase_server.bat?

Hovik
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#9

Postby Segi » Mon Oct 13, 2014 2:04 pm

Hovik,

Yes it does. That is how I currently start the eBase server as an application.
0 x

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

#10

Postby Hovik » Tue Oct 14, 2014 7:18 am

Hi Segi,

I can not see anything wrong in your ufs.xml of service.bat.

I am emailing you another version of service.bat (named Segi_service.bat) which I use to start my Tomcat as a windows service using Apache Derby in embedded mode.
I have applied your folder names where appropriate.

Please remove your service first, then put this service.bat in Tomcat\bin and install the service.

Please let me know if this works.

Hovik
0 x


Who is online

Users browsing this forum: No registered users and 11 guests