a simple install of WebLogic Server

by Rod Chavez


so, i recently took some time off. as American standards go, a rather long time
off (8 weeks). instead of sleeping for the entire time (as my wife expected), i
got turned on by the idea of attacking our home network/automation system and
making it actually work. after two different (and expensive)
contractors, it still didn't behave the way i wanted. but hey, i'm a geek, how
hard can it be? hmmmmm...




why am i telling you this? after all, you can read about "what i did on my
summer vacation" on my home blog. the
reason is that when i'm not playing amateur home automation geek, my day job
for the last 2 years has been as dev-lead for the runtime in BEA's WebLogic
Workshop. and horror of horrors, i didn't use WebLogic Server or Workshop in my
summer quest. i used, gulp, Apache . in my defense, i stated upfront that i
would move to WebLogic Server as soon as i could. but when would that be?




this little fact did not escape the notice of
Byron Sebastian, my boss' boss, and
"the man" when it comes to Workshop. one of his first emails to me when reading
my home blog was "when you try switching to WLS/W, please write up your
experience because others will likely find it useful". the end result of that
email thread was this post




the first thing i had to figure out was exactly what i wanted out of WLS in
order to make the switch. why, after all, did i start with Apache in the first
place? after all, WLS is a J2EE AppServer that is also a full featured web-
server. so what's the problem, just install it and away you go. well, not
quite...




you have to realize that the design center for WLS is the clustered, high-
throughput and heavily transacted IT environment, and the installer is
generally focused on this case. recently, with the introduction of Workshop,
the installer works better for the developer using the Workshop IDE, but still
needs work to deliver well outside these scenarios




but neither of these scenarios was really what i wanted. the latter came
closest in that it made development easy, but i wanted more. here's the high-
level list of what "more" was:


  • simple setup (100% question free)

    i didn't want to have to answer a bunch of questions in order to get the basic
    system going. i've been burned too many times when trying to recover a working
    setup after crash or upgrade, that i try to run with defaults whenever i can

  • start/stop via service/chkconfig

    like many, i've become addicted to the way *nix supports managing "services".
    on my server and workstations at home, as well as my dev box at work, i run
    RedHat9. but OOTB (out of the box) WLS only supports the "service" model of
    management on Windows. i wanted to make WLS support the *nix service model

  • listen on port 80/443

    the default install has WLS listening on ports 7001/7002 (http/https). i wanted
    it to run at the standard ports instead. on linux, only root can access port
    numbers 1024 and below. which by itself isn't a huge issue, just start the
    server when you're logged in as root. of course, this can be a big
    security issue
    . for example, this would mean that the server and any
    user code would be running with root privilege. if someone cracks your server,
    they would own your machine


    the solution is to start the server as root, and then once it's running it
    needs to switch to another user. from that point on, it's no longer root-
    privileged



  • cgi enabled (Python by default)

    while Java is currently my "work" language, i use scripting languages all the
    time for various odd-jobs and tasks. depending on the task at hand, i tend to
    reach for either Bash or Python. everyone has their favorites, and enabling CGI
    scripts to run in a web-server opens things up to scriptors of all stripes.
    since i'm a Python addict, i wanted that enabled by default, but it's trivial
    to enable others





one thing i really wanted, that i decided not to tackle, was to support
having an RPM-based install. i thought about it, but since i don't understand
how easy/hard it is to create an RPM i took a pass




with this loosely defined set of goals, i downloaded WLS off BEA's
dev2dev website and dug in. the result of
my efforts can be found
here
. it's a zip file containing:


  • wlsInstall: a Bash script that installs everything

  • silentI.xml: an XML file used during the first phase of the install

  • silentC.txt: a text file used during the second phase of the install

  • default: an exploded J2EE web-app used during the third phase of the
    install

  • wls: a Python script that supports the "rc-script" standard for
    start|stop|status





i also need to mention that i wouldn't have gotten anywhere if it
wasn't for the help of Raj Alagumalai. he
answered a ton of questions with way more patience then i would have shown in
his position. he really knows WLS install and setup cold. thanks Raj!




i've verified that this stuff works on both RedHat9 and RedHat8. it'll even
work on RedHat7, but with RH7 you'll need to upgrade your version of Python.
i know it works with Python 2.2, not sure how far back you can go and still
have it work. there's also no reason WLS won't run on
Debian or
SuSE
, but i haven't tried them. if anyone finds they work, or makes fixes
so that they do, let me know




