Sunday, 9 November 2014

WebSphere Application Server - Curiouser and curiouser - Unicode 0xB and Jython and wsadmin

So I'm responding to a comment on a previous post: -


with regard to creating WebSphere environment variables in Python, and I discover a new ( to me ) "bug" or "feature" in wsadmin / Jython.

Namely, the combination of the backslash ( \ ) and vee ( v ) and eight ( 8 ) characters inside a variable value, even when wrapped in quotes, are NOT a good combination.

Here's a test; try creating a variable with the value of \v8 and see what happens: -

AdminConfig.create('VariableSubstitutionEntry', '(cells/'+AdminControl.getCell()+'|variables.xml)', '[[symbolicName "foobar"] [description ""] [value "\v8"]]')

WASX7015E: Exception running command: "AdminConfig.create('VariableSubstitutionEntry', '(cells/'+AdminControl.getCell()+'|variables.xml)', '[[symbolicName "foobar"] [description ""] [value "\v8"]]')"; exception information:
com.ibm.websphere.management.exception.ConfigDocumentSaveException
java.lang.RuntimeException: java.lang.RuntimeException: An invalid XML character (Unicode: 0xb) was found in the element content:
                                                 8
Not only that, but it really really breaks the wasadmin SOAP data stream, as evidenced when you try and create something else: -

AdminConfig.create('VariableSubstitutionEntry', '(cells/'+AdminControl.getCell()+'|variables.xml)', '[[symbolicName "foobar"] [description ""] [value "\v"]]') 

WASX7015E: Exception running command: "AdminConfig.create('VariableSubstitutionEntry', '(cells/'+AdminControl.getCell()+'|variables.xml)', '[[symbolicName "foobar"] [description ""] [value "\v"]]')"; exception information:
com.ibm.websphere.management.exception.ConfigServiceException
com.ibm.websphere.management.exception.ConnectorException
org.apache.soap.SOAPException: [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html", must be: "text/xml". Response was:
<HTML><TITLE>500 - Internal Server Error</TITLE><BODY><h1>500 </h1></BODY></HTML>

with: -

[09/11/14 09:07:11:167 GMT] 00000101 JMXObjectOutp E   ADMC0001E: Unable to serialize object: com.ibm.ws.sm.workspace.migration.WSResourceSetImpl

appearing in the SystemOut.log.

Interestingly, though, one CAN achieve this via the Integrated Solutions Console, which generates virtually the same Jython: -

AdminConfig.create('VariableSubstitutionEntry', '(cells/PCCell1|variables.xml#VariableMap_1)', '[[symbolicName "snafu"] [description ""] [value "\v8"]]')

I'm guessing that there's something that one can do when starting the wsadmin client to ensure that these kind of characters don't "choke" the SOAP connection.

Oh, what fun :-)

Saturday, 8 November 2014

java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=com/davehay/EmployeeServlet, offset=6


cat /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/AppClusterMember1/SystemOut.log

...
[08/11/14 18:29:20:374 GMT] 00000101 webapp        E com.ibm.ws.webcontainer.webapp.WebApp commonInitializationFinish SRVE0266E: E
rror occured while initializing servlets: {0}
                                 java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=com/davehay/EmployeeServlet, offset=6

...

Various searches led me to this post: -


which kindly points out the Java major versions: -

<snip>
• Java 1.2 uses major version 46
• Java 1.3 uses major version 47
• Java 1.4 uses major version 48
• Java 5 uses major version 49
• Java 6 uses major version 50
• Java 7 uses major version 51
• Java 8 uses major version 52
</snip>

I had a dig around on my server: -

locate EmployeeServlet.class

/home/wasadmin/java/JDBCTest/WEB-INF/com/davehay/EmployeeServlet.class
/home/wasadmin/java/JDBCTest/WEB-INF/lib/com/davehay/EmployeeServlet.class
/home/wasadmin/java/JDBCTest/src/com/davehay/EmployeeServlet.class
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/PCCell1/JDBCTest_war.ear/JDBCTest.war/WEB-INF/classes/com/davehay/EmployeeServlet.class


