Monthly Archive: January 2011

Finding jar files using JarScan

Sometimes we need to know in which jar file a particular class resides, and the location of that jar file.

We can find out using jarscan utility.

It can be downloaded from here

I had to find out which jar file contains this particular class

weblogic.security.spi.AuthenticationProviderV2

I downloaded the jar file from the link given above and placed in bea installation directory and executed the following command

java -jar jarscan.jar -class weblogic.security.spi.AuthenticationProviderV2

I got the output as follows

Looking for class(es): [weblogic.security.spi.AuthenticationProviderV2]

Processed 965 directories containing 22670 files
found 164 libraries under the directory: C:\bea1032\wlserver_10.3\server

1) ojdbc5.jar [C:\bea1032\wlserver_10.3\server\adr\ojdbc5.jar]
2) ojdbc6.jar [C:\bea1032\wlserver_10.3\server\adr\ojdbc6.jar]
3) mysql-connector-java-commercial-5.0.3-bin.jar [C:\bea1032\wlserver_10.3\server\ext\jdbc\mysql\mysql-connector-java-commercial-5.0.3-bin.jar]
4) ojdbc5.jar [C:\bea1032\wlserver_10.3\server\ext\jdbc\oracle\11g\ojdbc5.jar]
5) ojdbc5_g.jar [C:\bea1032\wlserver_10.3\server\ext\jdbc\oracle\11g\ojdbc5_g.jar]
6) ojdbc6.jar [C:\bea1032\wlserver_10.3\server\ext\jdbc\oracle\11g\ojdbc6.jar]
7) ojdbc6dms.jar [C:\bea1032\wlserver_10.3\server\ext\jdbc\oracle\11g\ojdbc6dms.jar]
8) ojdbc6_g.jar [C:\bea1032\wlserver_10.3\server\ext\jdbc\oracle\11g\ojdbc6_g.jar]
9) orai18n-mapping.jar [C:\bea1032\wlserver_10.3\server\ext\jdbc\oracle\11g\orai
18n-mapping.jar]
10) orai18n.jar [C:\bea1032\wlserver_10.3\server\ext\jdbc\oracle\11g\orai18n.jar]
11) weblogic-tags.jar [C:\bea1032\wlserver_10.3\server\ext\weblogic-tags.jar]
12) weblogic-vtags.jar [C:\bea1032\wlserver_10.3\server\ext\weblogic-vtags.jar]
13) jarscan.jar [C:\bea1032\wlserver_10.3\server\jarscan.jar]
14) api.jar [C:\bea1032\wlserver_10.3\server\lib\api.jar]
15) aqapi.jar [C:\bea1032\wlserver_10.3\server\lib\aqapi.jar]
16) bea_wls_async_response.jar [C:\bea1032\wlserver_10.3\server\lib\bea_wls_async_response.jar]
17) bea_wls_remote_deployer.jar [C:\bea1032\wlserver_10.3\server\lib\bea_wls_remote_deployer.jar]
18) wlUserConfigCompatibility.jar [C:\bea1032\wlserver_10.3\server\lib\compatibility\wlUserConfigCompatibility.jar]
19) compatibility-security-l10n.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\autodeploy\compatibility-security-l10n.jar]
20) compatibility-security.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\autodeploy\compatibility-security.jar]
21) core-connector.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\autodeploy\core-connector.jar]
22) core-ejb.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\autodeploy\core-ejb.jar]
23) core-jms.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\autodeploy\core-jms.jar]
24) jolt-l10n.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\autodeploy\jolt-l10n.jar]
25) jolt.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\autodeploy\jolt.jar]
26) wtc-l10n.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\autodeploy\wtc-l10n.jar]
27) wtc.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\autodeploy\wtc.jar]

