Thursday, November 28, 2013

Plumbum: Never write shell scripts again

http://plumbum.readthedocs.org/en/latest/
I haven't evaluated it, but surely I am 100% in favor of writing shell scripts in Python...

ALL unix shells languages suck big time... I am 10 times more productive in Python (even being a beginner) than in bash or korn...

Eclipse: open .sh files with text editor

Something annoying is that in Eclipse, when you open a .sh file, it will run an external editor to edit it.

Open Preferences, General/Editors/File Associations and add the extension (file type) .sh and associate the editor "Text Editor".



Java, JMX, WebLogic and DomainRuntime

I try to run the code:

http://docs.oracle.com/cd/E12840_01/wls/docs103/jmx/accessWLS.html#wp1111297

I get this error:
java.net.MalformedURLException: Unsupported protocol: t3
I add "C:\Oracle\Middleware\wlserver_10.3\server\lib\wljmxclient.jar" to the classpath

This time I receive a
"org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 211 completed: No" caused by java.io.IOException: End-of-stream at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readFully(SocketOrChannelConnectionImpl.java:666)

This is apparently an issue in the JVM (see Doc ID 1598451.1 ) ... they say one can add -Dcom.sun.CORBA.connection.ORBHighWaterMark=300 ... personally I give up in frustration.

Wednesday, November 27, 2013

weblogic.management.provider.EditSaveChangesFailedException

I try to activate a session in WLS, and I get this
java.lang.RuntimeException: weblogic.management.provider.EditSaveChangesFailedException
caused by

java.io.IOException: No such file or directory at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:883) at weblogic.management.provider.internal.DescriptorHelper.getRecoveryFileForNewFile(DescriptorHelper.java:205) at weblogic.management.provider.internal.DescriptorHelper.saveDescriptorTree(DescriptorHelper.java:122) at weblogic.management.provider.internal.DescriptorHelper.saveDescriptorTree(DescriptorHelper.java:49) at weblogic.management.provider.internal.EditAccessImpl.saveChanges(EditAccessImpl.java:704) ... 133 more

It turned out that the file system was full :o(

No disk space monitoring? Ahi Ahi Ahi....



Monday, November 25, 2013

WebLogic JMS: setting TTL (time to live) aka Expiration Time on messages

you can set a Time To Live for a JMS message using the WLS console, with "Overrides / Time-to-Live Override", but you should also select the "Delivery Mode Override:" = Persistent, otherwise you get this error:
Message icon - Error An error occurred during activation of changes, please see the log for details.
Message icon - Error [Management:141191]The prepare phase of the configuration update failed with an exception:
Message icon - Error VALIDATION PROBLEMS WERE FOUND problem: cvc-enumeration-valid: string value 'No-Delivery' is not a valid enumeration value for delivery-mode-type in namespace http://xmlns.oracle.com/weblogic/weblogic-jms:

then you should also choose what to to with the expired message (Expiration Policy:), best thing is to redirect it to an Error Destination.

The weird thing is that this TTL Override doesn't see to work when you create a new JMS message from the WL console. If you monitor the JMS messages in the queue, the JMS Expiration is still set to 0.
In OSB, you can assign a default "JMS expiration" to the Business Service sending messages to the JMS destination, or you can assign a JMS Expiration at runtime (even in the test console).
Another way is to set the "Default Time-to-Live:" at Connection Factory level.
This is the WLST code to set the Override at JMS Destination level:
#you should have created a PV_OSB_TESTModule JMSModule and a PV_OSB_TESTQ Distributed Queue

cd('/JMSSystemResources/PV_OSB_TESTModule/JMSResource/PV_OSB_TESTModule/UniformDistributedQueues/PV_OSB_TESTQ/DeliveryFailureParams/PV_OSB_TESTQ')

cmo.setErrorDestination(getMBean('/JMSSystemResources/PV_OSB_TESTModule/JMSResource/PV_OSB_TESTModule/UniformDistributedQueues/PV_OSB_TESTReprocessQ'))


cmo.setExpirationPolicy('Redirect')

cd('/JMSSystemResources/PV_OSB_TESTModule/JMSResource/PV_OSB_TESTModule/UniformDistributedQueues/PV_OSB_TESTQ/DeliveryParamsOverrides/PV_OSB_TESTQ')


cmo.setTimeToLive(120000)




Saturday, November 23, 2013

JSP error page


<%@page isErrorPage="true" %>
<html>
<body>
<h1>Error page</h1>
<pre>
<% if (exception != null) {
 out.write("exception message=" + exception.toString());
}
else {
 out.write("no exception available");
} 
%>
</pre>
</body>
</html>




Websphere MQ: getting my feet wet into it

First install Eclipse
http://archive.eclipse.org/eclipse/downloads/drops/R-3.4.2-200902111700/download.php?dropFile=eclipse-SDK-3.4.2-win32.zip

Download and install it - do the custom installation without MQ Explorer which requires also Websphere Eclipse installation.

One restarted, you find an icon in the bottom right "Webpshere MQ Running".
Right click to open the Alert monitor

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.amqtac.doc/wq10860_.htm


For OSB, you should download com.ibm.mq.jar for 7.0.1 :

http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg24019253&loc=en_US&cs=utf-8&lang=en

A useful tool is http://www.angussoft.co.uk/ queuezee. I could not make it work though :o(


________

HOw to configure OSB for MQ:

http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/mqtransport/

new BS, Transport typed,  protocol MQ

Add URI

"The MQ Connection Resource default/mqConnection specified in URI mq://local-queue?conn=default/mqConnection does not exist"

Why? Because you need to create first a  New MQ Connection Resource

this tool can help:
http://www.niratul.com/

before you install, add this to env variable CLASSPATH  
C:\apps\mq\com.ibm.mq.commonservices.jar;C:\apps\mq\com.ibm.mq.defaultconfig.jar;C:\apps\mq\connector.jar;C:\apps\mq\com.ibm.mq.headers.jar;C:\apps\mq\com.ibm.mq.jar;C:\apps\mq\com.ibm.mq.jmqi.jar;C:\apps\mq\com.ibm.mq.pcf.jar;C:\apps\mq\com.ibm.mq.postcard.jar;C:\apps\mq\com.ibm.mq.tools.ras.jar

(these jars are in C:\Program Files\IBM\WebSphere MQ\java\lib)






OSB: Publish WSDL to UDDI

In OSB11 (Eclipse 3.5.3) if you right click on a WSDL you get
Web Services / Publish WSDL File

You choose "Publish this Web Service to the Unit Test UDDI Registry.

If you have not registered any UDDI Registry, you get this error message:

IWAB0363E No UDDI registry available

Do solve the problem, go to
http://ws.apache.org/juddi/releases.html

there is a 3.0.2,
download it, unzip it, deploy juddiv3-war-3.0.2.war to WebLogic.



in Eclipse do New , Other, enter UDDI and select "UDDI Registry".
You must create it inside a Oracle Service Bus Configuration project.



On Java side, you can use http://uddi4j.sourceforge.net/doc.html  UDDI4J to invoke the UDDI services.

Friday, November 22, 2013

WLST to monitor all Datasources on all Managed Servers by connecting only to the Admin

#connect to the admin server

domainRuntime()
allservers=ls('/ServerRuntimes/', returnMap='true')
for server in allservers:
    allds = ls('/ServerRuntimes/' + server + '/JDBCServiceRuntime/' + server + '/JDBCDataSourceRuntimeMBeans', returnMap='true')
    for ds in allds:
        cd ('/ServerRuntimes/' + server + '/JDBCServiceRuntime/' + server + '/JDBCDataSourceRuntimeMBeans/' + ds)
        print server, ds, cmo.getActiveConnectionsCurrentCount()




WebLogic JMX remote using JMX protocol and JMXTrans

Make sure this is enabled in your domain configuration:
a) [domain name]->[Configuration][General]->[Advanced]
[X] Platform MBean Server Enabled
[X] Platform MBean Server Used

