Pages

Friday, March 7, 2008

deploy BlazeDS on OC4J ( Oracle AS)

With BlazeDS you can exchange data from your backoffice systems to the Flex clients, This is an opensource solution. Previously you had to have Adobe LiveCycle to archieve this. Adobe provides a BlazeDS Tomcat turnkey solution. This turnkey contains with BlazeDS, DS-console and Samples webapps. They also included a hypersonic database for the provided samples.
But you can also use the OC4J Container as application server. For this you have to download a OC4J 10.1.3 container or Oracle AS and download the BlazeDS turnkey solution. We need this turnkey for the webapps and the example database.

in the OC4J\j2ee\home\applications folder create 3 folders named blazeds, ds-console and a samples folder and create in each folder a META-INF folder. In these folder we will create an application.xml. Now we can copy blazeds folder from tomcat\webapps to OC4J\j2ee\home\applications\blazeds. You wil get the following folder structure
applications\blazeds
applications\blazeds\META-INF
applications\blazeds\blazeds
Do the same for the ds-console and samples folder.
Now we can create 3 application.xml and put this to the right META-INF folder.

<?xml version="1.0"?><!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd"><application> <display-name>Oracle generated application blazeds</display-name> <module> <web> <web-uri>blazeds.war</web-uri> <context-root>blazeds</context-root> </web> </module></application>

ds-console application.xml
<?xml version="1.0"?><!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd"><application> <display-name>Oracle generated application blazeds</display-name> <module> <web> <web-uri>ds-console.war</web-uri> <context-root>ds-console</context-root> </web> </module></application>

samples application.xml
<?xml version="1.0"?><!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd"><application> <display-name>Oracle generated application blazeds</display-name> <module> <web> <web-uri>samples.war</web-uri> <context-root>samples</context-root> </web> </module></application>

Now we can change the server.xml of the OC4J container (config folder) where we add these lines

<application name="blazeds" path="../applications\blazeds.ear" parent="default" start="true" /> <application name="ds-console" path="../applications/ds-console/" parent="default" start="true" /> <application name="samples" path="../applications/samples/" parent="default" start="true" />

Add the following lines to the default-web-site.xml ( Config folder)

<web-app application="blazeds" name="blazeds" load-on-startup="true" root="/blazeds" /> <web-app application="ds-console" name="ds-console" load-on-startup="true" root="/ds-console" /> <web-app application="samples" name="samples" load-on-startup="true" root="/samples" />

Move the Hypersonic database ( blazeds_turnkey_3-0-0-544\sampledb ) to an other destination and you can delete the turnkey solution.
Now we have to start the OC4J Container with the following option "-Doc4j.jmx.security.proxy.off=true" Otherwise you get a java.lang.SecurityException error Unauthorized access from application to MBean.
You can add this line in the oc4j.cmd or with Oracle AS in the opmn.xml ( folder OracleAS\opmn\conf ).

3 comments:

  1. I've got deployment on OC4J just by using web admin interface. Made simply deploying .war files (blazeds, samples, ...) and changing JVM options (-Doc4j.jmx.security.proxy.off=true). I'm using OC4J 10.1.3.2. But I could not deploy application by following steps described in article. Maybe some more option for OC4J should be set for manual deployments ?

    ReplyDelete
  2. Very good, In my blog I didn't download the source but only the turnkey solution. In the blazeds source there are the 3 wars. In the turnkey I had to copy it and configure it manually

    ReplyDelete
  3. The JVM security option didn't work for me. However I found another site dealing with this security problem.

    There they advised me to set manageable to false under the system tag in services-config.xml.

    That did the trick!

    ReplyDelete