Setting up a local OC4J instance in Intellij

571 views Asked by At

When I am developing I run my application locally on an OC4J instance on my PC and I can start the server from eclipse, deploy the application to OC4J with maven, view it in the browser and debug it in eclipse. I am trying get the same set up in IntelliJ.

The steps to set it up the server in eclipse are:

  • Preferences > Servers > Runtime Environments -> Add (Oracle > Oracle OC4j Standalone 10.1.3n)
  • Open the server configuration/overview window from the servers view
  • Server Properties > set username, password, port etc
  • Click "Open Launch Configuration"
  • Arguments tab > set VM arguments
  • Classpath tab > User entries shows oc4j.jar ~ C:\oc4j\j2ee\home
  • Source tab > shows my project directory and a 'Default' directory
  • JRE tab displays the jdk I am using

When all this is set I can run the server from eclipse and debug my application.

I've done the following in IntelliJ (but it's not working...)

  • Run > Edit configurations
  • Add new configuration
  • Select JSR45 Compatible Server (I've read this is the one to choose for OC4J)
  • Give it a name, mainly use default values, add OC4J_JVM_ARGS to 'VM Options Variable' box
  • add -start to VM Options (I've also tried adding all the vm args from eclipse in here)
  • Startup/connection tab: add C:\oc4j\bin\oc4j.cmd to Startup script box (I can't add the oc4j.jar from C:\oc4j\j2ee\home)

Now when I try to run the server from intellij I get the following output:

C:\oc4j\bin\oc4j.cmd

Usage: oc4j.cmd [Options]

Options:

-start : start OC4J

-shutdown -port -password : stop OC4J

-version : display the version

-help : display this message

Disconnected from server

This seems to be normal and is what happens when you run C:\oc4j\bin\oc4j.cmd, but I don't know what start up script I should be setting in intellij

Can anyone advise? Where should I specify -user and -password in Intellij? Thanks a lot

1

There are 1 answers

0
Shane On

It seems that the 'Startup script' and'Shutdown script' boxes on the Startup/Connection tab in IntelliJ are not just file inputs, you can also type commands in there. So OC4J can be started by changing my intellij steps as follows:

  • Run > Edit configurations
  • Add new configuration
    • Select JSR45 Compatible Server
    • give it a name
    • mainly use default values
    • add any VM Options you have
    • add OC4J_JVM_ARGS to 'VM Options Variable' box
  • Startup/connection tab:
    • add "C:\oc4j\bin\oc4j.cmd -start" to Startup script box
    • add "C:\oc4j\bin\oc4j.cmd -shutdown -port=(your port number) -password=(your password)" to Shutdown script box

OC4J can now be started from intellij