b) [domain name]->[Security][General]
[X] Anonymous Admin Lookup Enabled




make sure each server listens on a different jmx port:
vi /opt/oracle/domains/osbpl1do/bin/setDomainEnv.sh

if [ "${SERVER_NAME}" = "osbpl1ms1" ] ; then
JAVA_OPTIONS="${JAVA_OPTIONS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder"
fi


if [ "${SERVER_NAME}" = "osbpl1as" ] ; then
JAVA_OPTIONS="${JAVA_OPTIONS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8889 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder"
fi



restart your servers

To monitor a DataSource Active Connections:

vi myds.json:

{
  "servers" : [ {
    "port" : "25006",
    "host" : "myhost.acme.com",
    "queries" : [ {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {
        }
      } ],
      "obj" : "com.bea:ServerRuntime=acme-server-1,Name=acme-import.PickupPointDS,Type=JDBCDataSourceRuntime",
      "attr" : [ "ActiveConnectionsCurrentCount" ]
    }, {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {
        }
      } ],
      "obj" : "java.lang:name=CMS Old Gen,type=MemoryPool",
      "attr" : [ "Usage" ]
    }, {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {
        }
      } ],
      "obj" : "java.lang:name=ConcurrentMarkSweep,type=GarbageCollector",
      "attr" : [ "LastGcInfo" ]
    } ],
    "numQueryThreads" : 2
  } ]
}



./jmxtrans.sh start myds.json

you should get this

Result [attributeName=ActiveConnectionsCurrentCount, className=weblogic.jdbc.common.internal.DataSourceRuntimeMBeanImpl, typeName=Name=acme-import.PickupPointDS,ServerRuntime=acme-server-1,Type=JDBCDataSourceRuntime, values={ActiveConnectionsCurrentCount=0}, epoch=1385119401592]

To find the ObjectName (like: com.bea:ServerRuntime=acme-server-1,Name=acme-import.PickupPointDS,Type=JDBCDataSourceRuntime ) you connect to the Managed Server with WLST, serverRuntime(), then you cd to the MBean and you do "cmo", this will tell you the ObjectName. The attribute can be discovered wish "ls".

Thursday, November 21, 2013

Exception in HttpInboundMessageContext.close: java.net.SocketException: Socket closed

Apparently under VERY heavy load we get this error in a HTTP Business Service... still under investigation.

It's not using a nio muxer, so I don't this that the Patch 9552622 described in java.io.IOException: Broken Pipe Seen Frequently in WebLogic Server Logs (Doc ID 1476825.1) really applies...


####<Nov 20, 2013 9:10:28 PM CET> <Error> <WliSbTransports> <myhost> <osbpr1ms1> <[ACTIVE] ExecuteThread: '100' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <4cea82998b9a2c15:7ce38336:1427138d527:-8000-00000000000af294> <1384978228423> <BEA-381304> <Exception in HttpInboundMessageContext.close: java.net.SocketException: Socket closed
java.net.SocketException: Socket closed
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at weblogic.servlet.internal.ChunkOutput.writeChunkTransfer(ChunkOutput.java:568)
        at weblogic.servlet.internal.ChunkOutput.writeChunks(ChunkOutput.java:539)
        at weblogic.servlet.internal.ChunkOutput.flush(ChunkOutput.java:427)
        at weblogic.servlet.internal.CharsetChunkOutput.flush(CharsetChunkOutput.java:298)
        at weblogic.servlet.internal.ChunkOutput$2.checkForFlush(ChunkOutput.java:648)
        at weblogic.servlet.internal.CharsetChunkOutput.write(CharsetChunkOutput.java:200)
        at weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:148)
        at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:148)
        at org.apache.xmlbeans.impl.store.Cursor._save(Cursor.java:590)
        at org.apache.xmlbeans.impl.store.Cursor.save(Cursor.java:2537)
        at org.apache.xmlbeans.impl.values.XmlObjectBase.save(XmlObjectBase.java:223)
        at com.bea.wli.sb.sources.XmlObjectSource.writeTo(XmlObjectSource.java:92)
        at com.bea.wli.sb.sources.OutboundXOPSource.writeTo(OutboundXOPSource.java:116)
        at com.bea.wli.sb.transports.http.HttpInboundMessageContext.close(HttpInboundMessageContext.java:264)
        at sun.reflect.GeneratedMethodAccessor882.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.bea.wli.sb.transports.Util$4.invoke(Util.java:351)
        at $Proxy165.close(Unknown Source)
        at com.bea.wli.sb.pipeline.MessageProcessor.finishProcessing(MessageProcessor.java:398)
        at com.bea.wli.sb.pipeline.RouterCallback.onReceiveResponse(RouterCallback.java:108)
        at com.bea.wli.sb.pipeline.RouterCallback.run(RouterCallback.java:183)
        at weblogic.work.ContextWrap.run(ContextWrap.java:41)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)






