You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 30 Next »

JobScheduler currently comes with a proprietary built-in web server. However, it is possible to configure JobScheduler to work with Jetty by using the JobScheduler plugin feature. This document describes what you have to do to run JobScheduler with an underlying Jetty web server.

Installation

Since release 1.3.12.2163 the JobScheduler installer contains a plugin for Jetty. Note that this plugin is still under development and is provided "as is".

The installer tries to generate some symlinks to simulate virtual directories for JOC (JobScheduler Operations Center). The symlink generation is not supported for Windows older than Vista.

The installer configures the ./config/factory.ini, the ./config/jetty.xml and the ./config/web.xml files as described below.
<span stylh1. "color:red">The installer does not configure the ./config/scheduler.xml file. If you want to use Jetty then you must configure ./config/scheduler.xml itself as described below.</span>

The installer contains a keystore file for testing https. This keystore is not trusted and has a wrong hostname inside, but can still be used for testing.

Please make your own keystore file jetty.jks.

After the installation you can open JOC with Jetty via

  • http://localhost:44440
  • https://localhost:8443

You can change these ports in the ./config/jetty.xml.

<span id"classpath">

Configure factory.ini (Put the necessary libraries in the classpath)

To run JobScheduler with Jetty instead the built-in web-server you have to use the Jetty plugin. It is a part of the library com.sos.scheduler.engine.plugins.jetty-xxx.jar. Beside the com.sos.scheduler.engine.plugins.jetty-xxx.jar it is necessary to put the dependent libraries for the Jetty plugin into the classpath of the JobScheduler. The installer puts them into the ./lib/jetty_ext folder and adds them to the classpath in the ./config/factory.ini.
Unix

 ...
 [java]
 class_path = $\{SCHEDULER_HOME\}/lib/*.jar:$\{SCHEDULER_HOME\}/lib/hibernate/*.jar:<span style="color:red">$\{SCHEDULER_HOME\}/lib/jetty_ext/*.jar</span>
 ...

Windows

 ...
 [java]
 class_path = $\{SCHEDULER_HOME\}/lib/*.jar;$\{SCHEDULER_HOME\}/lib/hibernate/*.jar;<span style="color:red">$\{SCHEDULER_HOME\}/lib/jetty_ext/*.jar</span>
 ...

</span>

<span ih1. "scheduler">

Configure scheduler.xml

To use the Jetty plugin you have to configure it in the scheduler.xml:

 <spooler>
  <config ...>
    ...
    <security ignore_unknown_hosts="yes">
      <allowed_host host="localhost" level="all"/>
      <allowed_host host="192.11.0" level="all"/>
    </security>
    
    <span style="color:red"><plugins>
      ...
      <plugin java_class="com.sos.scheduler.engine.plugins.jetty.JettyPlugin">
        <plugin.config />
      </plugin>
      ...
    </plugins></span>
    ...
  </config>
 </spooler>

Please note that it is necessary to specify an empty plugin.config element.

Simple user authentication

It is possible to configure a simple user authentication in the plugin configuration, e.g.

 <plugins>
   <plugin java_class="com.sos.scheduler.engine.plugins.jetty.JettyPlugin">
     <plugin.config>
       <loginService>
         <logins>
           <login name="testName" password="testPassword" roles="administrator"/>
         </logins>
       </loginService>
     </plugin.config>
   </plugin>
 </plugins>

</span>

<span id"jetty">

Configure jetty.xml

To run JobScheduler with Jetty it is also necessary to create two configuration files for the Jetty web server (./config/jetty.xml and ./config/web.xml). The minimal declaration defines a connector for the port to communicate with JobScheduler via http:

 <Configure class="org.eclipse.jetty.server.Server">
   <Call name="addConnector">
     <Arg>
       <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
         <Set name="port">44440</Set>
       </New>
     </Arg>
   </Call>
 </Configure>

It is important to know that this port (here 44440) is a substitute for the port attribute in the config element of scheduler.xml.

At the moment both ports are required.

With a second connector it is possible to define a communication channel via https (ssl):

 <Call name="addConnector">
  <Arg>
    <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
      <Arg>
        <New class="org.eclipse.jetty.util.ssl.SslContextFactory">
          <Set name="keyStore"><SystemProperty name="jetty.home" default="." />/ssl/jetty.jks</Set>
          <Set name="keyStorePassword">jobscheduler</Set>
          <Set name="keyManagerPassword">jobscheduler</Set>
          <Set name="trustStore"><SystemProperty name="jetty.home" default="." />/ssl/jetty.jks</Set>
          <Set name="trustStorePassword">jobscheduler</Set>
        </New>
      </Arg>
      <Set name="port">8443</Set>
      <Set name="maxIdleTime">30000</Set>
    </New>
  </Arg>
 </Call>

The SSL connection expects the jetty keystore file jetty.jks in the subfolder ssl (under the JobScheduler data folder). With the configuration above you can connect JobScheduler via https at port 8443.
</span>

<span ih1. "keystore">

keystore

To generate a keystore file use keytool:

 keytool -genkey -alias jetty -keyalg RSA -keysize 1024 -dname "CN=[hostname], OU=JobScheduler, O=SOS GmbH, L=Berlin C=DE" -keystore my_jetty.jks -storepass jobscheduler -keypass jobscheduler -validity 1826

whereas hostname should be the JobScheduler host.
Use also your own values for OU, h1. _ and _L.
</span>

<span id="web">

Configure web.xml

To run JobScheduler with jetty it is also necessary to create two configuration files for the Jetty web server (jetty.xml and web.xml). It has to place in the root of your live folder (not in the config folder).

You must configure the JOC servlet with the JobScheduler installation path. Note that you must use the file protocol.

For Example:

  • file:///c:/Program Files (x86)/sos-berlin.com/jobscheduler/[scheduler_id] on Windows
  • file:///c:/Program Files (x86)/sos-berlin.com/jobscheduler/[scheduler_id] on Linux
 <?xml version="1.0" encoding="UTF-8"?>
 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
          xmlns="http://java.sun.com/xml/ns/j2ee" 
          version="2.4">
    <display-name>JobScheduler test configuration (web.xml)</display-name>
    <servlet>
        <servlet-name>Default</servlet-name>
        <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
        <init-param>
            <param-name>dirAllowed</param-name>
            <param-value>false</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>Default</servlet-name>
        
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>JOC</servlet-name>
        <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
        <init-param>
            <param-name>resourceBase</param-name>
            <param-value>file:///c:/Program Files (x86)/sos-berlin.com/jobscheduler/scheduler</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>JOC</servlet-name>
        <url-pattern>/operations_gui/*</url-pattern>
    </servlet-mapping>
 </web-app>

</span>

Send commands via HTTP (POST|GET)

If you use jetty and you want to send a command (e.g. <show_state/>) to the JobScheduler then you must use the URL:

  <nowiki>http://localhost:44440/jobscheduler/engine-cpp/</nowiki>

or resp.

  <nowiki>https://localhost:8443/jobscheduler/engine-cpp/</nowiki>

Example for HTTP GET

  <nowiki>http://localhost:44440/jobscheduler/engine-cpp/</nowiki>&lt;show_state/&gt;
  • No labels