28) diagnostics-console-extension-l10n.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\diagnostics-console-extension-l10n.jar]
29) diagnostics-console-extension.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\diagnostics-console-extension.jar]
30) spring-console-l10n.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\spring-console-l10n.jar]
31) spring-console.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\spring-console.jar]
32) weblogic-sca-console.jar [C:\bea1032\wlserver_10.3\server\lib\console-ext\weblogic-sca-console.jar]
33) com.bea.core.process_5.4.0.0.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\com.bea.core.process_5.4.0.0.jar]
34) commons-beanutils.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\commons-beanutils.jar]
35) commons-codec-1.3.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\commons-codec-1.3.jar]
36) commons-digester.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\commons-digester.jar]
37) commons-fileupload.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\commons-fileupload.jar]
38) commons-logging-1.0.4.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\commons-logging-1.0.4.jar]
39) commons-validator.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\commons-validator.jar]
40) jakarta-oro.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\jakarta-oro.jar]
41) jstl.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\jstl.jar]
42) log4j-1.2.8.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\log4j-1.2.8.jar]
43) netuix_common.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\netuix_common.jar]
44) netuix_schemas.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\netuix_schemas.jar]
45) netuix_system.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\netuix_system.jar]
46) p13n-schemas.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\p13n-schemas.jar]
47) p13n_common.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\p13n_common.jar]
48) p13n_system.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\p13n_system.jar]
49) standard.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\standard.jar]
50) struts.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\struts.jar]
51) wsrp-client.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\wsrp-client.jar]
52) wsrp-common.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\APP-INF\lib\wsrp-common.jar]
53) beehive-netui-core.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\beehive-netui-core.jar]
54) beehive-netui-tags.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\beehive-netui-tags.jar]
55) console.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\console.jar]
56) jh.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\jh.jar]
57) l10n_taglib.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\l10n_taglib.jar]
58) netuix_common_web.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\netuix_common_web.jar]
59) netuix_servlet.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\netuix_servlet.jar]
60) prefs-spi.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\prefs-spi.jar]
61) render_taglib.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\render_taglib.jar]
62) skeleton_taglib.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\skeleton_taglib.jar]
63) standard.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\standard.jar]
64) struts-adapter.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\struts-adapter.jar]
65) struts.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\consolehelp\WEB-INF\lib\struts.jar]
66) beehive-controls.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\beehive-controls.jar]
67) beehive-netui-core.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\beehive-netui-core.jar]
68) beehive-netui-tags.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\beehive-netui-tags.jar]
69) client_taglib.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\client_taglib.jar]
70) console-de.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-de.jar]
71) console-es.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-es.jar]
72) console-fr.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-fr.jar]
73) console-it.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-it.jar]
74) console-ja.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-ja.jar]
75) console-ko.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-ko.jar]
76) console-page-spec.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-page-spec.jar]
77) console-pt_BR.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-pt_BR.jar]
78) console-zh_CN.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-zh_CN.jar]
79) console-zh_TW.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console-zh_TW.jar]
80) console.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\console.jar]
81) faces-adapter.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\faces-adapter.jar]
82) jsf-api.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\jsf-api.jar]
83) jsf-impl.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\jsf-impl.jar]
84) l10n_taglib.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\l10n_taglib.jar]
85) netui-adapter.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\netui-adapter.jar]
86) netuix_common_web.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\netuix_common_web.jar]
87) netuix_servlet.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\netuix_servlet.jar]
88) prefs-spi.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\prefs-spi.jar]
89) render_taglib.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\render_taglib.jar]
90) skeleton_taglib.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\skeleton_taglib.jar]
91) standard.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\
lib\standard.jar]
92) struts-adapter.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\struts-adapter.jar]
93) struts.jar [C:\bea1032\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF\lib\struts.jar]
94) diagnostics-agent.jar [C:\bea1032\wlserver_10.3\server\lib\diagnostics-agent.jar]
95) EccpressoAsn1.jar [C:\bea1032\wlserver_10.3\server\lib\EccpressoAsn1.jar]
96) EccpressoCore.jar [C:\bea1032\wlserver_10.3\server\lib\EccpressoCore.jar]
97) EccpressoJcae.jar [C:\bea1032\wlserver_10.3\server\lib\EccpressoJcae.jar]
98) jcom.jar [C:\bea1032\wlserver_10.3\server\lib\jcom.jar]
99) jmsadapter.jar [C:\bea1032\wlserver_10.3\server\lib\jms-local-adp\jmsadapter.jar]
100) jmsadapter.jar [C:\bea1032\wlserver_10.3\server\lib\jms-notran-adp\jmsadapter.jar]
101) jmsadapter.jar [C:\bea1032\wlserver_10.3\server\lib\jms-notran-adp51\jmsadapter.jar]
102) jmsadapter.jar [C:\bea1032\wlserver_10.3\server\lib\jms-xa-adp\jmsadapter.jar]
103) jms51-interop.jar [C:\bea1032\wlserver_10.3\server\lib\jms51-interop.jar]
104) jrmp.jar [C:\bea1032\wlserver_10.3\server\lib\jrmp.jar]
105) jrmpclient.jar [C:\bea1032\wlserver_10.3\server\lib\jrmpclient.jar]
106) jsafeFIPS.jar [C:\bea1032\wlserver_10.3\server\lib\jsafeFIPS.jar]
107) cssWlSecurityProviders.jar [C:\bea1032\wlserver_10.3\server\lib\mbeantypes\cssWlSecurityProviders.jar]
108) saml2CredentialMapper.jar [C:\bea1032\wlserver_10.3\server\lib\mbeantypes\saml2CredentialMapper.jar]
109) saml2IdentityAsserter.jar [C:\bea1032\wlserver_10.3\server\lib\mbeantypes\saml2IdentityAsserter.jar]
110) systemPasswordValidatorProvider.jar [C:\bea1032\wlserver_10.3\server\lib\mbeantypes\systemPasswordValidatorProvider.jar]
111) wlManagementImplSource.jar [C:\bea1032\wlserver_10.3\server\lib\mbeantypes\wlManagementImplSource.jar]
112) wlManagementMBean.jar [C:\bea1032\wlserver_10.3\server\lib\mbeantypes\wlManagementMBean.jar]
113) xacmlSecurityProviders.jar [C:\bea1032\wlserver_10.3\server\lib\mbeantypes\xacmlSecurityProviders.jar]
114) mejb.jar [C:\bea1032\wlserver_10.3\server\lib\mejb.jar]
115) mysql-connector-java-commercial-5.0.3-bin.jar [C:\bea1032\wlserver_10.3\ser
ver\lib\mysql-connector-java-commercial-5.0.3-bin.jar]
116) ojdbc6.jar [C:\bea1032\wlserver_10.3\server\lib\ojdbc6.jar]
117) diagnostics-binding.jar [C:\bea1032\wlserver_10.3\server\lib\schema\diagnostics-binding.jar]
118) diagnostics-image-binding.jar [C:\bea1032\wlserver_10.3\server\lib\schema\diagnostics-image-binding.jar]
119) weblogic-domain-binding-compatibility.jar [C:\bea1032\wlserver_10.3\server\lib\schema\weblogic-domain-binding-compatibility.jar]
120) weblogic-domain-binding.jar [C:\bea1032\wlserver_10.3\server\lib\schema\weblogic-domain-binding.jar]
121) weblogic-de.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-de.jar]
122) weblogic-es.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-es.jar]
123) weblogic-fr.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-fr.jar]
124) weblogic-it.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-it.jar]
125) weblogic-ja.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-ja.jar]
126) weblogic-ko.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-ko.jar]
127) weblogic-L10N.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-L10N.jar]
128) weblogic-pt_BR.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-pt_BR.jar]

129) weblogic-spring.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-spring.jar]
130) weblogic-zh_CN.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-zh_CN.jar]
131) weblogic-zh_TW.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic-zh_TW.jar]
132) weblogic.jar [C:\bea1032\wlserver_10.3\server\lib\weblogic.jar]
133) webserviceclient+ssl.jar [C:\bea1032\wlserver_10.3\server\lib\webserviceclient+ssl.jar]
134) webserviceclient.jar [C:\bea1032\wlserver_10.3\server\lib\webserviceclient.jar]
135) webservices.jar [C:\bea1032\wlserver_10.3\server\lib\webservices.jar]
136) wl-j2ee-client.jar [C:\bea1032\wlserver_10.3\server\lib\wl-j2ee-client.jar]
137) wlcipher.jar [C:\bea1032\wlserver_10.3\server\lib\wlcipher.jar]
138) wlclient.jar [C:\bea1032\wlserver_10.3\server\lib\wlclient.jar]
139) wlcommons-logging.jar [C:\bea1032\wlserver_10.3\server\lib\wlcommons-logging.jar]
140) wlconnector.jar [C:\bea1032\wlserver_10.3\server\lib\wlconnector.jar]
141) wldb2.jar [C:\bea1032\wlserver_10.3\server\lib\wldb2.jar]
142) wldeploy.jar [C:\bea1032\wlserver_10.3\server\lib\wldeploy.jar]
143) wlinformix.jar [C:\bea1032\wlserver_10.3\server\lib\wlinformix.jar]
144) wljarbuilder.jar [C:\bea1032\wlserver_10.3\server\lib\wljarbuilder.jar]
145) wljmsclient.jar [C:\bea1032\wlserver_10.3\server\lib\wljmsclient.jar]
146) wljmxclient.jar [C:\bea1032\wlserver_10.3\server\lib\wljmxclient.jar]
147) wllog4j.jar [C:\bea1032\wlserver_10.3\server\lib\wllog4j.jar]
148) wlnmclient.jar [C:\bea1032\wlserver_10.3\server\lib\wlnmclient.jar]
149) wls-api.jar [C:\bea1032\wlserver_10.3\server\lib\wls-api.jar]
150) wlsafclient.jar [C:\bea1032\wlserver_10.3\server\lib\wlsafclient.jar]
151) wlsqlserver.jar [C:\bea1032\wlserver_10.3\server\lib\wlsqlserver.jar]
152) wlsybase.jar [C:\bea1032\wlserver_10.3\server\lib\wlsybase.jar]
153) wlthint3client.jar [C:\bea1032\wlserver_10.3\server\lib\wlthint3client.jar]
154) wlw-langx-ja.jar [C:\bea1032\wlserver_10.3\server\lib\wlw-langx-ja.jar]
155) wlw-langx-ko.jar [C:\bea1032\wlserver_10.3\server\lib\wlw-langx-ko.jar]
156) wlw-langx-zh_CN.jar [C:\bea1032\wlserver_10.3\server\lib\wlw-langx-zh_CN.jar]
157) wlw-langx-zh_TW.jar [C:\bea1032\wlserver_10.3\server\lib\wlw-langx-zh_TW.jar]
158) wlw-langx.jar [C:\bea1032\wlserver_10.3\server\lib\wlw-langx.jar]
159) wlw-wsee-soapfault.jar [C:\bea1032\wlserver_10.3\server\lib\wlw-wsee-soapfault.jar]
160) wseeclient.jar [C:\bea1032\wlserver_10.3\server\lib\wseeclient.jar]
161) wseejb.jar [C:\bea1032\wlserver_10.3\server\lib\wsee_scj\wseejb.jar]
162) wsse.jar [C:\bea1032\wlserver_10.3\server\lib\wsse.jar]
163) xmlx.jar [C:\bea1032\wlserver_10.3\server\lib\xmlx.jar]
164) xqrl.jar [C:\bea1032\wlserver_10.3\server\lib\xqrl.jar]

