Weblogic NodeManager issues

After installing Weblogic Server on many machines in order to create a cluster, we need to create a template in our AdminServer, after that, we have to make a template in order to transfer it to the rest of the servers. There are another way to do this, but I’ll leave this for other post.

Create the template

$ ~/Oracle/Middleware/wlserver_10.3/common/bin/pack.sh -managed=false -domain=../maleficarum/ -template=maleficarum.jar -template_name="maleficarum"

Once the template is created, we have to transfer it to the other ManagedServer via ssh, and then, restore the template:

$ ./Oracle/Middleware/wlserver_10.3/common/bin/unpack.sh -template=maleficarum.jar -domain=./Oracle/Middleware/user_projects/domains/maleficarum

After the replication of the template, we have to tart our AdminServer and enroll out managed server using WSLT :

$ cd ~/Oracle/Middleware/wlserver_10.3/common/bin
$ ./wlst.sh
Initializing WebLogic Scripting Tool (WLST) ...

wls:/offline> connect('weblogic','weblogic','t3://adminserver:7001')

wls:/maleficarum/serverConfig> nmEnroll('/home/usuario/Oracle/Middleware/user_projects/domains/maleficarum','/home/usuario/Oracle/Middleware/wlserver_10.3/common/nodemanager')

Enrolling this machine with the domain directory at /home/usuario/Oracle/Middleware/user_projects/domains/maleficarum ...
Successfully enrolled this machine with the domain directory at /home/usuario/Oracle/Middleware/user_projects/domains/maleficarum.

exit()

This will registrer out NodeManager in the cluster, and creates all the needed files; As first parameter pass the domain root directory and the second one is the nodemanager location.

Starting nodemanger

$ cd ~/Oracle/Middleware/wlserver_10.3/common/nodemanager
$ ./startNodeManager.sh

If we get the error “Native version is enabled but nodemanager native library could not be loaded“, we can edit the nodemanager.properties file as :

$ cd Oracle/Middleware/wlserver_12.1/common/nodemanager/
$ cat > nodemanager.properties
$ NativeVersionEnabled=false

From AdminServer console we now start all servers (domain > environment > servers > ManagedServer1 > control)

Weblogic Spring Console

Oracle Weblogic 12c, now includes a spring console to monitoring all spring beans enabled applications. In order to activate this feature you have to follow the next steps.

Activate spring console extension

  • In the preferences panel, extensions tab, select spring-console, using the checkbox, and click ‘Enable’.
  • Restar Weblogic to activate the extension.

Deploy weblogic-spring.jar.

  • Locate weblogic-spring.jar, located in ${WL_HOME}/server/lib
  • Deploy as library the jar using weblogic console.

Enable spring in your application.

  • As all spring enabled application, you have to include the spring listener in web.xml :
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring-config.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
</web-app>
  • Add WeblogicSpringApplicationListener in your spring context configuration file in order to generate all MBeans needed to display the beans in the enabled console.

<bean class=”weblogic.spring.monitoring.WeblogicSpringApplicationListener” />

  • Add or change the MANIFEST.MF file with the following lines

Extension-List: WeblogicSpring
WeblogicSpring-Extension-Name: weblogic-spring
WeblogicSpring-Specification-Version: 12.1.1.0
WeblogicSpring-Implementation-Version: 12.1.1.0

  • Deploy your application, and go to deployed app details, and navigate to SpringFramework tab to see the detailed spring configuration information.