Wednesday, November 20, 2013

Tuesday, November 19, 2013

whoami vs who am i

ok this is like Linux 101:
[root@osb-vagrant ~]# who am i
root     pts/1        2013-11-19 11:01 (10.0.2.2)
[root@osb-vagrant ~]# whoami
root
[root@osb-vagrant ~]# sudo -u soa whoami
soa
[root@osb-vagrant ~]# sudo -u soa who am i
root     pts/1        2013-11-19 11:01 (10.0.2.2)


So if you allow some user to sudo a command, and you want to log who that user is, you should use "who am i" and not "whoami".

Monday, November 18, 2013

Maven hell as usual: No connector available ...

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project AcmeScripts: Failed to deploy artifacts/metadata: No connector available to access repository acme-repository (${acme.deploy.url}) of type default using the available factories WagonRepositoryConnectorFactory -> [Help 1]
Never seen this wagon anywhere.
In reality the issue was that in my pom.xml I had:
<version>1.0</version>
instead of
<version>1.0-SNAPSHOT</version>


Maven is an incredible piece of shit and I am more and more persuaded of it every time I use it.




Installing WebLogic: no space left on device

if you run the generic installer, be aware that it will unzip a load of stuff in the /tmp directory.
You might get a "no space left on device".
Run "df -m" to check how much space you have on /tmp... I guess it should be some 1.5 G at least.

If you can't increase /tmp, the workaround is to specify a tmpdir:

java -Djava.io.tmpdir=/vagrant -jar /opt/oracle/software/wls1035_generic.jar -mode=silent -silent_xml=/opt/oracle/bin/software/silent_${SOA_USER}.xml



Sunday, November 17, 2013

WLST reading a property file

thepropertyfile is a regular property file:
bla=value1
mumble=value2=3

This function handles also the case where a value contains a = sign


def getProperties(thepropertyfile):
    properties = dict()
    for line in open(thepropertyfile):
        strippedline = line.strip()
        if "=" in strippedline:
            key,value = line.strip().split('=', 1)
            properties[key] = value
    return properties


to get the value, do properties.get('bla')


Friday, November 15, 2013

Thread Deadlock on OSB today

Strange, I have never seen this before... maybe it's because 2 people with the same userid were using the console at the same time.



***************************************************************************************
<Nov 15, 2013 12:30:33 PM CET> <Critical> <WebLogicServer> <BEA-000394> <

DEADLOCK DETECTED:
==================

[deadlocked thread] [ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)':
--------------------------------------------------------------------------------------------------
Thread '[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'' is waiting to acquire lock 'com.bea.wli.config.component.impl.ReferenceMap@4d86f1a3' that is held by thread '[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)''

Stack trace:
------------
        com.bea.wli.config.component.impl.ReferenceMap.getAncestorsOrDescendents(ReferenceMap.java:820)
        com.bea.wli.sb.transports.TransportDependencyUtils.computeExternalRefs(TransportDependencyUtils.java:97)
        com.bea.wli.sb.transports.TransportDependencyUtils.completeResourcesDependencies(TransportDependencyUtils.java:409)
        com.bea.wli.sb.transports.ResourceLifecycleListenerImpl.changesCommitted(ResourceLifecycleListenerImpl.java:158)
        com.bea.wli.sb.transports.TransportManagerImpl.changesCommitted(TransportManagerImpl.java:1205)
        com.bea.wli.sb.service.ServiceChangeListener.changesCommitted(ServiceChangeListener.java:146)
        com.bea.wli.config.impl.ResourceListenerNotifier.afterEnd(ResourceListenerNotifier.java:120)
        com.bea.wli.config.transaction.TransactionListenerWrapper.afterEnd(TransactionListenerWrapper.java:90)
        com.bea.wli.config.transaction.TransactionManager.notifyAfterEnd(TransactionManager.java:1154)
        com.bea.wli.config.transaction.TransactionManager.commit(TransactionManager.java:1519)
        com.bea.wli.config.transaction.TransactionManager._endTransaction(TransactionManager.java:842)
        com.bea.wli.config.transaction.TransactionManager.endTransaction(TransactionManager.java:783)
        com.bea.wli.config.deployment.server.ServerDeploymentReceiver$2.run(ServerDeploymentReceiver.java:275)
        weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        com.bea.wli.config.deployment.server.ServerDeploymentReceiver.commit(ServerDeploymentReceiver.java:260)
        weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
        weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
        weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
        weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
        weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

[deadlocked thread] [ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)':
--------------------------------------------------------------------------------------------------
Thread '[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'' is waiting to acquire lock 'com.bea.wli.config.transaction.TransactionManager@56622c18' that is held by thread '[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)''