searching these jarfiles now ….

===============================================
Found: weblogic.security.spi.AuthenticationProviderV2
Class: weblogic.security.spi.AuthenticationProviderV2
Package: weblogic.security.spi
Library Name: wls-api.jar
Library Path: C:\bea1032\wlserver_10.3\server\lib\wls-api.jar
===============================================

Search took: 10286 milliseconds.

Enabling and Disabling Weblogic Admin Console

Disabling and Enabling Admin Console

Many at times for most of our administration work including the changes (deployments, start/stop of servers, etc) or configurations (JMS, creation/deletion/editing of our servers, etc) we use our weblogic admin console.

But, for security reasons some of the banking companies for its core banking applications prefer to disable the admin console in its banking applications.

This short and sweet article mainly targets to present you on how to enable and disable your admin console:

Disabling your Admin Console:

We can disable our weblogic admin console in two different ways

1)      Admin console

2)      Weblogic Scripting Tool

From Admin console:-

To disable access to the Administration Console:

  1. After you log in to admin console click Lock & Edit.
  2. In the left pane of the Console, under Domain Structure, select the domain name.
  3. Select Configuration > General, and click Advanced at the bottom of the page.
  4. Deselect Console Enabled.
  5. Click Save.
  6. To activate these changes, click Activate Changes.

From WLST:-

connect(“weblogic“,”weblogic“,”t3://localhost:7001“)

edit()

startEdit()

cmo.setConsoleEnabled(false)

save()

activate()

disconnect()

exit()

Enabling the Admin Console:

After we disable the admin console we can enable it again by using WLST.

Following are the steps on the same:

connect(“weblogic“,”weblogic“,”t3://localhost:7001“)

edit()

startEdit()

cmo.setConsoleEnabled(true)

save()

activate()

disconnect()

exit()

Note: Here,

1)      weblogic and weblogic are the user id and password of admin console.

2)      t3://localhost:7001 is the admin console URL

3)      After we enable/disable the admin console RESTART your admin server

Monitoring JDBC Datasource Runtime Attributes using WLST

Step 1 :- Set the environment

C:\bea103\user_projects\domains\prpc612\bin>setDomainEnv.bat

Step 2:- Connect to server and browse to the JDBCDataSourceRuntime MBean

C:\bea103\user_projects\domains\prpc612>java weblogic.WLST

Initializing WebLogic Scripting Tool (WLST) …

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> connect()
Please enter your username [weblogic] :
Please enter your password [weblogic] :
Please enter your server URL [t3://localhost:7001] :t3://localhost:7003
Connecting to t3://localhost:7003 with userid weblogic …
Successfully connected to managed Server ‘MS0’ that belongs to domain ‘prpc612’.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

wls:/prpc612/serverConfig> serverRuntime()
Location changed to serverRuntime tree. This is a read-only tree with ServerRunt
imeMBean as the root.
For more help, use help(serverRuntime)
wls:/prpc612/serverRuntime> cd(‘JDBCServiceRuntime’)
wls:/prpc612/serverRuntime/JDBCServiceRuntime> cd(‘MS0’)
wls:/prpc612/serverRuntime/JDBCServiceRuntime/MS0> cd(‘JDBCDataSourceRuntimeMBeans’)
wls:/prpc612/serverRuntime/JDBCServiceRuntime/MS0/JDBCDataSourceRuntimeMBeans> cd(‘MyDs’)
gaRules> cmo.getActiveConnectionsCurrentCount()
1

The other JDBC Datasource Runtime attributes that can be monitored are listed below.

wls:/prpc612/serverRuntime/JDBCServiceRuntime/MS0/JDBCDataSourceRuntimeMBeans/PegaRules> ls()
dr– JDBCDriverRuntime
dr– LastTask
dr– WorkManagerRuntimes

-r– ActiveConnectionsAverageCount 1
-r– ActiveConnectionsCurrentCount 0
-r– ActiveConnectionsHighCount 5
-r– ConnectionDelayTime 627
-r– ConnectionsTotalCount 5
-r– CurrCapacity 5
-r– CurrCapacityHighCount 4
-r– DeploymentState 2
-r– Enabled true
-r– FailedReserveRequestCount 0
-r– FailuresToReconnectCount 0
-r– HighestNumAvailable 5
-r– HighestNumUnavailable 0
-r– LastTask null
-r– LeakedConnectionCount 0
-r– ModuleId PegaRules
-r– Name PegaRules
-r– NumAvailable 5
-r– NumUnavailable 0
-r– PrepStmtCacheAccessCount 11852
-r– PrepStmtCacheAddCount 420
-r– PrepStmtCacheCurrentSize 50
-r– PrepStmtCacheDeleteCount 370
-r– PrepStmtCacheHitCount 11432
-r– PrepStmtCacheMissCount 420
-r– Properties {serverName=localhost, SID=prpc612, portNumber=1521, user=SYSTEM}
-r– ReserveRequestCount 11844
-r– State Running
-r– Type JDBCDataSourceRuntime
-r– VersionJDBCDriver oracle.jdbc.OracleDriver
-r– WaitSecondsHighCount 0
-r– WaitingForConnectionCurrentCount 0
-r– WaitingForConnectionFailureTotal 0
-r– WaitingForConnectionHighCount 0
-r– WaitingForConnectionSuccessTotal 4
-r– WaitingForConnectionTotal 0
-r– WorkManagerRuntimes null

-r-x clearStatementCache Void :
-r-x dumpPool Void :
-r-x dumpPoolProfile Void :
-r-x forceShutdown Void :
-r-x forceSuspend Void :
-r-x poolExists Boolean : String(name)
-r-x preDeregister Void :
-r-x reset Void :
-r-x resume Void :
-r-x shrink Void :
-r-x shutdown Void :
-r-x start Void :
-r-x suspend Void :
-r-x testPool String :

Encrypting JBoss Database Cleartext Passwords

I was planning to write this article for past two days but I was in dilemma whether to post this article or not. Its not that this article is not helpful, but there are already many good articles on this subject on internet currently. I had even tried to automate this feature, so that we can present an article which is different all the existing articles but automation was more complex than manual steps, thanks to variable factors such as “types of datasources(xa,non xa, local xa etc)”, “properties of -ds.xml file”, “different types of databases mysql, oracle, ms sql”.So automation would make the subject complex, I will update this post with automation files if I am able to write elegant code.

Finally we want “weblogic-wonders” to be one of the site to stop by, for all “middleware” enthusiasts, so we decided to post this article.

Prequisites :-

  • Set the JAVA_HOME variable.
  • Test the JDBC Connection URL in any sql client.
  • Take back up of “JBOSS_HOME/server/<serverName>/conf/login-config.xml” in another directory which is outside “JBOSS_HOME”.
  • Copy the respective driver “jar” file to the “JBOSS_HOME/server/<serverName>/lib”. For MySql I had copied “mysql-connector-java-5.1.6.jar” and for Oracle I had copied “ojdbc6.jar” jar file.
  • JBOSS_HOME :- I had this used this “word” many times in below post, this is the location where we had installed installed JBoss. For example on my machine “JBOSS_HOME” is  “/vasvijay/jboss/jboss-eap-5.0/jboss-as”.

Downloads :-

You can download the “xml” files from “http://weblogic-wonders.com/weblogic/wp-content/uploads/2011/01/VASDSPasswordEncryption.zip”.

Execution :-

In order to encrypt the database password, we will perform below 7 steps.

Step 1:- Encrypt the database password.

a) “cd” to the “JBOSS_HOME” and execute the below the command.