ok, onto using this stuff yourself. do the following:


  1. download the zip file
    and into the same directory, download

    WebLogic Server 8.1
    . the server link provided here gets you most of the way
    through the dev2dev site, but there's a few things you need to do manually:

    • on the page i've linked you to, you need to select the right OS. in the
      dropdown, in the 2nd section labeled "WebLogic Server Package
      Installer", pick "Red Hat Enterprise Linux (2.1, 32 bit)" and then click on the
      "Select >>" button to the right of the drop-down

    • at this point, you will be challenged for a username and password. you
      can't download without giving marketing its due <g>. if you don't have a
      dev2dev account, getting one is trivial. there's a register button on the login
      page that lets you sign up. once you've either logged in or registered,
      you'll come back to the right spot in the download process

    • once past that, you'll see a page asking if you're downloading a server
      you've already paid for, or do you want to evaluate a server first. BEA now
      provides a "developer license" where you can get and run the server for free
      for 1-year, as long as you don't "put it into production". so just select
      "I would like to evaluate this product and click "Next >>"

    • you'll now see a form asking some questions about what you want to do with
      the product, blah blah blah. answer however seems best, and then click
      "submit"

      please note that the download process you're forced to go through is
      being streamlined and revamped, so that there will be less marketing/sales gorp
      to deal with. but for now, please ignore it as best you can

    • next up is the License Agreement. click "I Accept" when you're ready

    • click on the download area that is the closest match to the region you're
      in and your browser should prompt you to open or save. pick save. do not
      open it yet. when saving, make sure the saved name is server811_linux32.bin
      . that should be the default, but in case your browser did something
      funny...



  2. unzip simple.zip. you want the sub-dir that's created to be right there,
    next to the server binary and the zip file
    unzip simple.zip

  3. move into the directory that was just created (should be named simple)
    cd simple

  4. security issue: the management password being set during this install
    is weblogic, which is fine as long as your machine cannot be seen from
    the net at large. WLS supports management via the browser, and you don't want
    random people on the web changing things on you if you can avoid it <g>. so
    if your machine will be seen on the Internet, you should change the management
    password in the silentC.txt and wls files in this directory
    before proceeding with the install. just search for the word "password" and
    you'll see the values that need to change

  5. the next steps require root-privilege, so switch-user to root (this will
    prompt you for the root password)
    su --command="cd $PWD" -

  6. run the wlsInstall script
    ./wlsInstall

  7. at this point, WLS is installed, you've got a default web-app, and the
    server is ready-to-run. you can start and stop the server using the service
    command
    service wls start

  8. with the server running, you should be able to type http://localhost/
    into your browser and see the home page of the default web-app

  9. if you want the server to start during boot, use chkconfig

    chkconfig --add wls
    chkconfig wls on

  10. assuming you don't want to have to be root in order to add content to your
    web-app, you can give all users on the machine the ability to modify the web-app
    with the following command

    chmod -R a=rwx /bea/user_projects/domains/wls/applications/default

    the directory listed here is the root of the default web-app

  11. within the default web-app, there's a directory named "cgi-bin". they way
    i've configured things, you can place Python scripts with the extension '.py'
    in the cgi-bin directory and then hit them from the browser and they'll run. so
    for example, if you put a Python script named 'foo.py' in there and then point
    the browser at http://localhost/cgi-bin/foo.py, you'll see the results of your
    script. you can see what enables this by looking in
    /bea/user_projects/domains/wls/applications/default/WEB-INF/web.xml at the
    following lines:

    <init-param>
    <param-name>*.py<param-name>
    <param-value>/usr/bin/python<param-value>
    <init-param>

    if you want to enable other script engines, just add another section like this
    one with the appropriate file extension and script engine





well, that would seem to be that. a simple install, an easy way to control the
server and all on top of an industrial-strength J2EE server. cool, eh? and i'm
sure there are ways to make it simpler/easier, so if you spot any, i'd be very
interested in your input. btw, you can find the online doc for WLS 8.1
here




next up i'm going to spend some time building some samples and services that
will run live on dev2dev, which is BEA's developer support site. i'll be
posting the code for all of these, along with my experience in building them,
on this blog. and i will be developing all of them on top of the install
described in this post. make no mistake, this install will evolve, and it
wouldn't surprise me if it ended up changing quite a bit over time. and i
should also make clear that anyone who would like to participate, from
criticism (you moron Rod, why did you do it that way?) through code, and
anything in between. in the end, i'm a utility junkie. i'm interested in things
that get used, that do something *useful*. we'll see




one of the ideas i've got for the first online developer service to write would
be an "XML comparison" service. initially, you feed in two payloads, either via
file-upload or a web-service, and it performs an xml-wise compare and returns
the result. it could be extended over time to take a schema to optionally
perform a schema-wise compare. for example, one payload specifies a value, and
the other doesn't, but the value supplied is equal to the default value
proscribed in the schema. from a schema-wise perspective, the two payloads
would be considered "equivalent". what think?



did you find this useful? any ideas for improvement of the process? did it work for you (or not)?


9 Comments