Stack trace:
------------
        com.bea.wli.config.transaction.TransactionManager.enlistAsRead(TransactionManager.java:972)
        com.bea.wli.config.transaction.CopyOnWriteTransactionalOwner.getState(CopyOnWriteTransactionalOwner.java:65)
        com.bea.wli.config.transaction.TransactionalSet$1.access(TransactionalSet.java:80)
        com.bea.wli.config.transaction.TransactionalSet$1.access(TransactionalSet.java:78)
        com.bea.wli.config.transaction.CopyOnWriteAccessor.access(CopyOnWriteAccessor.java:50)
        com.bea.wli.config.transaction.CopyOnWriteAccessors$CopyOnWriteIterator.<init>(CopyOnWriteAccessors.java:47)
        com.bea.wli.config.transaction.TransactionalSet$1.<init>(TransactionalSet.java:78)
        com.bea.wli.config.transaction.TransactionalSet.iterator(TransactionalSet.java:78)
        com.bea.wli.config.component.impl.ReferenceMap.getNumDependents(ReferenceMap.java:731)
        com.bea.wli.config.task.impl.GetMetadataTask.getMetadata(GetMetadataTask.java:113)
        com.bea.wli.config.task.impl.GetMetadataTask._execute(GetMetadataTask.java:87)
        com.bea.wli.config.task.impl.GetMetadataTask._execute(GetMetadataTask.java:41)
        com.bea.wli.config.task.impl.SessionedTask$1.execute(SessionedTask.java:233)
        com.bea.wli.config.transaction.TransactionalTask._doExecute(TransactionalTask.java:217)
        com.bea.wli.config.transaction.TransactionalTask._doExecuteWithRetry(TransactionalTask.java:162)
        com.bea.wli.config.transaction.TransactionalTask.doExecute(TransactionalTask.java:142)
        com.bea.wli.config.task.impl.SessionedTask.doExecute(SessionedTask.java:236)
        com.bea.wli.config.task.impl.SessionedTask.doExecute(SessionedTask.java:191)
        com.bea.wli.config.task.impl.GetMetadataTask.getMetadata(GetMetadataTask.java:67)
        com.bea.wli.config.mbeans.Config.getMetadata(Config.java:206)
        com.bea.wli.config.mbeans.Config.getMetadata(Config.java:201)
        sun.reflect.GeneratedMethodAccessor614.invoke(Unknown Source)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        java.lang.reflect.Method.invoke(Method.java:597)
        com.bea.alsb.console.support.ConsoleSideMBeanInvocationHandler.__invoke(ConsoleSideMBeanInvocationHandler.java:113)
        com.bea.alsb.console.support.ConsoleSideMBeanInvocationHandler.invoke(ConsoleSideMBeanInvocationHandler.java:71)
        $Proxy158.getMetadata(Unknown Source)
        com.bea.alsb.console.projects.ProjectsHelper.getFoldersMetadata(ProjectsHelper.java:255)
        com.bea.alsb.console.projects.ProjectsHelper.getSortedFoldersMetadata(ProjectsHelper.java:237)
        jsp_servlet._jsp._projects.__projectstree$1ProjectsTree.getFolders(__projectstree.java:201)
        jsp_servlet._jsp._projects.__projectstree$1ProjectsTree.getFolders(__projectstree.java:217)
        jsp_servlet._jsp._projects.__projectstree$1ProjectsTree.getProjectsTreeNodes(__projectstree.java:188)
        jsp_servlet._jsp._projects.__projectstree._jspService(__projectstree.java:248)
        weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
        weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
        weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        org.apache.beehive.netui.pageflow.PageFlowPageFilter.continueChainNoWrapper(PageFlowPageFilter.java:455)
        org.apache.beehive.netui.pageflow.PageFlowPageFilter.runPage(PageFlowPageFilter.java:432)
        org.apache.beehive.netui.pageflow.PageFlowPageFilter.doFilter(PageFlowPageFilter.java:284)
        weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:524)
        weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:444)
        org.apache.beehive.netui.pageflow.scoping.internal.ScopedRequestDispatcher.include(ScopedRequestDispatcher.java:119)
        com.bea.netuix.servlets.controls.content.JspContent.beginRender(JspContent.java:552)
        com.bea.netuix.servlets.controls.content.NetuiContent.beginRender(NetuiContent.java:365)
        com.bea.netuix.nf.ControlLifecycle$7.visit(ControlLifecycle.java:485)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:518)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:220)
        com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
        com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
        com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
        com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:326)
        com.bea.netuix.nf.UIControl.render(UIControl.java:582)
        com.bea.netuix.servlets.controls.PresentationContext.render(PresentationContext.java:486)
        com.bea.netuix.servlets.util.RenderToolkit.renderChild(RenderToolkit.java:146)
        com.bea.netuix.servlets.jsp.taglib.RenderChild.doStartTag(RenderChild.java:62)
        jsp_servlet._framework._skeletons._wliconsole.__flowlayout._jspService(__flowlayout.java:271)
        weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
        weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
        weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
        weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526)
        weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:444)
        com.bea.netuix.servlets.controls.application.laf.JspTools.renderJsp(JspTools.java:130)
        com.bea.netuix.servlets.controls.application.laf.JspControlRenderer.beginRender(JspControlRenderer.java:72)
        com.bea.netuix.servlets.controls.application.laf.PresentationControlRenderer.beginRender(PresentationControlRenderer.java:65)
        com.bea.netuix.nf.ControlLifecycle$7.visit(ControlLifecycle.java:481)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:518)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:220)
        com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
        com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
        com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
        com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:326)
       com.bea.netuix.nf.UIControl.render(UIControl.java:582)
        com.bea.netuix.servlets.controls.PresentationContext.render(PresentationContext.java:486)
        com.bea.netuix.servlets.util.RenderToolkit.renderChild(RenderToolkit.java:146)
        com.bea.netuix.servlets.jsp.taglib.RenderChild.doStartTag(RenderChild.java:62)
        jsp_servlet._framework._skeletons._wliconsole.__gridlayout._jspService(__gridlayout.java:312)
        weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
        weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
        weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
        weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526)
        weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:444)
        com.bea.netuix.servlets.controls.application.laf.JspTools.renderJsp(JspTools.java:130)
        com.bea.netuix.servlets.controls.application.laf.JspControlRenderer.beginRender(JspControlRenderer.java:72)
        com.bea.netuix.servlets.controls.application.laf.PresentationControlRenderer.beginRender(PresentationControlRenderer.java:65)
        com.bea.netuix.nf.ControlLifecycle$7.visit(ControlLifecycle.java:481)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:518)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
        com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:220)
        com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
        com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
        com.bea.netuix.nf.Lifecycle.runOutbound(Lifecycle.java:208)
        com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:162)
        com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
        com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
        com.bea.netuix.servlets.manager.UIServlet.doGet(UIServlet.java:211)
        com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:196)
        com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)
        weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
        weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
        java.security.AccessController.doPrivileged(Native Method)
        oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
        oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
        oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
        oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
        oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
        weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
        weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
        weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
        weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
        weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
        weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
        weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