java -cp client/jboss-logging-spi.jar:common/lib/jbosssx.jar org.jboss.resource.security.SecureIdentityLoginModule <passwordYouWantToEncrypt>

Note :- Make sure “JBOSS_HOME/client/jboss-logging-spi.jar” and “JBOSS_HOME/common/lib/jbosssx.jar” exists.

Step 2 :- Create “-ds.xml” file. Make sure the file name has extension “-ds.xml”, if not the datasource will not be deployed.

Below is the sample xml file. I had just used basic minimal properties to test this feature. In real time we can add many additional properties/tags such as “min-pool-size”,”max-pool-size”,”prepared-statement-cache-size”. Please check “JBoss wiki” documentation for more details on this.

<datasources>
<local-tx-datasource>
<jndi-name>VASDS</jndi-name>
<connection-url>jdbc:oracle:thin:localhost:1521/vasDB1</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<security-domain>VASEncryptedDS</security-domain>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>

local-tx-datasource :- This elements specifies that we are using “LocalTXConnectionManager” service. Other types include

a) xa-datasource

b) no-tx-datasource

c) ha-local-tx-datasource

d) ha-xa-datasource

jndi-name :- jndiname, we can access this resource in the context “java:/” unless we specify “use-java-context” to “false”.

connection-url :- This is simple connection string using Oracle Thin Driver, which connects to local database host “localhost” and database “vasDB1”. Please test this connection string in sqlclient before using, in this way we can avoid all issues related to connection string before itself.

driver-class :- Oracle Driver Class.

security-domain :- The “security domain name” defined in “JBOSS_HOME/server/<serverName>/conf”. This name should exactly match “application-policy” tag “name” attribute.

exception-sorter-class-name :- specifies a class which implements “org.jboss.resource.adapter.jdbc.ExceptionSorter“, to examine database exceptions to determine whether or not the exception indicates a connection error.

type-mapping :- specifies Oracle9i type mapping for Oracle 10g datasource configuration.

Step 3:- Update “JBOSS_HOME/server/<serverName>/conf/login-config.xml”. This is the JAAS login configuration file.  We will be adding new security domain called as “VASEncryptedDS”.

Append below lines in “login-config.xml” at the end just before “</policy>”.

<application-policy name=”VASEncryptedDS”>
<authentication>
<login-module code=”org.jboss.resource.security.SecureIdentityLoginModule” flag=”required”>
<module-option name=”username”>vasTest</module-option>
<module-option name=”password”>ENCRYPTEDPASSWORD_USING_STEP1</module-option>
<module-option name=”managedConnectionFactoryName”>jboss.jca:name=VASDS,service=LocalTxCM</module-option>
</login-module>
</authentication>
</application-policy>

login-module :- the attribute “code” defines the class which will be used for “authentication”. The attribute “flag” with value “required” defines that user needs to pass this authentication.

module-option :-

name :- database “username” password.

password :- Encrypted password using “step 1”.

managedConnectionFactoryName :- MBean name of Connection Manager. if you are not sure what this name should be login in “jmx-console”, click on “jboss.jca” on left hand column. Take any of the string on right and construct this string.

Step 4:- Copy the latest “login-config.xml” to the directory “JBOSS_HOME/server/<serverName>/conf” directory.

Step 5 :- Copy the “VASEncrypted-ds.xml” to the directory “JBOSS_HOME/server/<serverName>/deploy” directory.

Note :- The Step 2 “xml” file can be saved with any name with the extension “-ds.xml”. I had just named my file as “VASEncrypted-ds.xml”.

Step 6 :- Restart the server. Since we had edited the “login-config.xml” in “JBOSS_HOME/server/<serverName>/conf” we need to start the server.

Step 7 :- Validate, if the Datasource had been deployed successfully.

Method1 :- while the server is starting you will find below entry in the log.

09:11:51,353 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager ‘jboss.jca:service=DataSourceBinding,name=VASDS’ to JNDI name
‘java:VASDS’

Method 2:- Login into “jmx-console” and click on “jboss.jca” entry on left side column. You should see “VASDS” entries on right side column.

Method 3 :-

./twiddle.sh -s jnp://icdusdartapp01:1099 -u admin -p admin get ‘jboss.jca:name=VASDS,service=LocalTxCM’ ManagedConnectionPool

Note :- There are couple of other methods “web-console”,”admin-console” etc.

Note :- For in depth detail on “twiddle”, please read the article “http://weblogic-wonders.com/weblogic/2010/12/22/jboss-command-line-utility-twiddle/”

Common Errors :-

  • In correct “database” “username” and “password”.
  • Database not running.
  • The database port blocked by firewall.

References :-

As you usual, my most favorite website(Google) has solution for every issue. Entire solution for this issue is based on research from sites returned by Google. If I had missed any site, please comment, I will be adding the site to the references. I apologize in advance for not mentioning the site in ‘references’, this was done unintentionally.

Google.com :- Search words ‘jboss datasource password encryption’

http://docs.jboss.org

http://community.jboss.org/wiki/encryptingdatasourcepasswords

Thanks,

Weblogic-Wonders Team

Dream, Learn, Share and Inspire !

Disclaimer :-

I had tested the above steps on Linux, Windows XP for the databases “MySql”,”Oracle”. Please take backup of important files before execution. Do let me know if there are any typographical mistakes or if I had missed any step.