The first three hits relate to my manual compilation fest, the fourth is created when I deploy the application: -

AdminApp.install('/home/wasadmin/JDBCTest.war', '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname "JDBCTest_war" -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -noenableClientModule -clientMode isolated -novalidateSchema -contextroot / -MapResRefToEJB [[ "JDBCTest.war" "" "JDBCTest.war,WEB-INF/web.xml" jdbc/testDB javax.sql.DataSource jdbc/Sample "" "" "" ]] -MapModulesToServers [[ "JDBCTest.war" "JDBCTest.war,WEB-INF/web.xml" WebSphere:cell=PCCell1,cluster=AppCluster ]] -MapWebModToVH [[ "JDBCTest.war" "JDBCTest.war,WEB-INF/web.xml" default_host ]]]' )

AdminConfig.save() 
AdminNodeManagement.syncActiveNodes() 

so I did some digging using javap: -

javap -verbose -classpath /home/wasadmin/java/JDBCTest/WEB-INF/ com/davehay/EmployeeServlet | grep major

  major version: 50

javap -verbose -classpath /home/wasadmin/java/JDBCTest/WEB-INF/lib/ com/davehay/EmployeeServlet | grep major

  major version: 50

javap -verbose -classpath /home/wasadmin/java/JDBCTest/src/ com/davehay/EmployeeServlet | grep major

  major version: 50

javap -verbose -classpath /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/PCCell1/JDBCTest_war.ear/JDBCTest.war/WEB-INF/classes/ com/davehay/EmployeeServlet | grep major

  major version: 51

So, the Java 7 version of the class is somehow being compiled when I deploy the WAR file.

I revisited my packaging ( again, this is what happens when one chooses to create JEE applications by hand, rather than using tools such as Eclipse or Maven !! ), and ended up with this: -

META-INF
META-INF/MANIFEST.MF
WEB-INF
WEB-INF/web.xml
WEB-INF/com
WEB-INF/com/davehay
WEB-INF/com/davehay/EmployeeServlet.class
WEB-INF/ibm-web-ext.xml
WEB-INF/lib
WEB-INF/lib/JDBCTest.jar
WEB-INF/lib/META-INF
WEB-INF/lib/META-INF/MANIFEST.MF
WEB-INF/ibm-web-bnd.xml

and re-created the JAR: -

jar cvf ~/JDBCTest.war .

I redeployed the code, and re-checked the Java version of the class: -

javap -verbose -classpath /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/PCCell1/JDBCTest_war.ear/JDBCTest.war/WEB-INF/ com/davehay/EmployeeServlet | grep major

  major version: 50

I started the WAR: -

AdminControl.invoke('WebSphere:name=ApplicationManager,process=AppClusterMember1,platform=proxy,node=Node1,version=8.5.5.2,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=PCCell1,spec=1.0', 'startApplication', '[JDBCTest_war]', '[java.lang.String]')

and it now comes up cleanly: -

[08/11/14 19:16:44:023 GMT] 000000fe AdminHelper   A   ADMN1008I: An attempt is made to start the JDBCTest_war application. (User ID = defaultWIMFileBasedRealm/wasadmin)
[08/11/14 19:16:44:051 GMT] 000000fe CompositionUn A   WSVR0190I: Starting composition unit WebSphere:cuname=JDBCTest_war in BLA WebSphere:blaname=JDBCTest_war.
[08/11/14 19:16:44:104 GMT] 000000fe ApplicationMg A   WSVR0200I: Starting application: JDBCTest_war
[08/11/14 19:16:44:104 GMT] 000000fe ApplicationMg A   WSVR0204I: Application: JDBCTest_war  Application build level: Unknown
[08/11/14 19:16:44:287 GMT] 000000fe webapp        I com.ibm.ws.webcontainer.webapp.WebGroupImpl WebGroup SRVE0169I: Loading Web Module: JDBCTest.war.
[08/11/14 19:16:44:320 GMT] 000000fe WASSessionCor I SessionContextRegistry getSessionContext SESN0176I: Will create a new session context for application key default_host/
[08/11/14 19:16:44:362 GMT] 000000fe webcontainer  I com.ibm.ws.webcontainer.VirtualHostImpl addWebApplication SRVE0250I: Web Module null has been bound to default_host[*:9080,*:80,*:9443,*:5060,*:5061,*:443,*:9061,*:9044,*:9062,*:9081,*:9444,*:9045,*:9063,*:9082,*:9445,*:9046].
[08/11/14 19:16:44:399 GMT] 000000fe ApplicationMg A   WSVR0221I: Application started: JDBCTest_war
[08/11/14 19:16:44:400 GMT] 000000fe CompositionUn A   WSVR0191I: Composition unit WebSphere:cuname=JDBCTest_war in BLA WebSphere:blaname=JDBCTest_war started.