>
<Nov 15, 2013 12:30:34 PM CET> <Critical> <Health> <BEA-310006> <Critical Subsystem core has failed. Setting server state to FAILED.
Reason: Thread deadlock detected>
<Nov 15, 2013 12:30:34 PM CET> <Critical> <WebLogicServer> <BEA-000385> <Server health failed. Reason: health of critical service 'core' failed>




Tuesday, November 12, 2013

Bing, one more reason to hate Microsoft (just in case you didn't have already several millions)

Tonight I carelessly run a "Windows Update install all" and, much with my dismay, I found it installed Bing Desktop, it messed with my desktop background, with my Firefox settings (gmail opened each mail in a new windows) and god knows what else.

I tried to uninstall Bing Desktop and it said another installation was going on (???) ... so I had to restart, uninstall Bing desktop, restart again.... finally all seems ok.

If Microsoft has to use these VIRAL way of promoting their products, to me it seems like those door-to-door salesmen who put a foot across your door to prevent you from shutting the door on their face.

Pathetic.Microsoftic.

Puppet instant weblogic installation module in 30 seconds




define weblogic($user = 'soa') {

  $optpath = '/opt'
  $nmPort = '5556'
  $oracle_home = "${optpath}/oracle"
  $user_home = '/home/'
  $bea_home = "${oracle_home}/fmw11_1_1_5"
  $java_home = "/${optpath}/oracle/java"
  $java_home_target = '/usr/lib/jvm/jre-1.6.0-sun.x86_64/bin/java'
  $software_home = '/opt/oracle/software'

  group { 'soa' :
    ensure => 'present',
  }


  user { 'soa':
    ensure     => 'present',
    gid        => 'soa',
    home       => "/${user_home}/soa",
    password   => 'changeme',
    managehome => true,
  }

 
  # create /home/soa?/.bashrc

  file { "/${user_home}/${user}/.bashrc":
    ensure  => present,
    content => template('weblogic/bashrc.erb'),
    require => User["${user}"],
    owner   => "${user}",
  }


  file { "${optpath}":
    ensure => 'directory',
    owner  => 'root',
    group  => 'root',
    mode   => '0755'
  }

 

  file { ["${software_home}"]:
    ensure  => 'directory',
    owner   => 'soa',
    require => User['soa'],
  }

 

  file { "${java_home}":
    ensure => link,
    target => "${java_home_target}"
  }

 

  file { ["${oracle_home}", "${bea_home}"]:
    ensure  => 'directory',
    owner   => "${user}",
    require => User["${user}"],
  }

 

  file { ["${optpath}/var/", "${optpath}/var/log/", "${optpath}/var/log/weblogic/", "${optpath}/var/log/weblogic/server",
          "${optpath}/var/log/weblogic/nodemanager", "${optpath}/var/log/weblogic/scripts"]:
    ensure  => directory,
    owner   => $user,
    require => User[$user],
  }


  # download WebLogic jars

  file { 'wls1035_generic.jar':
 ensure => present,
 source => 'puppet:///modules/weblogic/wls1035_generic.jar',
        target => "${software_home}/wls1035_generic.jar",
  }

  file { "${software_home}/silent_${user}.xml":
    ensure  => present,
    content => template('weblogic/silent.xml.erb'),
    require => File["${oracle_home}"]
  }


  # execute silent installation
  exec { 'weblo-silent-install':
    command => "java -d64 -jar wls1035_generic.jar -mode=silent -silent_xml=silent_${user}.xml",
    cwd     => "${software_home}",
    path    => '/usr/bin:/bin',
    creates => "${bea_home}/registry.xml",
    require => [Nexus::Download['wls1035_generic.jar'], File["${software_home}/silent_${user}.xml"], ],

  }

}




all you need to do is to provide a silent.xml.erb and a bashrc.erb in the templates folder, plus the wls1035_generic.jar file in the files folder of the same weblogic module.

It might not be elegant but it's really simple and it works.



Calling an Oracle Stored Procedure in Java or in Python

I needed to schedule the execution of a Stored Procedure from a cron job.... somebody advised me to use a Java class to do that.
It proved to be really cumbersome... I have followed this example and it's working, but it's very verbose and ugly.
Also, in Java there is no built-in support for getopt style of reading CLI parameters, and using the gnu getopt library seemed overkill to me.
So at the end I will keep using good old zxJDBC from a Python (WLST) script, which supports stored procedures in a VERY simple way: http://www.jython.org/archive/21/docs/zxjdbc.html
db = zxJDBC.connect(...)
c = db.cursor()
params = [None]
c.callproc("funcout", params)

The only disturbing thing is that the startup time for WLST is a bit long, much longer than for a JVM.... but who cares, really, for a job who has to be called once every 10 minutes...


Friday, November 8, 2013

tar gzip exclude folder

Rule n.1:

never run tar inside the same folder you are tarring: tar will include the tar-file that it's creating... CRAZY!

Rule n. 2:

--exclude works only if it's the first parameter after tar... IN SOME versions of tar ONLY.... CRAZY!
in my version it has to come last.
cd /opt/oracle/backups
tar cvzf osbpr1dobackup11Nov2013_108.tar.gz /opt/oracle/domains/osbpr1do/ --exclude="shared/store/jms"


Rule n. 3:

if the exclude folder ends in /, tar will ignore it without warning.... CRAZY!

Rule n. 4:

The exclude parameter shoule be relative to the -C path:

this is good:

tar cvzf /opt/oracle/backups/deleteme.tar.gz -C /opt/oracle/bin/ . --exclude="src"

this is bad:

tar cvzf /opt/oracle/backups/deleteme.tar.gz -C /opt/oracle/bin/ . --exclude="/opt/oracle/bin/src"

That's why I never use tar but rather jar.

Thursday, November 7, 2013

Book: Anatomy of Fascism, by Paxton



Those soul who have been mesmerized by the likes of Orwell's "1984" or Huxley's "Brave New World", will appreciate the unrelenting rationalism by which Paxton dissect the phenomenon of Fascism, delving deep in the social and financial root causes of Europe's plunge into dictatorship.

While the World is plunging into a global form of Fiscal Fascism, where Corporations replace States and exert a totalitarian control on their subjects - with the ultimate goal of sucking all their riches - it helps to indulge in a retrospective analysis which entitles us to call these modern times a modern form of Fascism.



Sunday, November 3, 2013

bash scripts organized with rerun

A small "rerun tutorial" or "getting started with rerun".
Rerun wiki: https://github.com/rerun/rerun/wiki

Download the rpm here

#remember to do export http_proxy=http://myuser:mypw@proxy.acme.com:8080

wget http://repository-stagrlee.forge.cloudbees.com/release/rpms/rerun/rerun-1.0.2-1.fc17.noarch.rpm
rpm -i rerun-1.0.2-1.fc17.noarch.rpm
rerun
Available modules in "/usr/lib/rerun/modules":
stubbs: "Simple rerun module builder" - 1.0.2


then I download https://github.com/downloads/rerun-modules/rerun-modules/rerun-modules-repo-1.0-21.noarch.rpm, copy it locally (wget doesn't work with https on github, no clue...)
and I do:

rpm -i rerun-modules-repo-1.0-21.noarch.rpm

this one didn't work for me (connectivity problems) but it's not essential:
yum -y --disablerepo '*' --enablerepo 'rerun-modules' install '*'


I create my first module

rerun stubbs: add-module
Module name:
pippo
Module description:
my first rerun
Created module structure: /usr/lib/rerun/modules/pippo.


If you look in /usr/lib/rerun/modules/pippo, there is a lib folder - containing an empty functions.sh - and a command folder.

rerun stubbs:add-command
Module:
1) pippo
2) stubbs
#? 1
You picked module pippo (1)
Command:
hello
Description:
say hello
Wrote command script: /usr/lib/rerun/modules/pippo/commands/hello/script
Wrote test script: /usr/lib/rerun/modules/pippo/tests/hello-1-test.sh