Working with JMS and the Standard Issues in JMS

Java Messaging Service acronymised as JMS is popular in both development and administration world. Different vendors have got different implementations for this JMS API. Oracle Weblogic Server implements this JMS for communication between two different weblogic server domains. This implementation although looks simple but its usage is very high (especially if you are working for a telecom domain).

In the process of implementation of this we get many issues. This article mainly targets to the standard issues of JMS for which, most of us take the assistance from Oracle BEA customer support by raising tickets with them as Sev2 or Sev1.

 

Standard Issue -1: JMS Messages Redelivery

Why does a JMS message get redelivered?

The JMS Server could redeliver messages because of any of the following reasons:

  • A java.lang.Error or java.lang.RuntimeException has been thrown from the Receiver/MDB’s onMessage method
  • User has made a call to ejbcontext.setRollbackOnly() in his MDB’s onMessage method (this applies to Container Managed Transaction only)
  • MDB participating in a Transaction failed for some reason. For example, if the MDB calls another EJB, which makes a JDBC call and the database operation fails. In this case the transaction in which MDB is participated will be rolled back and the message will be redelivered.
  • MDB is transactional but takes a long time to process, the transaction monitor will timeout the transaction and rolls it back – consequently, JMS will redeliver the message.
  • Slow down in the server process. This could happen because of a poison message.
  • User has made a call to Session.recover() from a standalone receiver
  • Session.acknowledgement() is not called from a standalone receiver with client acknowledgement

Application Coding Diagnostics

Add the following code snippet to the receiver’s onMessage method to find out if the message is being redelivered.

Public void onMessage (javax.jms.Messsage msg)

{

try{

System.out.println (“Mesg ID:”+msg.getJMSMessageID ());

System.out.println (“Is Message redelivered:”+msg.getJMSRedelivered ());

}

}

If the same message ID is getting printed multiple times and the JMSRedelivered() flag is returning true, then it confirms that the messages are getting redelivered.

Checklist for Troubleshooting JMS Redelivery Problems

  • Check the receiver type – is it an MDB, Standalone Synchronous, Asynchronous Receiver?
  • Check the acknowledgement options of the receiver:
    • Are Acknowledgement-modes, Transacted Sessions, orBean Managed being used?
    • Transactions or container managed transactions?
  • In case of MDBs with CMT, BMT or standalone receivers, verify whether the onMethod () is returned successfully.
  • If there’s a java.lang.Error or java.lang.RuntimeException thrown from the standalone receiver’s/MDB’s onMessage() method then the JMS server did not receive the acknowledgement and the message will be redelivered by the JMS Server.
  • If the MDB (CMT only) calls ejbcontext.setRollbackOnly() this will force the JMS Server to redeliver the message, as the transaction has been marked for rollback.
  • In the case of an MDB invoking an EJB (Session or Entity) that involves a JDBC call and if the DB operation fails for some unknown reasons the transaction in which MDB is enlisted will be rolled back and message gets redelivered. To avoid this problem, investigate the problems on the EJB side.
  • In the case of long running processes in the MDB’s onMessage() method (CMT only) the transaction will be timed out and it will be rolled back. Consequently the JMS Server will redeliver the message.
  • JMS message redelivery mostly happens due to the application coding errors. By enabling the following debug flags, the root cause of message redelivery can be found.
    • DebugJMSMessagePath=”true”  DebugJMSXA=”true”
    • In the config.xml, under the ServerDebug tag of the each Server tag, set the following debug flags:
      • <ServerDebug DebugJMSXA=”true” DebugJMSMessagePath=”true” />
      • Make sure the stdOutSeverity level of the server is INFO and StdoutDebugEnabled is set to “true”.
  • If the session.recover() is invoked with CLIENT_ACKNOWLEDGE Mode (standalone receivers only), the JMS Server stops message delivery in this session, and restarts message delivery with the oldest unacknowledged message.
  • The following parameters may be configured for a JMS destination to avoid poison messages.
    • Redelivery Delay Time
      When a message is rolled back or recovered, the redelivery delay is the amount of time a message is put aside before an attempt is made to redeliver the message.
    • Redelivery Limit
      Redelivery limit is the number of times JMS server will try to redeliver the message to the receiver/MDB
    • Error Destination
      If the JMS server tried to redeliver more than “Redelivery Limit”, then the JMS Server will forward these undelivered messages to the ‘Error Destination’.If the error destination is not configured, and a message exceeds its redelivery limit, that  message is simply deleted.
  • Another way of debugging this problem is to print/log the exceptions in onMessage() method. The following code snippet will log an exception stack trace and also re-throws the exception from receiver’s onMessage() method.

public void onMessage(Message msg) {
try {
TextMessage tm = (TextMessage) msg;
String text = tm.getText();
System.out.println(“Msg: ” + text+” Mesg ID:”+msg.getJMSMessageID());
}
catch(JMSException ex) {
ex.printStackTrace();
}
catch(java.lang.RuntimeException ey) {
ey.printStackTrace();
throw ey;
}
catch(java.lang.Error ez) {
ez.printStackTrace();
throw ez;
}
}

Understanding JMS Message Redelivery Debug Info

The JMS debug flags DebugMessagePath and DebugJMSXA provide more details about the root cause of the message redelivery problem. DebugMessagePath will help identify if the message is getting redelivered or not.

<Feb 3, 2004 5:01:25 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging MSG_PATH!
BACKEND/BEQueue: Assigning to the backend consumer, message ID:P<802808.1075856485894.0>>

<Feb 3, 2004 5:01:25 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging MSG_PATH!
BACKEND/BEQueue: Adding backend session’s unacked message list,
message ID:P<802808.1075856485894.0>>

<Feb 3, 2004 5:01:25 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging MSG_PATH!
BACKEND/BEQueue: Dispatching to the frontend, message ID:P<802808.1075856485894.0>>

<Feb 3, 2004 5:01:25 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging MSG_PATH!
FRONTEND/FESession (id: <576180353183090550.27>) :
Pushing to the client, message ID:P<802808.1075856485894.0>>
>>Print From the onMessage method: I am the MESSAGE, MsgID: ID:P<802808.1075856485894.0>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<Feb 3, 2004 5:02:05 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging MSG_PATH!
BACKEND/BEQueue: Assigning to the backend consumer, message ID:P<802808.1075856485894.0>>

<Feb 3, 2004 5:02:05 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging MSG_PATH!
BACKEND/BEQueue: Adding backend session’s unacked message list,
message ID:P<802808.1075856485894.0>>

<Feb 3, 2004 5:02:05 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging MSG_PATH!
BACKEND/BEQueue: Dispatching to the frontend, message ID:P<802808.1075856485894.0>>

<Feb 3, 2004 5:02:05 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging MSG_PATH!
FRONTEND/FESession (id: <576180353183090550.34>) :
Pushing to the client, message ID:P<802808.1075856485894.0>>
>>Print From the onMessage method: I am the MESSAGE, MsgID: ID:P<802808.1075856485894.0>From the above debug output, it can be seen that the same message is pushed multiple times to the receiver.