The EAR file could be corrupt and/or incomplete. Make sure that the application is at a compatible Java(TM) Platform, Enterprise Edition (Java EE) level for the current version of WebSphere(R) Application Server.

I'm seeing this: -

The EAR file could be corrupt and/or incomplete. Make sure that the application is at a compatible Java(TM) Platform, Enterprise Edition (Java EE) level for the current version of WebSphere(R) Application Server.
com.ibm.websphere.management.application.client.AppDeploymentException: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException: IWAE0069E The archive file [WEB-INF/lib/JDBCTest.jar] has an entry with a path that contains "../". File path [../com/davehay/EmployeeServlet.class] [Root exception is org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException: IWAE0069E The archive file [WEB-INF/lib/JDBCTest.jar] has an entry with a path that contains "../". File path [../com/davehay/EmployeeServlet.class]] 


with: -

...
 FFDC Exception:com.ibm.websphere.management.application.client.AppDeploymentException SourceId:com.ibm.ws.management.application.client.AppInstallHelper.createEarWrapper ProbeId:1059 Reporter:java.lang.Class@9edd8232
com.ibm.websphere.management.application.client.AppDeploymentException: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException: IWAE0069E The archive file [WEB-INF/lib/JDBCTest.jar] has an entry with a path that contains "../". File path [../com/davehay/EmployeeServlet.class] [Root exception is org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException: IWAE0069E The archive file [WEB-INF/lib/JDBCTest.jar] has an entry with a path that contains "../". File path [../com/davehay/EmployeeServlet.class]]
...

in the FFDC logs.

I am trying to deploy a WAR file that I've hand-cranked myself using IBM Java 1.7 on the command-line ( for many reasons too boring to outline here ! ).

Guess what ?

The exception is bang on: -

/opt/IBM/WebSphere/AppServer/java/bin/jar xvf JDBCTest.jar 

  created: META-INF/
 inflated: META-INF/MANIFEST.MF
 inflated: ../com/davehay/EmployeeServlet.class

This is what I'm trying to use: -

/home/wasadmin/java/JDBCTest/WEB-INF/lib

com
com/davehay
com/davehay/EmployeeServlet.class
META-INF
META-INF/MANIFEST.MF


so I repackaged the JAR file as follows: -

/opt/IBM/WebSphere/AppServer/java/bin/jar cvf JDBCTest.jar .

added manifest
adding: com/(in = 0) (out= 0)(stored 0%)
adding: com/davehay/(in = 0) (out= 0)(stored 0%)
adding: com/davehay/EmployeeServlet.class(in = 2661) (out= 1407)(deflated 47%)
ignoring entry META-INF/
ignoring entry META-INF/MANIFEST.MF

Having fixed the JAR file, I repackaged the WAR using the following file structure: -

META-INF
META-INF/MANIFEST.MF
src
src/com
src/com/davehay
src/com/davehay/EmployeeServlet.java
WEB-INF
WEB-INF/web.xml
WEB-INF/com
WEB-INF/com/davehay
WEB-INF/com/davehay/EmployeeServlet.class
WEB-INF/lib
WEB-INF/lib/JDBCTest.jar


/opt/IBM/WebSphere/AppServer/java/bin/jar cvf JDBCTest.war .

which did the trick.