then I add an option to the command:
rerun stubbs:add-option

Module:
1) pippo
2) stubbs
#? 1
You picked module pippo (1)
Command:
1) hello
#? 1
You picked command hello (1)
Option:
name
Description:
the person to greet
Required:
1) true
2) false
#? 1
Export:
1) true
2) false
#? 1
Default:
Pierre
Wrote option metadata: /usr/lib/rerun/modules/pippo/options/name/metadata
Updated command metadata:  /usr/lib/rerun/modules/pippo/commands/hello/metadata
Updated command script header: /usr/lib/rerun/modules/pippo/commands/hello/script



vi /usr/lib/rerun/modules/pippo/commands/hello/script
and after this text:
# - - -
# Put the command implementation here.
# - - -

I enter this: echo name is $NAME

I run it:

rerun pippo:hello --name Luigi
name is Luigi

and rerun it:

rerun pippo:hello
name is Pierre

Ok at least we have proven that it can can be made to work...

Saturday, November 2, 2013

git clone failing with Failed connect to github.com:443

On my RHEL box I tried:
git clone https://github.com/graphite-project/graphite-web.git
Initialized empty Git repository in /home/vagrant/graphite-web/.git/
and it was hanging and finally giving HTTP timeout error.
I tried then
export http_proxy=http://myuser:mypassword@myproxy:8080
and again
git clone https://github.com/graphite-project/graphite-web.git
Initialized empty Git repository in /home/vagrant/graphite-web/.git/
error: Failed connect to github.com:443; Operation now in progress while accessing https://github.com/graphite-project/graphite-web.git/info/refs

fatal: HTTP request failed

finally I did:
git config --global http.proxy http://myuser:mypassword@myproxy:8080
git clone https://github.com/graphite-project/graphite-web.git and I got the magic
Initialized empty Git repository in /home/vagrant/graphite-web/.git/
remote: Counting objects: 13933, done.
remote: Compressing objects: 100% (5434/5434), done.
remote: Total 13933 (delta 9025), reused 13065 (delta 8316)
Receiving objects: 100% (13933/13933), 17.15 MiB | 527 KiB/s, done.
Resolving deltas: 100% (9025/9025), done.


If you expected such a widely used product like git to give you some hint on how to troubleshoot such a common issue, you are expecting in vain, git is for geeks and geeks are not user friendly.



OSB: WLST to enable monitoring on Proxy Services

If there is something boring is having to manually enable/disable monitoring at Pipeline/STage/Action level on Proxy/Business services, with same or different aggregation interval.
Unfortunately OSB configuration API is not very friendly. ProxyServiceConfigurationMBean inherits the method enableMonitoring from its parent class CommonServiceConfigurationMBean.
Unfortunately in the method signature there is no mention of the extra parameters : level and aggregation period.
Here is the code:
#There is a change to do to be able to run this WLST script:
#vi /opt/oracle/fmw11_1_1_5/osb/common/bin/wlst.sh
#change this:
#export CLASSPATH
#into this:
#CLASSPATH=/opt/oracle/fmw11_1_1_5/osb/lib/sb-kernel-api.jar:/opt/oracle/fmw11_1_1_5/osb/lib/sb-kernel-impl.jar:/opt/oracle/fmw11_1_1_5/osb/modules/com.bea.common.configfwk_1.5.0.0.jar:$CLASSPATH
#export CLASSPATH


import javax.management
import java.util
import javax.management.remote
import javax.naming
import weblogic.management.mbeanservers.domainruntime
import com.bea.wli.sb.management.configuration

from java.util import Hashtable
from java.util import HashSet
from javax.management.remote import JMXServiceURL
from weblogic.management.mbeanservers.domainruntime import DomainRuntimeServiceMBean
from javax.naming import Context
from javax.management.remote import JMXConnectorFactory
from javax.management import ObjectName
from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
import weblogic.management.jmx.MBeanServerInvocationHandler
from com.bea.wli.config import Ref

from com.bea.wli.config.env import EnvValueQuery
from com.bea.wli.config.env import QualifiedEnvValue
from com.bea.wli.config.resource import DependencyQuery
from com.bea.wli.sb.management.query import ProxyServiceQuery
from com.bea.wli.sb.management.query import BusinessServiceQuery

from com.bea.wli.sb.util import EnvValueTypes
from java.util import Collection
from java.util import Collections


