Can my java program run on Apache Tomcat?

Posted on 2005-04-27
Last Modified: 2013-11-24
I have developed a java program used as a job scheduler on the CLient-Server. We have recently been asked whether the scheduler running on the web server, Apache Tomcat, instead of Client-Server (Window 2003).
I can't answer them as I have very limited knowledge about Web stuff.

Please give me some idea if we can run the java program on web server. Thanks
Question by:LeanMoreTryMore
    LVL 92

    Expert Comment

    Yes you could do that, you could use a servlet to handle starting/stopping it plus any other interaction required.
    LVL 15

    Expert Comment

    I guess that the need is to be able to interact and configure jobs via a web client, right?

    You can setup your scheduler service inside tomcat so that the servlets will be able to accees it.
    That can be done in many ways like:
    1. create and store it in a static variable
    2. create and store it in your servlet application context
    3. use JMX and save it as an MBean

    Also, not sure how what kind of a Client-server architecure you have but if your server is
    a remote service then you might be able to expose its interfaces to the servlets via JNDI or similar technique
    and that may prevent any changes to your server side.

    Author Comment

    Actually our cleint's administrator did mention about JMX, but I dont know what to do for this.
    LVL 92

    Expert Comment

    you can read up on jmx here:
    LVL 15

    Accepted Solution

    JMX is a powerfull and in fact the most popular way currently to manage/monitor/configure java services.
    It is part of JDK 5.0 (or can be used as a seperate package for earlier JVM  versions)
    It is part of J2EE as way to manage/configure/monitor your application server (JSR 177)
    It provides connectors that can expose your instrumentation layer (your managed services) via RMI/HTTP/SNMP and others.
    It provides framework services that can be used by other MBeans (e.g. MLets, Timer, ...)
    Tomcat itself can be configured via JMX.
    For more see the link above.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    Video by: Michael
    Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now