NOTE: This debug flag works in WLS 8.1 and later releases.

DebugJMSXA will help identify if the message is redelivered due to transaction related problems.

<Feb 3, 2004 5:16:10 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging XA ! XA(25421973,1007511,0000013BC2697F28EDB9) >RM-rollback() >

<Feb 3, 2004 5:16:10 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging XA ! XA(25421973,1007511,0000013BC2697F28EDB9) >TE-recv-startRollback() (TE-recv hash=31838215 xid=0000013BC2697F28EDB9 mId=<712671.1075857330638.0> queue=TestDest)>

<Feb 3, 2004 5:16:10 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging XA ! XA(25421973,1007511,0000013BC2697F28EDB9) <TE-recv-startRollback() (TE-recv hash=31838215 xid=0000013BC2697F28EDB9 mId=<712671.1075857330638.0> queue=TestDest)OK>

<Feb 3, 2004 5:16:10 PM PST> <Debug> <JMS> <BEA-040002> <JMS Debugging XA ! XA(25421973,27221567,0000013BC2697F28EDB9) >RM-rollback() >

Background

Once a JMS message is delivered to the consumer(s), JMS Server waits for acknowledgement from the consumer(s). There are four ways in which a consumer can send acknowledgement to the JMS Server:

  1. Transacted Sessions
  2. Container Managed Transactions
  3. Bean Managed Transactions (or) User Transaction
  4. Acknowledgement modes

 

Transacted Sessions

When JMS Transacted sessions are used for sending/receiving JMS messages, internally a local transaction is started. The scope of this transaction is limited to send/receive operations within this session. When the receiver/consumer uses Transacted session, message redelivery depends on commit/rollback call on the session. The receiver’s rollback call on the session will make the messages redelivered by the JMS server. The JMS Transacted Session’s transaction will not have any effect outside the scope of this session. Therefore, it cannot participate in the external transaction (BMT or CMT) (as far as it is not XA aware).

Container Managed Transaction (CMT)

Container Managed Transactions apply for Message Driven Beans. In order to run a MDB in container managed transaction, <transaction-type> tag in ejb-jar.xml and <transaction attribute> in weblogic-ejb-jar.xml should be set to “Container” and “Required” respectively. For example:

Before pulling the message from the destination, EJB container starts a transaction and delivers it to the MDB. Once the onMessage() method returns successfully without any exception, the transaction is committed by the container. EJB container is responsible for begin, commit and rollback for this transaction. If the TX gets rolled back for any reason, JMS server is required to immediately redeliver the message to the next available consumer.

Bean Managed Transaction (BMT) or User Transaction

Bean Managed Transactions apply for both MDBs and standalone consumers. For bean managed or User Transaction, the application code should take the responsibility for begin, commit, or rollback of the transaction. The following sample code snippet creates a User Transaction.

UserTransaction tx1 =(UserTransaction)context.lookup(“javax.transaction.UserTransaction”)
public void onMessage(Message msg)  {
try {
tx1.begin();
String msgText = ((TextMessage)msg).getText();
System.out.println(“Mesg ID:”+msg.getJMSMessageID()+”msg:”+msgText);
tx1.commit();
} catch (Exception jmse) {
jmse.printStackTrace();
}
}

In order to configure a MDB to run in Bean-Managed Transaction, the <transaction-type> tag value in ejb-jar.xml should be set to “Bean”.

In BMT, since the transaction started within MDB, pulling the message from the destination is not part of the transaction. Therefore, the outcome of the transaction, whether commit or rollback, has no impact on message redelivery. Even if the transaction is rolled back, the message is not redelivered.

Acknowledgement Modes

Acknowledgement Mode may be specified while creating a JMS session. Acknowledgement Mode may be set to any of the following values:

  • AUTO_ACKNOWLEDGE
  • DUPS_OK_ACKNOWLEDGE
  • CLIENT_ACKNOWLEDGE

The following sample code snippet sets the Acknowledgement Mode to AUTO_ACKNOWLEDGE.

QueueSession qs = qconn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

For AUTO_ACKNOWLEDGE and DUPS_OK_ACKNOWLEDGE, the message will be automatically acknowledged if it is successfully returned from the onMessage() method.

For CLIENT_ACKNOWLEDGE mode, call message.acknowledge() explicitly for the message to be acknowledged.

If MDB is not running in a Tx, then it may run with one of the following modes:

  • TO_ACKNOWLEDGE
  • DUPS_OK_ACKNOWLEDGE

CLIENT_ACKNOWLEDGE mode is not supported for MDBs

For standalone asynchronous listener, if the message is not acknowledged for any reason, then the message is redelivered only once. If the redelivery fails, then the message is implicitly deleted from the JMS server. As a result, the redelivery count does not get updated, and the message does not get redirected to the error destination (even if one is set for this destination).

Standard Issue -2: JMS Pending Message

What is the meaning of pending messages?

A message present on a JMS destination can be either current or pending. A current message is available for immediate consumption by consumers, whereas a pending message is unavailable. The current message can be referred to as an available message.

The JMS message lifecycle can be summarized as below with respect to the following two states:

  1. A message sent by a JMS producer
    • Without any associated transaction:
      It is immediately current.
    • Within a JTA transaction or transacted JMS session:
      It remains pending until the transaction is committed or rolled back. If the transaction is committed, the message becomes available, and if the transaction is rolled back, the message is removed from the destination.
    • With a specified TimeToDeliver property:
      It remains pending until the TimeToDeliver period expires. This is expected because the purpose of the TimeToDeliver property is to keep the message unavailable to consumers until the specified time period.
  1. A message received by a JMS consumer
    • Without any associated JTA transaction and in a non-transacted JMS session with an acknowledgement mode of NO_ACKNOWLEDGE or MULTICAST_NO_ACKNOWLEDGE:
      It is immediately removed from the destination.
    • Within a JTA transaction or transacted JMS session:
      It becomes pending until the transaction or session is committed or rolled back. On commit, the message is removed from the destination, and on rollback, the message becomes available again, unless a Redelivery delay is specified, in which case it continues to remain pending until the Redelivery delay.
    • Within a non-transacted JMS session with the acknowledgement mode of AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, or CLIENT_ACKNOWLEDGE:
      It becomes pending until the acknowledgement is received.

To summarize, pending JMS messages means the messages that were:

  • Sent in a transaction but not committed
  • Received but not acknowledged
  • Received but not committed
  • Subject to a redelivery delay
  • Subject to a delivery time

 

 

Are pending messages harmful?

Having pending messages in your JMS destinations does not by itself have any adverse effect on your JMS server or destination. However, if you see an unusual increase in the number of pending messages, it does point to something not working correctly in the application or the WebLogic Server, which will be discussed in this pattern.

Monitoring Pending Messages

