Deploy application to Managed Server on 11g WebLogic Server (Part 2)

If you have finished setting up the managed server in the last blog post, you might run into a sip server error while starting the server as below:

Refer to Deploy application to Managed Server on 11g WebLogic Server (Part 1) if you need to catch up on the topic.

Error Code:”Parsing Failure in config.xml: java.lang.AssertionError: java.lang.ClassNotFoundException: com.bea.wcp.sip.management.descriptor.beans.SipServerBean

The reason why you can not start the managed server Server-1 is that the com.bea.wcp.sip.management.descriptor.beans.SipServerBean is not in classpath yet. Go to $WL_HOME/common/nodemanger and edit the file nodemanager.properties and set the variable StartScriptEnabled=true instead of the default false. Restart nodemanger and weblogic server. After that, you could successfully start the new mangerd server.

Deploy an application on to the managed server.

Click on Deployments under base_domain and then click Install under the Deployments table.

Specify the path where your deployment file would locate and then click next.

On the next page choose: Install this deployment as an application and then click next.

Now it comes to the page where we can choose our target server to deploy on. Here we choose Server-1.

I will go by defaults on the next two pages and then click Finish. You could adjust a bit according to different environments. 

After the new application is deployed, we could go back to Deployments table and check the state of the new application. If it were a successful deployment, the state should turn to be Active. Now it shows Failed meaning something is wrong during the deployment.

By looking at the log files, either nohup.out or Server-1.out,you might find similar errors like this:

Error Code:”Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: btm] Unable to build EntityManagerFactory

This is caused by NOTenabling JPA 2.0. My newapp needs to be running on top of three extra library files:hibernate-jpa-2.0-api-1.0.0.Final.jar,antlr-2.7.6.jar,commons-lang-2.4.jar. I will firstly copy these three jar files to $WL_HOME/common/lib/.In order to include them on to my managed Server Server-1, there are two ways to do that.

 Method 1

   Set the PRE_CLASSPATH to load extra jar files

   There are two places to set the PRE_CLASSPATH, which you have to take into consideration. If you only want to enable those library files on to your managed server, in my case Server-1, then just set the PRE_CLASSPATH in commEnv.sh which is under the directory:

$WL_HOME/common/bin

Insert the following statements into your commEnv.sh.

PRE_CLASSPATH=$WL_HOME/common/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar: $WL_HOME /raid/middleware/wlserver_10.3/common/lib/antlr-2.7.6.jar: $WL_HOME /raid/middleware/wlserver_10.3/common/lib/commons-lang-2.4.jar

Export PRE_CLASSPATH

Note: If you also want to deploy your application on to AdminServer. You also need to set the same PRE_CLASSPATH in startWebLogic.sh under:

$DOMAIN_HOME/startWebLogic.sh

   Set your managed server staging mode to be nostage

After you restert the managed server, you would see the status of the newly deployed application should automatically change to Active.

 Method 2

By setting up the PRE_CLASSPATH in commEnv.sh, that could include all the library files in it for any managed server you created. Suppose you need a more flexible and server-oriented method that for different managed server, you could include different library files. Instead of throwing all necessary library files in to PRE_CLASSPATH, you could also set the boot path. Let us talk about how to do that from frontend.

Go to the servers table and click on the managed server you just created.

It will take you to the settings for your newly created managed server, in this case “Server-1”. Go to Configuration->Server Start. Scroll down to the field of arguments. That is where you will put your path of your library files.

The arguments should look like below:

-Xbootclasspath/p:$WL_HOME/common/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar: $WL_HOME /common/lib/antlr-2.7.6.jar: $WL_HOME /common/lib/commons-lang-2.4.jar

By adding bootclasspath, JVM would load these files with a bootstrap classloader, which is separate from the system class loader. In this case before JVM even looks at the user defined CLASSPATH, those jar files mentioned in the bootclasspath would have already been loaded.

This method also requires the server staging mode being specified as nostage.

Deploy application to Managed Server on 11g WebLogic Server (Part 1)

This post is about the experiments I have done with 11g WebLogic Server recently. I was trying to deploy an web application on to a managed server instead of the default AdminServer. The main purpose is to have my web application deployed on to multiple servers that could be managed separately. I would break this topic into several blog posts in order to document as many pitfalls I have fell into for a better knowledge share. During the experiment, I ‘ve encountered with different types of failures that contained a lot clues which finally led me to the right path to a successfull deployment. Let us firstly start with some basic concepts of the terminologies involved and after that we would talk about more hands-on experience with it.

Kumar has this great post below to discuss the concepts briefly and clearly enough. Take a look at this post firstly if you want to kind of understand why we would configure the way as below:

  http://onlineappsdba.com/index.php/2008/07/24/domain-administration-managed-server-cluster-in-oracle-weblogic/

Create a new Managed Server on 11g WebLogic Server.

Firstly, log on to Administration Console. And then go to Servers under base_domain->Environments. Click on New at the servers table to create a new managed server.

Since AdminServer is taking the port 7001. I now switch to 7002

Then click Finish!! So now I have built one managed Server called Server-1 and I am trying to start the server. You might run into warning messages like below:

This message literally says you should associate the newly created managed server Server-1 with a physical machine and also reminds you that you have to start your Node Manager as well. So let us start with creating a physical machine and then associate the server with it.

Create a new physical Machine on 11g WebLogic Server.

Navigate back from the left panel which is under base_domain, click Machines.

Click New to add a new physical machine.

Fill in the information according to your platform. I call it Machine-1 for an example.

Enter the Listen Address.Mine is just the localhost. And then click Finish.

 

Now we have a physical machine ready to use.

Since Machine-1 is created successfully. And we are going to associate this physical machine to Server-1. Go back to Servers and click on the name Server-1 under servers table.

Now you would see Machine-1 in the drop down list and click on it to apply the machine. Navigate down to the bottom and click Save.

Go back to servers table and you would see the machine applied to the newly created managed server in the table.

Now we need to start Node Manager. Go to the terminal and access the path below:

$WL_HOME/server/bin

nohup ./startNodeManager &

Once the node manger is started and we could go back to frontend and start Server-1

 To be continued with problems starting Server-1 caused by sip server errors

[java.daily.notes]Use Firebug to debug Javascript on the fly

Step 1. You should have firefox browser handy. If not, you could download one from :

        http://www.mozilla.org/products/download.html?product=firefox-11.0&os=win&lang=en-US

Step 2. Once you get your firefox browser, you could then download firebug within the browser.

       Open Firefox browser and go to Tools-> Options

      

 

       Go to General and then click Manage Add-ons

    

      Look for firebug in the search criteria. And then click Install besides the plugin.

   Step 3.  Now you have firebug installed, you could start using firebug to debug the Javascript. You could find a small icon aside on the right corner of the browser and once you click that button, the firebug is invoked . However you could only debug one Javascript a time for one session.

       

   Normally firebug would show up at the bottom. When you choose Script, you have to click the blue link : Enable

 

    Now click Reload

   

 

     Say I navigate to the Javascript for senstive area that I would assume where a problem would be. And put the breakpoints on the left like below: You now see the buttons on the upper right corner are still greyed out because you have not invoke anything on the current web page.

  And when you invoke the corresponding fields on the webpage. It dynamically breaks to the line you set the breakpointes. Now you are ready to debug the Javascript step by step by clicking on the buttons on upper right corner.

      Like most of the debug tools. You could do mouse over to a perticular variable and you could validate from there and on the right panel. You could add or remove breakpoints and  watch the values of different variables. It is super useful for Javascript coders.

     Have fun and this is end of Instructions.Yay!!