def setMonitoringAllProjectsAndServices(isEnabled):
    refs = configMBean.getRefs(Ref.DOMAIN)
    refsList = ArrayList()
    refsList.addAll(refs)
    
    for ref in refsList :
        if ref.getTypeId() == "ProxyService" or ref.getTypeId() == "BusinessService" :
            if ref.getTypeId() == "ProxyService" :
                isPS = "1"
            else:
                isPS =  "0"
            if isEnabled:
                print "enabling monitoring for ", ref.getFullName()
                proxyServiceConfigurationMBean.enableMonitoring(ref)
            else:
                print "disabling monitoring for ", ref.getFullName()
                proxyServiceConfigurationMBean.disableMonitoring(ref)



sessionName = "Session to enable or disable monitoring"
hostname='myhost.acme.com'
port=9001
username='Pierluigi'
password='pippo'
serviceURL=JMXServiceURL("t3", hostname, port, "/jndi/" + DomainRuntimeServiceMBean.MBEANSERVER_JNDI_NAME)
h=Hashtable()
h.put(Context.SECURITY_PRINCIPAL, username)
h.put(Context.SECURITY_CREDENTIALS, password)
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote")

conn = JMXConnectorFactory.connect(serviceURL, h)

mbconn = conn.getMBeanServerConnection()

sm = JMX.newMBeanProxy(mbconn, ObjectName.getInstance(SessionManagementMBean.OBJECT_NAME), SessionManagementMBean)

sm.createSession(sessionName)

configMBean = JMX.newMBeanProxy(mbconn, ObjectName.getInstance("com.bea:Name=" + ALSBConfigurationMBean.NAME + "." + sessionName + ",Type=" + ALSBConfigurationMBean.TYPE), ALSBConfigurationMBean)

domainService = weblogic.management.jmx.MBeanServerInvocationHandler.newProxyInstance(mbconn, ObjectName(DomainRuntimeServiceMBean.OBJECT_NAME), DomainRuntimeServiceMBean, false)

proxyServiceConfigurationMBean = domainService.findService(String("ProxyServiceConfiguration.").concat(sessionName),'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean', None)

setMonitoringAllProjectsAndServices(true)



sm.activateSession(sessionName, "Complete enable/disable service monitoring")
conn.close()




yum fails installing git on RHEL: There was an error communicating with RHN

yum install git-core
Loaded plugins: product-id, rhnplugin, security
There was an error communicating with RHN.
RHN Satellite or RHN Classic support will be disabled.
Error communicating with server. The message was:
Name or service not known
Setting up Install Process
No package git-core available.
Error: Nothing to do
First I check in cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d


and nothing seems wrong.
Then I check in
cat /etc/sysconfig/rhn/up2date

# Automatically generated Red Hat Update Agent config file, do not edit.
# Format: 1.0
tmpDir[comment]=Use this Directory to place the temporary transport files
tmpDir=/tmp

disallowConfChanges[comment]=Config options that can not be overwritten by a config update action
disallowConfChanges=noReboot;sslCACert;useNoSSLForPackages;noSSLServerURL;serverURL;disallowConfChanges

skipNetwork[comment]=Skips network information in hardware profile sync during registration.
skipNetwork=0

stagingContent[comment]=Retrieve content of future actions in advance
stagingContent=1

networkRetries[comment]=Number of attempts to make at network connections before giving up
networkRetries=1

hostedWhitelist[comment]=RHN Hosted URL's
hostedWhitelist=

enableProxy[comment]=Use a HTTP Proxy
enableProxy=0

writeChangesToLog[comment]=Log to /var/log/up2date which packages has been added and removed
writeChangesToLog=0

serverURL[comment]=Remote server URL (use FQDN)
serverURL=http://pluto.pippo.com/XMLRPC

proxyPassword[comment]=The password to use for an authenticated proxy
proxyPassword=

stagingContentWindow[comment]=How much forward we should look for future actions. In hours.
stagingContentWindow=24

proxyUser[comment]=The username for an authenticated proxy
proxyUser=

versionOverride[comment]=Override the automatically determined system version
versionOverride=

sslCACert[comment]=The CA cert used to verify the ssl server
sslCACert=/usr/share/rhn/RHNS-CA-CERT

retrieveOnly[comment]=Retrieve packages only
retrieveOnly=0

debug[comment]=Whether or not debugging is enabled
debug=0

httpProxy[comment]=HTTP proxy in host:port format, e.g. squid.redhat.com:3128
httpProxy=

useNoSSLForPackages[comment]=Use the noSSLServerURL for package, package list, and header fetching (disable Akamai)
useNoSSLForPackages=0

systemIdPath[comment]=Location of system id
systemIdPath=/etc/sysconfig/rhn/systemid

enableProxyAuth[comment]=To use an authenticated proxy or not
enableProxyAuth=0

noReboot[comment]=Disable the reboot actions
noReboot=0

The "serverURL=http://pluto.pippo.com/XMLRPC" looks suspicious, since I am not in the pippo.com network...there must be some proxy issue here... but enableProxy is 0!!!

I find some light here. But they don't say what the "default Red Hat Network URL" is... bloody hell...

If I comment out the serverURL I get:

yum install git-core
Loaded plugins: product-id, rhnplugin, security
There was an error communicating with RHN.
RHN Satellite or RHN Classic support will be disabled.

Error Message:
        Please run rhn_register as root on this client
Error Class Code: 9
Error Class Info: Invalid System Credentials.
Explanation:
     An error has occurred while processing your request. If this problem
     persists please enter a bug report at bugzilla.redhat.com.
     If you choose to submit the bug report, please be sure to include
     details of what you were trying to do when this error occurred and
     details on how to reproduce this problem.



Ok it looks like I need some good RH training...



JMXTrans and Graphite: getting started

You can achieve very decent monitoring of a Java application - including the JVM itself - with jmxtrans and graphite .

No more horrible hand-crafted tool to extract and chart JMS data.

A TRANS in Italian is a transexual, typically Brazilian - more knows as VIADOS - so hearing JMXTrans always puts me in a good mood because Italians like to make jokes about sex.

OK, let's be serious.
First read the excellent jmxtrans Wiki here.
As suggested by jmstrans site, I listened to the presentation by Coda Hale but frankly it didn't say much new, he speaks well but not very informative