Pending Messages can be monitored as follows:

  • Using WebLogic Admin Console
    1. Browse to JMS -> Servers -> Monitoring -> Monitor Active JMS Destinations.
    2. “Messages pending” column shows the pending messages for each destination.
    3. “Bytes pending” column shows the pending bytes for each destination. This bytes count includes the size of only the properties and the body of the messages, and not that of the headers.
  • Using JMX
    1. Use JMSDestinationRuntimeMBean.getMessagesPending() to get pending messages.
    2. Use JMSDestinationRuntimeMBean.getBytesPending() to get pending bytes.
  • Set WebLogic Server environment in the command window. For example, you can run the setDomainEnv.cmd/sh script in your domain directory.
  • Run “java weblogic.WLST”.
  • Run the following WLST commands:
  • Connect to your WebLogic Server instance:
  • connect(‘[username]’,'[password]’,'[url]’)
  • Access the server runtime MBean hierarchy:
  • serverRuntime()
  • Change directory to your JMS server instance:
  • cd (‘JMSRuntime/examplesServer.jms/JMSServers/examplesJMSServer’)
  • ‘examplesServer’ is the name of your WebLogic Server instance, and ‘examplesJMSServer’ is the name of the JMS server instance.
  • Get the pending messages count on the JMS server:
  • get(‘MessagesPendingCount’)
  • Note: that “Bytes Current” and “Messages Current” numbers in the JMS -> Servers -> Monitoring -> Monitor Active JMS Destinations section of the Weblogic Server Admin Console do not include the pending bytes and pending messages respectively. In other words, “Messages Pending” and “Bytes Pending” count are over and above the “Messages Current” and “Bytes Current” count respectively.

Why does the problem occur and how do you troubleshoot it?

This section discusses the common causes for the increase in the number of pending messages, and the corresponding debug mechanisms.

  • Hang in asynchronous client
    1. Description
      One of the most common causes of pending messages is that an asynchronous consumer is lagging behind the producer. In other words, there is a hang or slowdown of message processing by asynchronous consumers.

Weblogic JMS pipelines messages that are delivered to asynchronous consumers, otherwise known as message listeners. This action aids performance as messages are aggregated when they are internally pushed from the server to the client.

This message buffer or pipeline can be configured using the MessagesMaximum parameter in the Connection Factory settings the default value of this parameter is 10 per instance of the asynchronous client. In case of a MDB, each instance is a separate client. Hence, if there are 15 instances of a given MDB, there can be 10*15=150 pending messages buffered on the MDB side in the message pipeline.

These buffered messages will not be consumed by the client if the client happens to be hanging for any reason while processing a message. Other messages in the pipeline will wait and contribute to the number of pending messages. Each such hanging thread corresponds to a hanging asynchronous client and contributes to pending messages equal to the MessagesMaximum parameter. For instance, 5 threads hanging in onMessage() method will contribute to 50 pending messages, assuming the MessagesMaximum parameter has the default value of 10.

    1. Debug steps
      the main problem is the hang in the client. The presence of pending messages is just an after effect. To find out if the client is hanging, take thread dumps as described in Generic Server Hang Pattern document. If you see threads hanging in the onMessage() method of the asynchronous consumer, it means that the client is hanging while processing a message in the queue.

You can always reboot the standalone client or redeploy the MDB. All the messages in the pipeline, including the message being currently processed, will again become available in the queue, ready to be processed by the receivers. This may or may not help resolve the hang depending upon the cause of the hang. For instance, if the hang occurs because the onMessage() code is waiting for an external resource that is currently unavailable, the client will continue to hang after the reboot/redeployment, until the resource becomes available.

You can also reduce the value of the MessagesMaximum property to 1 from the default value of 10. This means that there will be no messages in the pipeline. A second message will be delivered to the asynchronous consumer only after the first message processing has been completed. This can have some performance impact.

It is important to note that this MessagesMaximum property defined on the Connection Factory is different from the MessagesMaximum property for a JMS destination. The property for a JMS destination is used to configure the maximum number of messages that can be stored in the destination.

  • Absence of one or more durable subscribers for topics
    1. Description
      By definition, a topic message remains on the topic until it is consumed by all the currently available non-durable subscribers, and all the registered durable subscribers, irrespective of whether they are currently available or not. Once a topic message is consumed by any given subscriber, it becomes pending and remains so, until it has been consumed by all of these subscribers. This is especially important to understand in case of durable subscribers. Messages can stay in a pending state forever, if one or more of the registered durable subscribers never come back up. In contrast, a queue message is consumed by just one consumer. The message transitions to a pending state when it is delivered to the consumer, and is removed from the queue on acknowledgement of the receipt or commit of the concerned transaction.
    1. Debug steps
      Monitor if all the durable subscribers for the topic are “Active”.

      • On the WebLogic Admin Console, browse to:
        JMS -> Servers -> [JMS Server Name] -> Monitoring -> Monitor Active JMS Destinations -> Monitor all Durable Subscribers
      • Check if the “Active” column has a value of “true” for all durable subscribers.

If any of the subscribers are not active, bring them up. For MDB clients acting as durable subscribers, make sure that the MDBs are deployed correctly on the server(s), and for standalone JMS clients, ensure that they are running.

  • Long Redelivery Delay Period and frequent rollbacks on consumer side
    1. Description
      If the Connection Factory and/or the JMS Destination is configured with a long Redelivery Delay period, and messages are rolled back frequently by the consumers, it will lead to a high number of pending messages.
    1. Debug steps
      Investigate the cause of the rollbacks on the consumer side by analyzing the exceptions thrown. You can also reduce the Redelivery Delay period.
  • Infrequent acknowledgement when using CLIENT_ACKNOWLEDGE
    1. Description
      Another possible cause of pending messages is that clients using non-transacted sessions with CLIENT_ACKNOWLEDGE mode do not send acknowledgements frequently. This will cause the number of pending messages to increase as messages are delivered to and consumed by consumers, but there is no acknowledgement sent back to the JMS server.

Debug steps
Check the code which does the client acknowledgement to ensure that the acknowledgement is done frequently.

Additional information on pending messages

  • There is no way to purge current or pending messages in a JMS destination.
  • There is no mechanism to browse pending messages in a destination.
  • The storage mechanism of a message is independent of whether a message is pending or available. In both states, if the message is non-persistent, it stays in memory, whereas a persistent message is persisted to the underlying JMS store.
  • To avoid the server from running out of memory due to pending or current messages, configure ‘Paging’ for the connection factory. This ensures that the message properties and body may be persisted to the paging store depending upon the quotas specified for the destination. The message headers are always present in memory irrespective of paging.
  • If a JMS sender or receiver having an associated JTA transaction does not explicitly commit or rollback the transaction, the messages remain pending, until one of the following conditions takes place:
    1. The transaction times out causing a rollback or
    2. The transaction is explicitly rolled back through the WebLogic Admin Console.

