Showing posts with label weblogic. Show all posts
Showing posts with label weblogic. Show all posts

Saturday, August 15, 2009

How to deploy WSAS-3.X on Oracle WebLogic 10.3

WSO2 DOES NOT ENCOURAGE INSTALLING WSO2 APPLICATION SERVER (previously known as WSAS) ON TOP OF OTHER APPLICATION SERVERS. WSO2 HAS DECIDED TO DROP SUPPORT FOR WEBAPP DEPLOYMENT MODE OF THE WSO2 PLATFORM AND PRODUCTS.






Once Azeez has written a 10 minute guide to installing WSO2 WSAS on Weblogic server. That guide explains the steps to deploy 2.X family of WSAS on weblogic. With the introduction of WSO2 Carbon platform in December 2008, WSO2 WSAS is no longer distributed as a separate war distribution. Hence, the instructions given in that document is not applicable when deploying WSO2 WSAS-3.X series on Oracle WebLogic server.
Since all WSO2 java products are built on Carbon platform, users can configure running WSO2 products on any application server using a set of components included in binary distributions. I have already explained the steps to deploy WSO2 BPS on tomcat and WSO2 WSAS-3.X on Jboss.

This post describes the steps to deploy WSO2 WSAS-3.X on WebLogic 10.3

Step1

Create a new weblogic domain by running config.sh {bat} located at WebLogic_HOME/wlserver_10.3/common/bin directory.
Lets assume the new domain is wsas.

Access your weblogic domain direcrtory and start weblogic (Go to WebLogic_HOME/user_projects/domains/wsas/bin and run startWebLogic.cmd)

Step 2
Download the latest version of WSO2 WSAS-3.X from here. Extract the downloaded zip into a directory. Copy conf, database, repository and resources directories in to a new folder. Here after, we will refer it is wsas-repo (i.e:- C:\wsas\wsas-repo)

Also, create a new directory, wso2wsas and copy the WEB-INF directory located at the webapps/ROOT directory of the downloaded WSO2 WSAS-3.X to wso2wsas directory. Now, your wsas-repo should have five sub directories - conf, database, repository, resources and wso2wsas.
wso2wsas will be used as the webapp root directory.

Step 3

We need to enable SSL in weblogic server. Log in to weblogic administration console (You should have configured username and password for admin console when creating your WebLogic domain) and go to Environment --> servers. Select AdminServer.
Click on KeyStores tab. Configure keystores as shown below.



Keystore = Custom Identity & Custom Trust


Custom Identity Keystore = C:\wsas\wsas-repo\resources\security\wso2carbon.jks

Custom Identity Keystore Type = JKS

Custom Identity Keystore Passphrase = wso2carbon

Confirm Custom Identity Keystore Passphrase = wso2carbon

Custom Trust Keystore = C:\wsas\wsas-repo\resources\security\wso2carbon.jks

Custom Trust Keystore Type = JKS

Custom Trust Keystore Passphrase = wso2carbon

Confirm Custom Trust Keystore Passphrase = wso2carbon

Now, select SSL tab and enter the following values.

Identity and trust locations = keystores

Private Key Alias = wso2carbon

Private Key Passphrase = wso2carbon

Confirm Private Key Passphrase = wso2carbon


Save the configuration and go to the General tab. Select the check box next to "SSL listen port enabled".

Now we have configured the necessary changes to enable SSL on weblogic. Lets continue with deploying WSO2 WSAS on weblogic.

Step 4

Now, we should update the set of config files shipped with WSO2 WSAS. We will update carbon.xml, axis2.xml, registry.xml and user-mgt.xml which can be found at the above wsas-repo\conf directory.
First, open carbon.xml and update the ServerURL element as follows.

<ServerURL>https://localhost:7002/wso2wsas/services/</ServerURL>

Note that we have configured weblogic to run on 7002 port.

Update WebContextRoot element as follows.

<WebContextRoot>/wso2wsas</WebContextRoot>

Save and close carbon.xml.

Open registry.xml and update DB URL as follows.

<url>jdbc:h2:C:\wsas\wsas-repo\database\WSO2CARBON_DB;create=true</url>

Now, open user-mgt.xml and update database URL as follows.

<url>jdbc:h2:C:\wsas\wsas-repo\database\WSO2CARBON_DB;create=true</url>

Make sure to specify the absolute path of the WSO2CARBON_DB in both of the above elements.

We must change the http and https ports in In Transports section of axis2.xml as follows.

<transportReceiver name="http"
class="org.wso2.carbon.core.transports.http.HttpTransportListener">
<parameter name="port">7001</parameter>

</transportReceiver>

<transportReceiver name="https"
class="org.wso2.carbon.core.transports.http.HttpsTransportListener">

<parameter name="port">7002</parameter>
</transportReceiver>

Step 5

We have completed the required configurations and we can deploy WSO2 WSAS on weblogic now.
First, shutdown the weblogic server instance if it is still running.
open a new command window and change the directory to WebLogic_HOME/user_projects/domains/wsas/bin.
Define an environment variable called CARBON_HOME and set the path to your wsas-repo directory.

In windows; set CARBON_HOME=C:\wsas\wsas-repo
In linux; export CARBON_HOME=\home\user\wsas\wsas-repo

Run startWebLogic.cmd