fbalazs
2003-09-26 04:02:03
Licensing problems
I'm working on WLP 8.11/Workshop/Portal projects for a while now, and I also thought about using WLS for my home server.
It would be very easy to do a kickass blog site for example with Workshop and Portal.
Unfortunately there's no free non-profit/personal site licence for the Platform or Workshop, so I simply cannot use it as my personal webserver to publish my blog on the Internet for example.
It would be a smart marketing idea to extend the developer licence for home/personal site use.
I'd imagine a large number of free portlets, controls and components would become available, as people solve their own home requirements, which would only add value to the product, even in a commerical setting.
Now I'm spending my free time on creating components for my own use, on other free platforms, even if I'd find Workshop a better solution.
Alternatively, you can send me a free WLP license ;-)


Balazs

rodc
2003-09-26 11:53:54
Licensing problems
it's interesting that you point this out. we're in the process of figuring out how to do this, because you're right, we want to encourage people to innovate like mad, in all situations, on top of WebLogic


what do you think would be a good way to do this?


also, send me mail @rod@bea.com and i'll get you a license for WLP in the meantime

jimothy
2003-09-26 12:22:34
Mac OS X
Has anybody tried getting WebLogic 8.1 to run on Mac OS X? Like many of O'reilly readers, at my day job, it's Windows on the desktop, Solaris on the server, but at home, it's Mac OS X. I don't expect BEA to be officially Mac friendly, but I'd like to try playing with 8.1 at home, if there's a way to hack around BEA's lack of a Mac installer.


fbalazs
2003-09-26 13:23:29
Licensing problems
Fantastic news!


I bet it will be a long process to get this through your legal department :-).


I guess the biggest problem is figuring out the legal definition of home use.
It's easy to decide that it's not personal use if I'm being paid to create/operate a site with it.
But things will get much more complex.
- What if a user decides to sign up his blog for Google ads, and gets 5 dollars out of it?
- What if someone doesn't have the bandwith to host the site at home? It would be just the same personal blog site, but hosted at a provider.


It would be problematic to limit the features: I would not neccessarily use WebLogic just to run JSPs - Workshop, EJBs, the Portal, that's where the fun/advantage is.


Usage limitations would also cause problems - ideally if I do something so cool it gets listed on Slashdot, I don't want to display something like "This site exceeded the 100 requests/day limit of the free license" or something.


I think if you have a license which would clearly define (in a readable manner, not just a cryptic legal document), what can and cannot be done with it (i.e. you cannot get any money to operate the site, you can host the site at a hosting provider, but only on a box you own and manage), and if you'd treat small deviations liberally, it could be a huge win.
Both in developer mindshare, and the availability of powerful free components.

rodc
2003-09-26 13:37:43
Mac OS X
WLS does run on Mac OSX. we've got a few people here at BEA who run it on their laptop, or home machine. you might need a bit more memory, i'd say 512mb min, 1gig would be fine


i almost mentioned this in my post, but i'm getting one of those brand-new, absolutly beeuuutiful 15" PowerBooks. i should have it next week. and of course, i'm gonna be running WLS/W on it


it should be pretty easy for me to write up the hacks required to make this run. i'll get it posted next week

akraj
2003-09-26 13:37:56
Mac OS X
A few of our devs work on Mac OS X. Please refer to the following newsgroup post for more information.


http://newsgroups.bea.com/cgi-bin/dnewsweb?utag=.&group=weblogic.developer.interest.general&xrelated=12719&cmd_thread_last.x=46&cmd_thread_last.y=6

jpembert
2003-10-16 14:22:18
Configuring WebLogic Server with PHP
After reading this, I was inspired to configure WebLogic Server with PHP as a CGI extension. After a little mucking, here's what I came up with:


Download the PHP package from www.php.net and extract it. Follow the instructions to install it up until the part about configuring your server with PHP.


Add the following to WEB-INF/web.xml in your Application:
-----------

PHPCGIServlet
weblogic.servlet.CGIServlet

cgiDir

C:\path\to\directory\with\php\scripts



*.php
C:\path\to\php.exe



PHPCGIServlet
/php/*

-----------


In your php.ini file, search for "cgi.force_redirect". You need to uncomment this line and set it to 0:


cgi.force_redirect=0


Once this is done, any .php files in the 'cgiDir' directory will be available at http://yourserver:port/php/

shami
2004-04-21 23:36:04
Configuring WebLogic Server with PHP - Urgent
Is it possible to configure Weblogic 7.0.1 with PHP on Solaris machine.
GreyWall
2005-09-16 11:41:27
Configuring WebLogic Server with PHP
Made the changes as mentioned above by you. But my weblogic server is still spitting out php code instead of evaluating it.


config: Weblogic 8.1; Windows XP


Can u help?


regards,


GreyWall