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.

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s