Re: WebObjects Containers
Re: WebObjects Containers
- Subject: Re: WebObjects Containers
- From: Owen McKerrow <email@hidden>
- Date: Fri, 16 Jan 2004 09:59:27 +1100
On Thursday, January 15, 2004, at 04:05 PM, Chuck Hill wrote:
I've not heard of anyone getting anywhere with JBoss and WO. Given
the,
er, light level of documentation that is not surprising. Another one
that
looks interesting is JOnAS:
http://jonas.objectweb.org/current/doc/JOnASWP.html
Chuck
Hi Guys,
I posted this a while back, but we are currently doing a large project
with Sun and have to use Sun App Server 1 as the deployment environment
and thus we deploy as a WAR. We to found very little doc, but with
enough digging and bugging of the list we got things working first
under JBoss and the then under Sun App Server 1 without WebObjects
installed on the box. Here is the walk through. Most of this stuff
wasn't required for JBoss, it did quite literally just work, although
WO was installed on that machine.
Owen
Webobjects Deployment as WARS under Sun ONE Application Server
OK after a number of days of fiddling we have manage to get WO App's to
deploy as WARS under Sun ONE Application server, without having WO
installed on the box.
And while its all more or less fresh in our heads we though we would
share the steps with you.
We will be the first to admit that we are no experts and indeed
couldn't explain why half the stuff we did worked, but it did. So if we
get some things wrong, please let us know and we will update this doc.
Were hoping this will be the start of some form of useful documentation
on WO and WARS. So as we receive feedback and corrections I will
correlate them all and once we have a final version I will stick it up
on wocode.com
OK first the configuration :
Development Box :
Mac 10.3
WebObjects 5.2.2
Deployment Box :
Solaris 9
Sun ONE Application Server 7.1 Update 1
Database :
Openbase 7.0.15 running on a OS X 10.2.8 Server
NOTE : Server1 is the name of our server instance, you will need to
replace it with your own server instance.
Step One : Setting Up the Application Server to handle WO WARS ( this
is assuming the App server has already been installed and set up)
The first things you will need to do is add a new JDBC connection pool
and resource to the App server.
From the web admin page click "App Server Information -> Server1 ->
JDBC -> JDBC Connection pools" and add a new connection pool, give it a
name eg "OpenBasePool" and a Datasource classname =
"com.openbase.jdbc.ObDriver"
Then click "App Server Information -> Server1 -> JDBC -> JDBC Resources"
Click new and add a JNDI name eg "jdbc/openbaseWO" and select the
connection pool you created in the previous step.
Remember this JDNI name as you'll need to include it later in the
web.xml and sun-web.xml file later.
The last part to this step is to change the secuirty permission on the
server, for your java classes. We found this on Omni-Groups WebObjects
Admin list :
"the java code access policies are to strict for WebObjects
applications after a default installation of the S1AS7.
That is, you'd have to edit the file
/var/opt/SUNWappserver7/domains/domain1/server1/config/server.policy so
that it contains "permission java.security.AllPermission" on the right
spot there. I've copied the relevant line from server.policy with
some context below.
// Basic set of required permissions granted to all remaining code
grant {
permission java.security.AllPermission;
We're chasing up Apple to get a list of files to open up permission's
too as AllPermission is not the most secure thing :) If anyone out
there knows the exact files to open up, please let us know.
Step Two : Adding 3rd Party jar's
As we use OpenBase as our DB we needed to add the OpenBaseJDBC.jar into
the App server so that it could find it. Download the latest vesrion of
Openbase and copy the OpenBaseJDBC.jar file from
/opt/OpenBase/Java/Extensions into /opt/SUNWappserver7/lib/.
Now the doc said any jar's included in this folder would be usable, but
you need to restart the App Server first. We did that but still didn't
have access to the file, so we added an explicit path to the file.
From App Server, click on server1 -> JVM settings -> Path Settings and
add the path to the jar file in here
/opt/SUNWappserver7/lib/OpenBaseJDBC.jar and click apply changes then
restart the server.
We believe this is the same step you need to do for any 3rd party jar's
( unless there is a way of sticking them inside your WAR file ??), we
tested this with a radius jar and it worked fine.
Step Three : Making the WO Project build as a WAR.
Now there is quite a bit on the lists already about turning existing
Projects into WAR's, however we could never seem to get it to work.
Instead we made a new project from scratch and put our old files in.
Anyways when you make a new project, you come to the section on J2EE
Intergration. Click the box to Deploy as a servlet container and then
the radio button to Deploy as a standalone WAR. Also tick the box to
copy all JAR files into the Applications WEB-INF/lib directory.
Now when you build and run this, a WAR file is created for you inside
/Library/JBoss/deploy/ and its called yourproject.war
Step Four : Setting up the WAR.
OK now you need to fix up the XML files inside the WAR. To do that use
Terminal : jar -xf yourproject.war
Which essentially uncompresses it. You will find 2 folders META-INF and
WEB-INF. Inside WEB-INF you will find a web.xml file and a
jboss-web.xml file. You will need to change 1 line in web.xml.
Open it and find the line :
<res-ref-name>jdbc/DefaultDataSource</res-ref-name>
Change it so that it has the name of JNDI name that you set up in step
1 :
<res-ref-name>jdbc/openbaseWO</res-ref-name>
jboss-web.xml file is not required as you will be deploying to Sun App
server, so you need to replace this file with one called sun-web.xml,
which has almost the same layout as the jboss one. Here is a copy of
the whole file. Note that we use the same name for our res-ref-name as
we did in web.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Sun ONE
Application Server 7.0 Servlet
2.3//EN'
'http://www.sun.com/software/sunone/appserver/dtds/sun-web-app_2_3-
0.dtd'>
<sun-web-app>
<session-config>
<session-manager persistence-type="memory" />
</session-config>
<resource-ref>
<res-ref-name>jdbc/openbaseWO</res-ref-name>
<jndi-name>jdbc/openbaseWO</jndi-name>
</resource-ref>
<jsp-config />
</sun-web-app>
Now you need to package the changes back up into the WAR file : jar -cf
yourproject.war META-INF WEB-INF
Now there maybe an easier way to do this, like setting something in
your project so that these things are set when you build it, but this
was the way we did it.
Step Five : Deploying The WAR
Copy the war file over to the server ( You shouldn't really have to do
this, but when we tried from our Mac's the war file wasn't uploaded
properly, it was just an empty file ). Under your server instance click
on Applications -> Web Apps. Click on Deploy, you will asked to upload
a file. Click browse then with a file dialog, navigate to and select
your WAR file. Click OK. When the next page loads, you should just have
to click OK again ( no settings need changing in other words ). And
hopefully that's it.
You should now be able to see your App name on the Web App's page. To
access the site you will need to go a url something like this :
http://www.yourserver.com:81/yourproject/WebObjects/yourproject.woa
As I said before, we aren't experts and there maybe things we are doing
the hard way, or indeed completely wrong, however the above works for
us and we though we should share it with you all, in the hope it will
save someone some time one day.
Owen McKerrow
Dave Elsner
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.