Andrej Koelewijn

3/11/2004

Using ant to deploy to OC4J

Filed under: — andrejk @ 12:13 pm

I found the following usefull information in the OTN forums. You can use this example to deploy a war archive to a remote OC4J server in an Ant build file. I noticed that oc4j_remote_deploy.jar is not part of the jdeveloper 9.0.3 installation i have here, and it’s also not part of the standalone oc4j installation i’m using.


<java jar="${jdev.dir}/jdev/lib/oc4j_remote_deploy.jar" fork="yes">
<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
<arg value="http://remote_server:1810/Oc4jDcmServletAPI/" />
<arg value="username" />
<arg value="password" />
<arg value="redeploy" />
<arg value="E:ora9ias" />
<arg value="${build.dir}/${name}.ear" />
<arg value="${name}" />
<arg value="OC4J_PORTAL" />
</java>

7 Responses to “Using ant to deploy to OC4J”

  1. George Thomas Says:

    Hi,
    I use the standalone OC4J 9.0.3 installation and my ant task executes a variant of the command-line options you pass to admin.jar to deploy/undeploy/restart (the ”-restart” switch to restart the application alone, not the whole container):
    <java classname=”com.evermind.client.orion.OrionConsoleAdmin”

    classpathref=”deployment.classpath”>
    <arg value=”ormi_deployment_server_url” />
    <arg value=”deployment_username” />
    <arg value=”deployment_password” />
    <arg value=”-deploy” />
    <arg value=”-file” />
    <arg value=”application_ear_name” />
    <arg value=”-deploymentName” />
    <arg value=”application_name” />
    </java>

    Where “deployment.classpath” includes oc4j.jar (which contains the class referenced in the classname attribute) (I also include the other J2EE jars: j2ee.jar broken up as ejb.jar etc etc, just so that exception traces work at my end if the command fails). The “ormi_deployment_server_url” would be ormi://<name_of_machine_running_the container>:<port_if_not_23791>/. The “deployment_username” and “deployment_password” would usually be ‘admin’ and the associated password you set up when you installed the container. Hope this helps.

  2. Andrej Says:

    I am using the same statements when testing on a local oc4j server, but it doesn’t work when you want to deploy to a remote oc4j/9ias server.

  3. Matt Says:

    Hello, what does the refer to?

    Also, is the argument specify the application name as you would enter when you deploy using OEM?

    Thanks!!

  4. Matt Says:

    It does not look like the post took the copy and pasted arguments

    ${name} – Application Name?

    E:ora9ias – what is this referring to?

  5. Andrej Says:

    Olaf has a better explanation on his blog: http://www.orablogs.com/olaf/archives/000363.html. As you can see E:ora9ias should have been e:ora9as, which is the remote ias home. And ${name} is the application name.

  6. Andrej Says:

    Ok, backslashes aren’t displayed, there should be one between the e: and ora9ias.

  7. Al Says:

    Hi
    I used ant to make an ear of my app
    then i used above proccedures to deploy it
    but encountered the error

    [java] Error: Missing ormi://:
    [java] Java Result: 1

    any help in this regard would be much appreciated
    thanx

Leave a Reply

Powered by WordPress