For the record, I'd normally use Eclipse ( Rational Application Developer, Rational Software Architect etc. ) to create JEE resources, but I'm using Eclipse on Mac OS X with WebSphere Application Server on Linux, and I need the IBM JDK in order to correctly compile a class for WAS ( Eclipse on Mac is using the Oracle SDK which doesn't have all the rich IBM SDK goodness ).

Simples :-)

Friday, 7 November 2014

NFS Mounting from Red Hat Enterprise Linux to Mac OS X

So this is what I had on the RHEL box: -

/etc/exports

/opt/IBM/WebSphere/AppServer *(rw,no_root_squash)

and this is I was seeing on the Mac: -

sudo mount -t nfs bpm855.uk.ibm.com:/opt/IBM/WebSphere/AppServer /tmp/nfs/

mount_nfs: can't mount /opt/IBM/WebSphere/AppServer from bpm855.uk.ibm.com onto /private/tmp/nfs: Operation not permitted

This post provided me with not ONE but TWO answers: -


which led me to Solution 1: -

sudo mount -t nfs -o resvport,rw bpm855.uk.ibm.com:/opt/IBM/WebSphere/AppServer /tmp/nfs/

and then Solution 2: -

/ettc/exports

/opt/IBM/WebSphere/AppServer    *(rw,no_root_squash,insecure)

sudo mount -t nfs bpm855.uk.ibm.com:/opt/IBM/WebSphere/AppServer /tmp/nfs/

which is nice.

IBM BPM - Process Designer > Process Centre Troubleshooting

This has been in my mind over the past week or so, as I work to resolve a niggling connectivity issue with IBM BPM Advanced 8.5.0.1.






I think I've got to root cause, and the next few days will confirm ( or not ).

DB2 FAQ - Frequently Asked Questions about DB2 for Linux, UNIX and Windows

Updated 4 November 2014

DB2 FAQ: This document contains Frequently Asked Questions (FAQ) about the product DB2 for Linux UNIX and Windows. This FAQ covers DB2 Versions 8.x, 9.1, 9.5,9.7,10.1 & 10.5

Thursday, 6 November 2014

IBM BPM - BPMConfig, Response Files and Escape Characters

This follows on from these two posts: -



This time around, I am using the BPMConfig command to create a BPM 8.5.5 Deployment Environment: -

/opt/IBM/WebSphere/AppServer/bin/BPMConfig.sh -create -de /mnt/hgfs/SoftwareLibrary/ResponseFiles/Advanced-PC-ThreeClusters-DB2.properties

which keeps failing with: -

/opt/IBM/WebSphere/AppServer/bin/BPMConfig.sh -create -de /mnt/hgfs/SoftwareLibrary/ResponseFiles/Advanced-PC-ThreeClusters-DB2.properties 
Logging to file /opt/IBM/WebSphere/AppServer/logs/config/BPMConfig_20141106-213359.log.
Validating the profile registry.
[]
Configuring the deployment manager.
Creating the deployment manager profile.
The following validation errors were present with the command line arguments: 
signingCertDN: Enter only one value for the signingCertDN parameter.
importSigningCertKS: importSigningCertKS cannot be empty.
importSigningCertKSType: importSigningCertKSType cannot be empty.
importSigningCertKSAlias: importSigningCertKSAlias cannot be empty.
CWMCB0003E: A profile was not created for Dmgr01.
The 'BPMConfig.sh -create -de /mnt/hgfs/SoftwareLibrary/ResponseFiles/Advanced-PC-ThreeClusters-DB2.properties' command failed. For more information, see the log file /opt/IBM/WebSphere/AppServer/logs/config/BPMConfig_20141106-213359.log.

and: -