Once the server is started successfully, log in to weblogic administration console using https://localhost:7002/console
Then, go to the Summary of Deployments page and select Install.
Locate the deployment root by selecting C:\wsas\wsas-repo\wso2wsas directory. (web app root directory will be shown with a radio button option as follows.



Click on next to proceed through the wizard and continue with the default settings.
Once the deployment is successful, save the configuration and select start --> servicing all requests

Now, we are done with the deployment. You could access the management console using https:\\localhost:7002\wso2wsas\carbon

Note:-
1. In order to set the log4j logs, you may copy log4j.properties file in the extracted WSO2WSAS-3.X directory to wsas-repo\wso2wsas\WEB-INF\classes

2. If you want to deploy JaxWS services in WSAS/WebLogic platform, you should do the following configuration to avoid a class casting issue (https://wso2.org/jira/browse/CARBON-4835)

- Remove weblogic.jar/META-INF/services/com.sun.xml.ws.api.wsdl.writer.WSDLGeneratorExtension & restart Carbon

3. Also, Make sure to copy xalan-*.jar, xercesImpl-*.jar and xml-apis-*.jar from the lib/endorsed directory of the extracted WSAS binary distribution to weblogic endorsed directory before you start WSAS.




Saturday, October 25, 2008

Changing the default class loading mechanism of JBoss 4.2.* and WebLogic

Application servers use different class loading/delegation mechanisms. Therefore, we should understand them when deploying enterprise applications. In most cases, we need to override the default class loading behavior of application servers.
Suppose your web application wants to load classes from its own class loader first without delegating to parent. Then the following simple configurations will help you to override default delegation pattern in BEA WebLogic (version 8.* or 10) and JBOSS 4.2.*.

In WebLogic:

Set <prefer-web-inf-classes> to true in WEB-INF/weblogic.xml of your war.

Read WebLogic Server application classloading for more information.

In JBoss:

Set java2ParentDelegation to false in WEB-INF/jboss-web.xml as follows.

<loader-repository>
org.test:loader=archive-name
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>

For more information about JBoss class loading, have a look at JBoss classloading configuration guide

Monday, July 21, 2008

How to deploy Apache Axis2 on WebLogic 10

I have already discussed the steps to deploy Apache Axis2 on IBM WebSphere, JBoss and Resin application servers. In this post, I'm going to explain the procedure to deploy Axis2 on BEA Weblogic 10 server.

Pre-requisites:
Download and install BEA Weblogic 10.

Step1

Create a new weblogic domain by running config.sh located at WebLogic_HOME/wlserver_10.0/common/bin directory.
Lets assume the new domain is axis2.

Access your weblogic domain direcrtory and start weblogic (Go to WebLogic_HOME/user_projects/domains/axis2/bin and run startWebLogic.sh)

Step 2

Download Axis2.war from here

Step 3

Create a directory in your file system (i.e:- /opt/axis2) and copy axis2.war to that directory. Extract axis2.war file (unzip axis2.war)

Step 4

Access WebLogic administration console (In a browser, access http://localhost:7001/console)

Log in to administration console (You should have configured username and password for admin console when creating your WebLogic domain)

Step 5

In the left navigation menu of the WebLogic administrative console, select Lock and Edit and click on Deployments.
Click on Install and Select the path of axis2 directory where we have extracted axis2.war file.



Click on Next.

Select the default option, Install this deployment as an application and click Next.

Accept the default settings in Optional Settings page and click on Next.

Click on Finish in the last page of the wizard.

Click Activate Changes in the left menu.

Step 6

Select Lock and Edit again and click on Deployments in weblogic admin console. You will see axis2 listed in the Deployments table.
Select axis2 and click on Start-->Servicing all requests.

In Start Deployments page, click on Yes.

Thats all for deploying Axis2 on Weblogic. Lets access axis2 admin console and validate the installation

Step 7

Now open a browser and go to http://localhost:7001/axis2
Axis2 welcome page will be displayed.

Step 8

Verify the status of installation. Click on 'Validate' link. You should see the following 'Axis2 Happiness' page.



Now you can log in to Axis2 administration page and start deploying services.

If you encounter any class loading issues with some of your services, configure the <prefer-web-inf-classes> element in WEB-INF/weblogic.xml as specified in Axis2 Application Server Specific Configuration Guide.

Saturday, May 10, 2008

Weblogic application classloading

We wanted to use our own stax parser implementation in a web application deployed on Weblogic 9.2. The user guides and BEA forums suggested two approaches.

1. Using weblogic.xml web application deployment descriptor with <prefer-web-inf-classes> element. Setting this to true allows a Web application to use our own version of a third-party class

2. Using filtering classloader
Here we are allowed to explicitly specify packages which are required to be loaded from the application. These packages can be listed in weblogic-application.xml

I tried both approaches separately in order to use wstx-asl-3.2.1.jar shipped with our application instead of loading weblogic stax parser.

Unfortunately, both class loading mechanisms failed to pick up our stax parser :(

We even tried to hack weblogic.jar by editing property files which tightly map the parser interface to the impl*. We extracted weblogic.jar and edited the stax impl class entries (i.e:- com.ctc.wstx.sax.WstxSAXParserFactory) of the following 4 files included in META-INF/services directory.
javax.xml.parsers.SAXParserFactory
javax.xml.stream.XMLEventFactory
javax.xml.stream.XMLInputFactory
javax.xml.stream.XMLOutputFactory

However, weblogic reported version conflicting issue when restarting server with the edited weblogic.jar.
I did not encounter these class loading problems with JBoss or tomcat. I'm uncertain about why it is such a pain in configuring a commercial product like Weblogic to use application specific packages.