如何使用winrun4j在Windows 2012服务器上启动独立的oc4j应用程序服务?

时间:2016-01-21 21:53:46

标签: java oc4j windows2012 winrun4j

我们在Windows 2012 R2服务器上运行Oracle独立OC4J J2EE Web应用程序服务器。启动oc4j服务器的命令行如下:

`java -jar %J2EE_HOME%\oc4j.jar`

J2EE_HOME系统范围的环境变量已正确设置,我们可以从命令行启动Web服务器。

System Environment Variables:
`JAVA_HOME=C:\Progra~1\Java\jdk1.7.0_65\jre\bin`
`J2EE_HOME=E:\OC4J\j2ee\home`

现在我们需要将OC4J服务器作为Windows服务运行。为此,我们下载了WinRun4J开源应用程序。在winrun4j指示之后,我执行了以下操作:

1) Created a new folder:  E:\Custom_Apps
2) Copied the WinRun4J64 executable to the new folder
3) Renamed the WinRun4J64 executable to OC4J_WebServer
4) Copied the WinRun4J icon to the new folder and renamed it OC4J_WebServer
5) Created an initialization file in the E:\Custom_Apps folder named OC4J_WebServer.

初始化文件包含以下行:

>working.directory=E:\Custom_Apps\working\
>vm.location=C:\Program Files\Java\jdk1.7.0_65\jre\bin\server\jvm.dll
>service.class=%J2EE_HOME%\oc4j.jar
>service.id=OC4JWebServer
>service.name=WinRun4J_OC4J_Service
>service.description=the OC4J Web Server service launched using winRun4J64.
>classpath.1=%JAVA_HOME%\*.jar
>classpath.2=e:\OC4J\*.jar
>classpath.3=e:\Software\WinRun4J\winrun4j\
>vmarg.1=-Xdebug
>vmarg.2=-Xnoagent
>vmarg.3=-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

我在命令行执行了以下命令,将icon和initializaton文件绑定到可执行文件:

RCEDIT64.exe /I OC4J_WebServer.exe OC4J_WebServer.ico    RCEDIT64.exe /N OC4J_WebServer.exe OC4J_WebServer.ini

最后,我运行了OC4J_WebServer.exe --WinRun4J64:RegisterService命令来创建Windows服务。我收到以下错误:

>E:\Custom_Apps[info] Module Name: E:\Custom_Apps\OC4J_WebServer.exe
>[info] Module INI:  E:\Custom_Apps\OC4J_WebServer.ini
>[info] Module Dir:  E:\Custom_Apps
>[info] INI Dir: E:\Custom_Apps
>[info] Working directory set to: E:\Custom_Apps\working
>[info] Configured vm.location:  C:\Program Files\Java\jdk1.7.0_65\jre\bin\server\jvm.dll
>[info] Found VM:  C:\Program Files\Java\jdk1.7.0_65\jre\bin\server\jvm.dll
>[info] Expanding Classpath:  C:\Progra~1\Java\jdk1.7.0_65\jre\bin\*.jar
>[info] Expanding Classpath:  E:\Software\WinRun4J\winrun4j\
>[info] Generated Classpath:
>[info] VM Args:
>[info] vmarg.0=-Xdebugvmarg.2=-Xnoagent
>vmarg.3=-Xrunjdwp:transport=dt_socket,address=8787,
>server=y,suspend=n
>[info] vmarg.1=-Djava.class.path=
>[info] Registering natives for Native class
> [warn] Could not find Native class
>  [err] Could not find service class
>  [err] Failed to initialize service: 1
    `java.lang.NoClassDefFoundError: e:\OC4J\j2ee\home\oc4j/jar
    `Caused by: java.lang.ClassNotFoundException: e:\OC4J\j2ee\home\oc4j.jar
    `at java.net.URLClassLooader$1.run(URLClassLoader.java:366)
    `at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    `at java.security.AccessController.doPrivileged(Native method)
    `at java.net.URLClassLoader.findclass(URLClassLoader.java:354)
    `at java.lang.ClassLoader.loadclass(ClassLoader.java:425)
    `at sun.misc.Launcher$AppClassLoader.loadclass(Launcher.java:308)
    `at java.lang.ClassLoader.loadclass(ClassLoader.java:358)

我没有声称自己是一名java开发人员,并且希望有人可以帮助我。我想要做的就是能够使用java -jar %J2EE_HOME%\oc4j.jar命令创建Windows服务。

我很感激帮助/洞察如何设置它。

0 个答案:

没有答案