Getting started:
download the tar.gz here

tar xvzf jmxtrans-242.tar.gz
cd jmxtrans-242/rpm
.... mmm when I run build.sh it asks me a release and version?????


I will download a rpm from here (instructions on the site are incomplete... not good...)

rpm -i jmxtrans-20121016.145842.6a28c97fbb-0.noarch.rpm

I verify the installation parameters:
less /etc/sysconfig/jmxtrans

# configuration file for package jmxtrans
export JAR_FILE="/usr/share/jmxtrans/jmxtrans-all.jar"
export LOG_DIR="/var/log/jmxtrans"
export SECONDS_BETWEEN_RUNS=60
export JSON_DIR="/var/lib/jmxtrans"
export HEAP_SIZE=512
export NEW_SIZE=64
export CPU_CORES=2
export NEW_RATIO=8
export LOG_LEVEL=debug


cd /usr/share/jmxtrans
./jmxtrans.sh
Usage: ./jmxtrans.sh {start|stop|restart|status} [filename.json]


I look into an example.json
{
  "servers" : [ {
    "port" : "1099",
    "host" : "w2",
    "queries" : [ {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {
        }
      } ],
      "obj" : "java.lang:type=Memory",
      "attr" : [ "HeapMemoryUsage", "NonHeapMemoryUsage" ]
    }, {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {
        }
      } ],
      "obj" : "java.lang:name=CMS Old Gen,type=MemoryPool",
      "attr" : [ "Usage" ]
    }, {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {
        }
      } ],
      "obj" : "java.lang:name=ConcurrentMarkSweep,type=GarbageCollector",
      "attr" : [ "LastGcInfo" ]
    } ],
    "numQueryThreads" : 2
  } ]
}

(I still need to decide if I hate more JSON or XML... they both hurt the eye...)

I write a sample Java class to monitor:
vi Sample.java
public class Sample {
        public static void main(String[] args) {
            try {
                Thread.sleep(100000000);
            }
            catch (Exception e) {};
        }
}


javac Sample.java
java -Dcom.sun.management.jmxremote.port=1105 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false Sample

cp example.json sample.json
I edit port number and host to match 1105 and my localhost

./jmxtrans.sh start sample.json

this runs in background :
ps -ef | grep jmxtrans
root 2240 1 6 07:47 pts/1 00:00:15 /usr/bin/java -server -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djmxtrans.log.level=debug -Djmxtrans.log.dir=. -Xms512M -Xmx512M -XX:+UseConcMarkSweepGC -XX:NewRatio=8 -XX:NewSize=64m -XX:MaxNewSize=64m -XX:MaxTenuringThreshold=16 -XX:GCTimeRatio=9 -XX:PermSize=384m -XX:MaxPermSize=384m -XX:+UseTLAB -XX:CMSInitiatingOccupancyFraction=85 -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=1 -Dsun.rmi.dgc.server.gcInterval=28800000 -Dsun.rmi.dgc.client.gcInterval=28800000 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=2101 -jar jmxtrans-all.jar -e -f sample.json -s 60


and if I do
tail -f jmxtrans.log
I get a line per minute:
[02 Nov 2013 07:47:22] [main] 0 INFO (com.googlecode.jmxtrans.JmxTransformer:134) - Starting Jmxtrans on : sample.json
[02 Nov 2013 07:47:23] [main] 1125 DEBUG (com.googlecode.jmxtrans.JmxTransformer:354) - Loaded file: /usr/share/jmxtrans/sample.json
[02 Nov 2013 07:47:23] [main] 1154 DEBUG (com.googlecode.jmxtrans.JmxTransformer:429) - Scheduled job: osb-vagrant.acme.com:1105-1383374843215-0158449004 for server: Server [host=osb-vagrant.acme.com, port=1105, url=null, cronExpression=null, numQueryThreads=2]
[02 Nov 2013 07:47:23] [ServerScheduler_Worker-1] 1167 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:31) - +++++ Started server job: Server [host=osb-vagrant.acme.com, port=1105, url=null, cronExpression=null, numQueryThreads=2]
[02 Nov 2013 07:47:23] [ServerScheduler_Worker-1] 1690 DEBUG (com.googlecode.jmxtrans.util.JmxUtils:102) - ----- Creating 3 query threads
[02 Nov 2013 07:47:24] [pool-1-thread-1] 1940 DEBUG (com.googlecode.jmxtrans.util.JmxUtils:195) - Executing queryName: java.lang:type=Memory from query: Query [obj=java.lang:type=Memory, resultAlias=null, attr=[HeapMemoryUsage, NonHeapMemoryUsage]]
[02 Nov 2013 07:47:24] [pool-1-thread-1] 2002 DEBUG (com.googlecode.jmxtrans.util.JmxUtils:209) - Finished running outputWriters for query: Query [obj=java.lang:type=Memory, resultAlias=null, attr=[HeapMemoryUsage, NonHeapMemoryUsage]]
[02 Nov 2013 07:47:24] [ServerScheduler_Worker-1] 2006 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:50) - +++++ Finished server job: Server [host=osb-vagrant.acme.com, port=1105, url=service:jmx:rmi:///jndi/rmi://osb-vagrant.acme.com:1105/jmxrmi, cronExpression=null, numQueryThreads=2]

Next step: install grafite and plot these metrics....

Megalopolis - Shenzhen

A great documentary by RAI 3 on China's "miracle" city Shenzhen
Unfortunately there are no English captions...








the music seems taken from the Quatsi Trilogy and quotations from Neuromancer


Friday, November 1, 2013

wlst redirect

sometimes we don't want to clutter the stdout with the result of a ls(): http://docs.oracle.com/cd/E15051_01/wls/docs103/config_scripting/using_WLST.html#wp1094015 This works quite well:
redirect('/dev/null', 'false')
allds=ls('/SystemResources/', returnMap='true')
stopRedirect()



Book: Hacking Linux Exposed


Once you skip the first 40 pages of usual publisher blablabla / what a waste of paper! / you will be impressed by the clarity and conciseness of the exposition. Bri Hatch is a first class technical writer. This book can be read also by beginners, because it guides you step by step without giving anything for granted.