...
2014-11-06 21:38.48.231 com.ibm.bpm.config.util.scripting.InvocationHelper.invokeCommand(): Result of executing /opt/IBM/WebSphere/AppServer/bin/manageprofiles.sh -create -templatePath BPM/BpmDmgr -profileName Dmgr01 -profilePath /opt/IBM/WebSphere/AppServer/profiles/Dmgr01 -cellName PCCell1 -nodeName Dmgr -hostName bpm855.uk.ibm.com -serverType DEPLOYMENT_MANAGER -enableAdminSecurity true -adminAliasName CellAdminAlias -adminUserName wasadmin -adminPassword ******** -personalCertDN cn=bpm855.uk.ibm.com,ou=bpm85Cell,ou=bpm85Node1,o=IBM,c=US -signingCertDN cn=bpm855.uk.ibm.com,ou=Root Certificate,ou=bpm85Cell,ou=bpm85Node1,o=IBM,c=US -personalCertValidityPeriod 15 -signingCertValidityPeriod 25 -keyStorePassword ******** -winserviceCheck false: 1
2014-11-06 21:38.48.231 com.ibm.bpm.config.util.scripting.InvocationHelper.invokeShellScript(): RETURN 1
2014-11-06 21:38.48.231 com.ibm.bpm.config.BPMConfig.invokeShellScript(): RETURN Result of execution: 1
2014-11-06 21:38.48.237 com.ibm.bpm.config.BPMConfig.main(): CWMCB0003E: A profile was not created for Dmgr01.
com.ibm.bpm.config.util.ConfigException: CWMCB0003E: A profile was not created for Dmgr01.

...

This is because I'm using the following line: -

bpm.dmgr.profileOptions=-personalCertDN "cn=bpm855.uk.ibm.com\\,ou=bpm85Cell\\,ou=bpm85Node1\\,o=IBM\\,c=US" -signingCertDN "cn=bpm855.uk.ibm.com\\,ou=Root Certificate\\,ou=bpm85Cell\\,ou=bpm85Node1\\,o=IBM\\,c=US" -personalCertValidityPeriod 15 -signingCertValidityPeriod 25 -keyStorePassword passw0rd

bpm.de.node.1.profileOptions=-personalCertDN "cn=bpm855.uk.ibm.com\\,ou=bpm85Cell\\,ou=bpm85Node1\\,o=IBM\\,c=US" -signingCertDN "cn=bpm855.uk.ibm.com\\,ou=Root Certificate\\,ou=bpm85Cell\\,ou=bpm85Node1\\,o=IBM\\,c=US" -personalCertValidityPeriod 15 -signingCertValidityPeriod 25 -keyStorePassword passw0rd

in my response file - Advanced-PC-ThreeClusters-DB2.properties - to override the defaults that BPMConfig uses when it creates a profile, as described here: -


Long story short, this was again down to the use of escape characters, which differs from my prior experience ( as per the previous blog posts ).

After much trial and error, I tested this hypothesis by manually executing the manageProfiles command using the exception listed above: -

/opt/IBM/WebSphere/AppServer/bin/manageprofiles.sh -create -templatePath BPM/BpmDmgr -profileName Dmgr01 -profilePath /opt/IBM/WebSphere/AppServer/profiles/Dmgr01 -cellName PCCell1 -nodeName Dmgr -hostName bpm855.uk.ibm.com -serverType DEPLOYMENT_MANAGER -enableAdminSecurity true -adminAliasName CellAdminAlias -adminUserName wasadmin -adminPassword passw0rd -personalCertDN "cn=bpm855.uk.ibm.com,ou=bpm85Cell,ou=bpm85Node1,o=IBM,c=US" -signingCertDN "cn=bpm855.uk.ibm.com,ou=Root Certificate,ou=bpm85Cell,ou=bpm85Node1,o=IBM,c=US" -personalCertValidityPeriod 15 -signingCertValidityPeriod 25 -keyStorePassword passw0rd -winserviceCheck false: 1

which now completes with: -

INSTCONFSUCCESS: Success: Profile Dmgr01 now exists. Please consult /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/logs/AboutThisProfile.txt for more information about this profile.

The solution ?

In this case, I did NOT need to use the escape characters ( \ or \\ ) but I did need to use double-quotes ( "" ) to wrap up the certificate Distinguished Names.

Another lesson learned.

"Every day is a school day!"

Note to self - Firefox and local connections

 Whilst trying to hit my NAS from Firefox on my Mac, I kept seeing errors such as:- Unable to connect Firefox can’t establish a connection t...