How to Installing Apache 2.2.11 with Weblogic 10.3 on 64 bit Ubuntu 9.04

To install Apache 2.2.11 on Ubuntu 9.04 64 bit and make it work with Weblogic 10.3 please follow the below steps. The post walks through the steps that I followed, the problems that I faced and the solutions ( er..hacks) to get them resolved.

Installing Apache

  • Is simple do

sudo apt-get install apache2

If you want to build it from sources then follow these steps.

  • Once you have installed apache2 then the installation happens at the following locations in Ubuntu

Apache config files are in /etc/apache
Apache log files are in /var/log/apache
Apache libs are in /usr/lib/apache
Other files can be in /usr/share/apache, /var/lib/apache
executables in /usr/sbin apache and apache2ctl

  • Now to start apache execute the following

stev@stev-laptop:/usr/sbin$ sudo apache2ctl start

  • Note that the server is started as a root, else you might get the following error

(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

You should be able to access the default page on http://localhost now and see It Works!

Now, Integrating with Weblogic


  • Download the apache plugins for weblogic 10.3 from the following location

http://download.oracle.com/otn/bea/weblogic/server103/server103_apacheplugins.zip

  • Unzip the contents and select the mod_wl_22.so file from the location

<apache-plugin-unzip-location>linux/x86_64

  • This file needs to be loaded the following location

/usr/lib/apache2/modules

  • to test whether the file is valid or not do ldd

stev@stev-laptop:/usr/lib/apache2/modules$ ldd mod_wl_22.so
linux-vdso.so.1 =>  (0×00007fff02ffe000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0×00007f5cfaaff000)
libm.so.6 => /lib/libm.so.6 (0×00007f5cfa87a000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0×00007f5cfa661000)
libc.so.6 => /lib/libc.so.6 (0×00007f5cfa2ef000)
/lib64/ld-linux-x86-64.so.2 (0×00007f5cfafc5000)

  • You might notice that some file like in my case libstdc++.so.5 => was not found!

-bash-3.00$ ldd mod_wl_22.so
libstdc++.so.5 => not found
libm.so.6 => /lib64/tls/libm.so.6 (0×0000002a9572f000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0×0000002a958b5000)
libc.so.6 => /lib64/tls/libc.so.6 (0×0000002a959c3000)
/lib64/ld-linux-x86-64.so.2 (0×000000552aaaa000)

  • Goto the synaptic package manager, search and install this file.
  • Now create a weblogic.load file with the following contents

LoadModule weblogic_module /usr/lib/apache2/modules/mod_wl_22.so

  • and put it at the following location

/etc/apache2/mods-enabled

  • You can also create a weblogic.conf file with the following contents at the same location

<Location /medrec>
SetHandler weblogic-handler
WebLogicHost 127.0.1.1
WebLogicPort 7011
</Location>

This would help in redirecting a request like http://localhost/medrec to the weblogic server running on 127.0.1.1 and at 7011 port with the application name medrec.

  • Restart Apache

stev@stev-laptop:/usr/sbin$ sudo apache2ctl restart

  • Check whether the weblogic_module has been loaded successfully or not

stev@stev-laptop:/usr/sbin$ apache2 -t -D DUMP_MODULES
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_worker_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgid_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
negotiation_module (shared)
setenvif_module (shared)
status_module (shared)
weblogic_module (shared)

  • If you see the weblogic_module loaded fine then you have configured it correctly and can now access the application at

http://localhost/medrec/

  • To test whether the apache2.conf file is correct or not you can use

stev@stev-laptop:/usr/sbin$ apache2 -t
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
Syntax OK

Other Potential Problem(s)

  • You may encounter the problem bad user name ${APACHE_RUN_USER}

this is because the value of ${APACHE_RUN_USER} is not getting picked up. Ideally it should be picked up from /etc/apache2/envvars

which has the following entries

# envvars – default environment variables for apache2ctl

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2.pid

However, still in your case if these values are not picked up then goto the /etc/apache2/apache2.conf file and make the following changes

# These need to be set in /etc/apache2/envvars
# User ${APACHE_RUN_USER}
# Group ${APACHE_RUN_GROUP}
User www-data
Group www-data

  • The weblogic.load file is not read for some reason and hence the weblogic_module is not loaded

Make an entry in the httpd.conf file at the following location

/etc/apache2/httpd.conf

and enter the LoadModule and other configuration data in this file

LoadModule weblogic_module /usr/lib/apache2/modules/mod_wl_22.so

<Location /medrec>
SetHandler weblogic-handler
WebLogicHost 127.0.1.1
WebLogicPort 7011
</Location>

There is an entry in the apache2.conf file to include the httpd.conf file, hence the changes of httpd.conf would get loaded

# Include all the user configurations:
Include /etc/apache2/httpd.conf

Author :  Vikas Hazrati

Vikas Hazrati

Steps to use OBIEE JSR168 Portlets in WebLogic Portal

Someone told me they were having trouble getting the OBIEE JSR 168 portlets to run in WLP. Since WebLogic Portal has excellent support for all published portal standards, I figured that the best thing to do is provide illustrated,  step-by-step instructions.

Deploy the JSR168 WAR to the WebLogic Server

Add the JSR168 WAR as a Shared Library to the Application Workspace

Figure 1: Add the JSR168 WAR as a shared library to the application Workspace Step 1Figure 1: Add the JSR168 WAR as a shared library to the application Workspace Step 1
Figure 2:  Add the JSR168 WAR as a shared library to the application Workspace Step 2Figure 2: Add the JSR168 WAR as a shared library to the application Workspace Step 2
Figure 3:  Add the JSR168 WAR as a shared library to the application Workspace Step 3Figure 3: Add the JSR168 WAR as a shared library to the application Workspace Step 3

Add Shared Library To Portal Project

Figure 4: Add shared library to Portal project Step 1Figure 4: Add shared library to Portal project Step 1

Figure 5: Add shared library to Portal project Step 2Figure 5: Add shared library to Portal project Step 2
Figure 6: Add shared library to Portal project Step 3Figure 6: Add shared library to Portal project Step 3
Figure 7: Add shared library to Portal project Step 4Figure 7: Add shared library to Portal project Step 4
Figure 8: : Add shared library to Portal project Step 5 (Check Allow newer versions unless need explicit version control)Figure 8: : Add shared library to Portal project Step 5 (Check Allow newer versions unless need explicit version control)

Add Library Reference To Weblogic.Xml In The Portal WEB Project

<wls:library-ref>

<wls:library-name>sawjsr168portlets</wls:library-name>

</wls:library-ref>

Add <wls:specification-version> and <wls:exact-match> nodes if required.

Un-check Build Automatically, Clean The Workspace Without A Build And Exit Workshop

Figure 9: Uncheck Build Automatically; Clean The Workspace Without A Build And Exit Workshop Step 1Figure 9: Uncheck Build Automatically; Clean The Workspace Without A Build And Exit Workshop Step 1
Figure 10: Uncheck Build Automatically; Clean The Workspace Without A Build And Exit Workshop Step 2Figure 10: Uncheck Build Automatically; Clean The Workspace Without A Build And Exit Workshop Step 2

Restart workshop, build, deploy.

Log-in To Portal Admin Console

Go to Portal\Portal Management. The portlet will be listed for use on streaming portals.

Congradulations!Congradulations!

Weblogic MBean Example (ExecuteQueueRuntime)

Aim
The aim of this tutorial is to connect to a Weblogic MBean from a remote client and extract some Information We will be connecting to the ExecuteQueueRuntime Mbean and getting the idle thread count . Leave any questions or problems as comments and I will endeavour to answer them.

Assumptions
This article assumes that you have a compatible version of Weblogic installed and running and you have a compatible version of the JDK aswell.

Versions used in this example

Sofware/Component Image
Weblogic Server 8.1 N/A
JDK 1.4.2 N/A

Links to these files can be found here

In the source file you are connecting to the admin port on weblogic.

Please make sure the the java versions on your weblogic server and the java version on the client machine are the same or else you will get incompatible serialVersionUID errors like the ones below.

<9/09/2009 01:22:39 PM EST> <Error> <RJVM> <BEA-000503> <Incoming message header or abbreviation processing failed java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359
…..

>

Write and Compile the Example

  1. Write the client code and save it as WeblogicMBeanExample.java in your working directory. Make sure you edit the url, username and password to match your system. The url is basically your weblogic admin url.
     1. import java.util.*;
     2. import java.rmi.RemoteException;
     3. import javax.naming.*;
     4. import java.io.*;
     5. 
     6. import weblogic.jndi.Environment;
     7. import weblogic.management.MBeanHome;
     8. import javax.management.ObjectName;
     9. import weblogic.management.runtime.ExecuteQueueRuntimeMBean;
    10. 
    11. public class WeblogicMBeanExample{
    12.     
    13.     public static void main(String[] args){
    14.         new WeblogicMBeanExample().GoBeans();
    15.     }
    16. 
    17.     public void GoBeans(){
    18.         MBeanHome home;
    19.         String url = "t3://myhost:7001";
    20.         String username = "weblogic";
    21.         String password = "password123";
    22. 
    23.         ExecuteQueueRuntimeMBean mbeanExecuteQueueRuntime;
    24.         Set mbeanSet;
    25.         Iterator mbeanIterator;
    26. 
    27.         try{
    28.             Properties prop = new Properties();
    29.             prop.put(Context.INITIAL_CONTEXT_FACTORY, 
    30.                 "weblogic.jndi.WLInitialContextFactory");
    31.             prop.put(Context.PROVIDER_URL, url);
    32.             prop.put(Context.SECURITY_PRINCIPAL, username);
    33.             prop.put(Context.SECURITY_CREDENTIALS, password);
    34.         
    35.             Context ctx = new InitialContext(prop);
    36.             home = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
    37.             mbeanSet = home.getMBeansByType("ExecuteQueueRuntime");
    38.             mbeanIterator = mbeanSet.iterator();
    39. 
    40.             while(mbeanIterator.hasNext()){
    41.                 mbeanExecuteQueueRuntime = 
    42.                                 (ExecuteQueueRuntimeMBean)mbeanIterator.next();
    43.                 ShowInfo(mbeanExecuteQueueRuntime);
    44.             }
    45.         }catch (Exception e){
    46.             e.printStackTrace();
    47.         }
    48.         
    49.     }
    50.     
    51.     static void ShowInfo(ExecuteQueueRuntimeMBean meqr){
    52.         try{
    53.             System.out.print(meqr.getName());
    54.             System.out.print("\t\t"+meqr.getExecuteThreadCurrentIdleCount());
    55.             System.out.print("\t\t"+meqr.getParent().getName());
    56.         }catch(Exception e){
    57.             System.out.print("\t\tError");
    58.             e.printStackTrace();
    59.         }
    60.         finally{
    61.             System.out.println("\n");
    62.         }
    63.     }
    64. }

    Hide line numbers

  2. You need the weblogic.jar to compile this. I strongly suggest you take a copy of the weblogic.jar file from the weblogic server you are trying to connect to. This will limit any incompatibility issues. Copy the weblogic.jar file to your working directory. It should be with your source file.
  3. Now open a promt to where you saved the file and compile it.
    javac -classpath .;weblogic.jar WeblogicMBeanExample.java
  4. Now run it.
    java -cp .;weblogic.jar WeblogicMBeanExample