In case of a transacted JMS session, the message will remain pending until the client JVM is alive. In cases, JTA transaction and transacted JMS session, if the client JVM exits without committing or rolling back the transaction, the server receives a PeerGoneException, rolls back the transaction, and the messages are rolled back. In case of a producer the messages are removed from the destination, and in case of a consumer they are moved from the pending to the current state in the destination.

  • Rolling back an associated JTA transaction or transacted JMS session multiple times does not cause double counting of pending messages, nor does an exception that set a JTA transaction as rollbackOnly followed by an actual rollback.
  • JMS filestore does not shrink in size – The size of a JMS filestore increases as messages are sent to the destinations included in its target JMS server. This can be controlled by tuning quotas and flow control to restrict the number of messages sent to the destinations. Unfortunately, the filestore does not shrink in size on message retrieval. The workaround is to delete the filestore when there are no messages on the store. The exact steps to follow for this purpose are:
    1. Check that there are no available or pending messages on the destination.
    1. Untarget the JMS server from the WebLogic Server instance. You can also just stop the WebLogic Server instance.
    2. Delete the filestore (*.dat file) from the filesystem.

Retarget the JMS server to the Weblogic Server instance. If you had stopped the Weblogic Server instance, restart it.

Debug information

The debug parameters that can be specified for diagnosis are: DebugJMSBackEnd, DebugJMSFrontEnd, DebugJMSCommon, DebugJMSDispatcher , and DebugJMSXA.

DebugJMSXA is required only when the pending messages are related to transacted JMS sessions and/or JTA transactions. You can add these parameters:

  • In the config.xml file:
<ServerDebug DebugJMSBackEnd=”true” DebugJMSFrontEnd =”true” DebugJMSCommon=”true” DebugJMSDispatcher=”true” DebugJMSXA=”true”/>
  • Or as startup parameters in your startWebLogic.cmd script:
-Dweblogic.Debug=weblogic.DebugJMSBackEnd,weblogic.DebugJMSFrontEnd,
weblogic.DebugJMSCommon,weblogic.DebugJMSDispatcher,weblogic.DebugJMSXA
  • Note that enabling this debug is recommended for a development type of environment due to the verbosity of the debug messages.

 
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
at weblogic.messaging.kernel.internal.PersistenceImpl.readMessageBody(PersistenceImpl.java:848)
at weblogic.messaging.kernel.internal.MessageHandle.pin(MessageHandle.java:373)
at weblogic.messaging.kernel.internal.MessageElementImpl.(MessageElementImpl.java:83)

We get this exception on the server on which the queue is available when we try to open a large message from WLS Console.Issue is fixed in 12.2.1 and patches are available in other version. You can check this bug number Bug 19222117.

Working with Reverse proxy servers


The term “Proxy Servers” is mostly popular among our middleware techies as: “Server which forwards the request”.

But, for simple multiple reasons, this one lined defined server is vastly used in each and every environment in multiple forms like Forward Proxy Server, Reverse Proxy Server and Open Proxy Server.

The basic purpose of this document is to cover what is a proxy server, understanding of different proxy servers, configuration of Reverse proxy server.

Defining Proxy Server: Proxy Server is an intermediary server between your web browser (client) which requests for some information/data and your server (web server/Application server) that process the data.

Following is the schematic representation of the proxy server:-

Types of Proxy Server: They are three different types of proxy servers. They are as follows:

1)      Forward Proxy Server

2)      Open Proxy Server

3)      Reverse Proxy Server

Forward Proxy Servers: Forward Proxy Server is a server which forwards the request from the intranet clients (web browser) to the internet servers. These proxy servers are present in the same network of your client. Schematically, we can represent any forward proxy servers as follows:

Open Proxy Server: An open proxy is a proxy server which is accessible by any Internet user. Any proxy server that doesn’t restrict its client base to its own set of clients and allows any other client to connect to it is known as an “Open Proxy”. An anonymous open proxy allows users to conceal their IP address while browsing the Web or using other Internet services. They are in numerous open proxy servers present in Internet. For converting any flavor of proxy servers to Open Proxy servers we just have to enable the flag “ProxyRequests On” in the configuration file.

Following is the pictorial view of understanding our open proxy servers:

Reverse Proxy Server: A Proxy Server which takes requests from external clients (web browsers) or Internet and forwards them to servers in an internal network is called as Reverse Proxy Server. Generally, the reverse proxy servers are present in the same network where we have our App/Web servers.

Schematically we can represent all of our reverse proxy servers as follows:

After understanding the different types of proxy servers lets try knowing more about reverse proxy servers especially the advantages and configuration of proxy servers.

Advantages of using Reverse Proxy Servers:

The various advantages of using the proxy servers are as follows:

1)      Filtering

2)      Caching

3)      Bypassing filters and censorship

4)      Logging and eavesdropping

5)      Gateways to private networks

6)      Accessing services anonymously

Understanding and comparing these advantages with the other flavors of proxy servers every one of us would be interested to use the reverse proxy servers. So, lets try understanding how do we do the configuration of the reverse proxy servers.

Most of the present day proxy servers have the ability or the behavior to act as reverse proxy servers with an addition of a small module. Since, discussing about the configuration of all of those reverse proxy server with weblogic server wouldn’t be possible, this document restricts its scope only to Apache Server.

Configuration of Apache Reverse Proxy Server with Weblogic Server:

To begin the configuration of apache reverse proxy server, Lets consider a public site http://weblogic-wonders.com (or an application you deployed on cluster) which has a public IP and DNS entry and could be accessed across the globe.

Let’s consider that the application server on which this site is hosted is our weblogic application server having the two instances weblogic_Instance1.com, weblogic_Instance2.com.

Following are the steps for configuring the apache proxy server with weblogic servers:-

1)      Post installing and creating a domain in weblogic server copy mod_wl_20.so file from weblogic server to apache server modules folder.

2)      Download libxml2 (version shouldn’t be older than 2.6) from http://xmlsoft.org and install it.

3)      Copy and paste the file to the paths: /usr/lib/libxml2.so, with headers in /usr/include/libxml2/libxml/

4)      Download mod_proxy_html and mod_xml2enc from http://apache.webthing.com/

5)      Load the following configuration inside the httpd.conf of our apache server:-

LoadModule proxy_module      modules/mod_proxy.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule headers_module    modules/mod_headers.so

LoadFile   /usr/lib/libxml2.so

LoadModule proxy_html_module modules/mod_proxy_html.so

LoadModule xml2enc_module modules/mod_xml2enc.so

ProxyRequests off

ProxyPass /app1/ http://weblogic_Instance1.com/

ProxyPass /app2/ http:// weblogic_Instance2.com/

ProxyHTMLURLMap http:// weblogic_Instance1.com /app1

ProxyHTMLURLMap http:// weblogic_Instance2.com /app2

<Location /app1/>

ProxyPassReverse /

ProxyHTMLEnable On

ProxyHTMLURLMap  /      /app1/

RequestHeader    unset  Accept-Encoding

</Location>

<Location /app2/>

ProxyPassReverse /

ProxyHTMLEnable On

ProxyHTMLURLMap /       /app2/

RequestHeader   unset   Accept-Encoding

</Location>

6)      Now, restart the apache server and weblogic application server instances.

Reference:

1)      http://www.google.com – Special, Special thanks ..  🙂

2)      http://cybergav.in/2009/09/09/how-to-configure-apache-2-x-as-a-reverse-proxy/