[JAVA] When I tried to run my own service, it failed, so I screwed it into the task scheduler

It was troublesome to start Oracle HTTP Server 12c manually every time the server was restarted, so I started thinking about whether it could be executed automatically.

Reason for screwing

-You are using the server on which "Oracle HTTP Server 12c" is installed. -It's annoying to start HTTPD every time the server restarts ... → Let's start HTTP automatically when the server starts! -I was able to create a service and set it to autorun ...! → Service status "". ・ Is it possible to use the task scheduler?

Created service

-A service that starts NodeManager, which is required when starting Oracle HTTP Server 12c. -Service that starts the Oracle HTTP Server 12c main unit

Overall flow

  1. Service creation and automatic configuration Originally, in order to start HTTP, follow the procedure of starting NodeManager → starting HttpServer. Create a service that runs these.

  2. Since 1. failed, set the task scheduler to execute the service when the server starts.

Creating a service

It's okay to make it, but it failed to execute, so roughly. Basically "Create java class file-> Create exe file-> Service registration" It will be the flow.

File creation

(The java class file and exe file creation are omitted.) To register the service, you need the xml file in the same location as the exe file. The details of xml are as follows.

<service>
  <id>OracleHttpStartBat</id>
  <name>OracleHttpStartBat</name>
  <description>This service start OHS.</description>
  <executable>java</executable>
  <arguments>-jar "OracleHttpStartBat.jar"</arguments>
  <logmode>rotate</logmode>
</service> 

From the top, the service ID, service name, summary, execution language, arguments, and log format.

After creating the xml, open a command prompt on the same path and execute the following.

(OracleHttpStartBat.exe) install


 It's easy, but you're done registering for the service.
 If you set it to autostart, the service will run automatically.
 maybe.

 Reference URL
https://qiita.com/moni-hide/items/fd26fb223f2d4736cf55

## Schedule assistant settings
 The above service didn't work, so I ran it here.
 This is pretty easy to operate.
 Start the Schedule Assistant in the server.
 Specify the following and it is almost complete. (Details can be edited in the properties.)
 1. Task name
 2. Trigger (setting of execution timing, interval, start date and time)
 This time, specify when the user logs on.
 ![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/605483/e6a24727-41bd-41d2-be6e-50dadf7c654c.png)

 3. Operation (setting of program to be executed)
 This time, execute the target batch file.
 ![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/605483/cbd871e7-d8d5-109b-85c9-fed231e094bc.png)

 When you run the program, make a batch file.
 With this method, HTTP could be started normally ...





Recommended Posts

When I tried to run my own service, it failed, so I screwed it into the task scheduler
I tried to set tomcat to run the Servlet.
When I tried to run Azure Kinect DK with Docker, it was blocked by EULA
I tried to summarize object orientation in my own way.
Memorandum: When I tried TensorFlow with Tribuo, it didn't work, so I went on a journey to find the head family and lost.
I tried to explain the method
I don't really understand the difference between swift Error and NSError, so I tried to summarize it myself.
What I thought when passing the user input value to the Service class
I created and set my own Dialect with Thymeleaf and tried using it
When updating my own application, I seriously thought about the package structure
I tried to make my own transfer guide using OpenTripPlanner and GTFS
Since the docker-desktop preview for m1 came out, I tried to face it with my macbook pro 15inch
A super beginner has completed the Spring introductory book, so I will summarize it in my own way
I tried to summarize the methods used
I tried to implement the Iterator pattern
I tried to summarize the Stream API
What I tried when I wanted to get all the fields of a bean
When I try to run docker-compose, I get the error "Cannot locate specified Dockerfile: Dockerfile"
[JavaScript] The strongest case when I tried to summarize the parts I do not understand
When I run the source command in the Ubuntu Makefile, it says "source: command not found"
When I tried to use a Wacom tablet with ubuntu 20.04, I didn't recognize it.
[Swift] I already have a lot of information, but I tried to summarize the cast (as, as !, as?) In my own way.
When I tried to reproduce Progate's Rails app on my PC (local environment), I got stuck at the image display