Sunday, January 31, 2016

if you suffer of "slow favorites menu" in IE

if you suffer of "slow favorites menu" when you pass the mouse over, in IE, this fixed my problem:

In Control Panel, Folder Options, View tab, scroll to the bottom and uncheck “Show pop-up description for folders and desktop items”.
IE is a 1800 pound pig like this one http://weeklyworldnews.com/headlines/25815/1800-pound-pig/ , but please don't kill pigs, just use Firefox instead!


Tuesday, January 19, 2016

WebLogic deployment fails with java.lang.ArrayIndexOutOfBoundsException in com.bea.objectweb.asm.ClassReader.readClass

BEA-149205 Failed to initialize the application "BLA" due to error weblogic.application.ModuleException: 26
26
weblogic.application.ModuleException: 26
26
 at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
 at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:270)
 at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
 at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
 at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
 at weblogic.application.internal.flow.ModuleListenerInvoker.init(ModuleListenerInvoker.java:84)
 at weblogic.application.internal.flow.InitModulesFlow.initModule(InitModulesFlow.java:288)
 at weblogic.application.internal.flow.InitModulesFlow.initModules(InitModulesFlow.java:301)
 at weblogic.application.internal.flow.InitModulesFlow.prepare(InitModulesFlow.java:329)
 at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:706)
 at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
 at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:237)
 at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:61)
 at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
 at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
 at weblogic.deploy.internal.targetserver.AppDeployment.prepare(AppDeployment.java:155)
 at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:39)
 at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:191)
 at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
 at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
 at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
 at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
 at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:210)
 at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:118)
 at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
 at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:606)
 at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
 at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
 at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)
 at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
 at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
 at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
 at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
 at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
 at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
 at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
 at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
 at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
 at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
 at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
 at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
 at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
 at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
 at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
 at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
 at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
 at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
 at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused By: java.lang.ArrayIndexOutOfBoundsException: 26
 at com.bea.objectweb.asm.ClassReader.readClass(Unknown Source)
 at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
 at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
 at weblogic.application.utils.annotation.ClassInfoImpl.(ClassInfoImpl.java:42)
 at weblogic.application.utils.annotation.ClassfinderClassInfos.polulateOneClassInfo(ClassfinderClassInfos.java:240)
 at weblogic.application.utils.annotation.ClassfinderClassInfos.populateClassInfos(ClassfinderClassInfos.java:193)
 at weblogic.application.utils.annotation.ClassfinderClassInfos.(ClassfinderClassInfos.java:44)
 at weblogic.servlet.internal.War.initializeClassInfosIfNecessary(War.java:446)
 at weblogic.servlet.internal.War.getAnnotatedClasses(War.java:376)
 at weblogic.servlet.utils.WarUtils.isJsfApplication(WarUtils.java:258)
 at weblogic.servlet.internal.WebAppModule.detectJsfApplication(WebAppModule.java:277)
 at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:262)
 at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
 at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
 at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
 at weblogic.application.internal.flow.ModuleListenerInvoker.init(ModuleListenerInvoker.java:84)
 at weblogic.application.internal.flow.InitModulesFlow.initModule(InitModulesFlow.java:288)
 at weblogic.application.internal.flow.InitModulesFlow.initModules(InitModulesFlow.java:301)
 at weblogic.application.internal.flow.InitModulesFlow.prepare(InitModulesFlow.java:329)
 at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:706)
 at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
 at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:237)
 at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:61)
 at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
 at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
 at weblogic.deploy.internal.targetserver.AppDeployment.prepare(AppDeployment.java:155)
 at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:39)
 at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:191)
 at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
 at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
 at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
 at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
 at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:210)
 at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:118)
 at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
 at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:606)
 at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
 at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
 at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)
 at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
 at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
 at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
 at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
 at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
 at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
 at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
 at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
 at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
 at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
 at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
 at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
 at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
 at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
 at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
 at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
 at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
 at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
 at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)




In Oracle support I find that

Unable To Deploy An Application In WebLogic 12C That Works In WebLogic 10 (Doc ID 1565172.1)

WebLogic Server 12c (12.1.1 and higher) does a complete scan of all *.class files in an application when it is deployed. This is an enhancement over previous versions which prevents invalid Java classes being deployed with an application. However, in a few cases where there is an unused invalid class packaged with the application, deployment which succeeded in WLS 11g or earlier could fail in WebLogic 12c. See Note 1504269.1 for more information about a similar case. In that case, there was an invalid class file in the application being deployed. The problem wasn't caught by the previous JVM, but was caught in WLS 12.1.1. In the customer's case, there were files in the customer application which were not Java class files, but which were named with the .class extension. These files were scanned and validated on deployment of the application, and failed validation since they were not Java classes. This caused the deployment failure.


I restart the WLS server with -verbose:class, to find out that weblogic.application.utils.annotation.ClassfinderClassInfos is loaded from wlserver/modules/features/weblogic.server.merged.jar

I patch this class adding this println:
  private void polulateOneClassInfo(Source source)
    throws AnnotationProcessingException
  {
    if (source == null) {
      return;
    }
    System.out.println("polulateOneClassInfo: source=" + source.getURL().toString());



and I find out that the offending class is loaded from a JAR compiled with Java 1.4 (check the manifest.mf)

See also http://stackoverflow.com/questions/19152655/java-lang-arrayindexoutofboundsexception-while-deploying-app-in-wls-12



Sunday, January 17, 2016

EJB and JNDI, or how to lookup a EJB from a JSP


package ejb3.bean;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;

@Stateless(mappedName = "HelloEjb")
@LocalBean
public class HelloEjb implements HelloEjbRemote, HelloEjbLocal {

 public HelloEjb() {
 }

 public String printHello(String name) {
  return "Hello " + name;
 }

}



package ejb3.bean;

import javax.ejb.Remote;

@Remote
public interface HelloEjbRemote {
 String printHello(String name);
}


package ejb3.bean;

import javax.ejb.Local;

@Local
public interface HelloEjbLocal {
 String printHello(String name);
}




The LocalBean means a no-interface view .

This is what I find in JNDI tree:

Binding Name: HelloEjb#ejb3.bean.HelloEjbRemote (this is from @Remote)
Class: com.sun.proxy.$Proxy208


Binding Name: java:global.PVHelloEJBEAR.PVHelloEJB.HelloEjb!ejb3.bean.HelloEjb (this is from @LocalBean )
Class: ejb3.bean.HelloEjb_n3seu_NoIntfViewImpl


Binding Name: java:global.PVHelloEJBEAR.PVHelloEJB.HelloEjb!ejb3.bean.HelloEjbLocal (this is from @Local)
Class: ejb3.bean.HelloEjb_n3seu_HelloEjbLocalImpl


Binding Name: java:global.PVHelloEJBEAR.PVHelloEJB.HelloEjb!ejb3.bean.HelloEjbRemote (this is from @Remote again)
Class: com.sun.proxy.$Proxy208



where PVHelloEJBEAR.PVHelloEJB.HelloEjb are respectively: application name (from application.xml), ejb module name (from application.xml), ejb name (mappedName)
To lookup the EJB interface from a JSP:
HelloEjbRemote helloEjb = (HelloEjbRemote) context.lookup("HelloEjb#ejb3.bean.HelloEjbRemote");

or (it works also in a servlet) if the JSP is in a WAR the same EAR as the EJB module you can use the no-interface @LocalBean trick :
@EJB
private HelloEjb helloEjb;


If you provide a @EJB in the JSP/Servlet without having a @LocalBean annotation, you get this error:
Module named 'PVHelloEJBEAR' failed to redeploy. See Error Log view for more detail.
weblogic.management.DeploymentException: weblogic.application.naming.ReferenceResolutionException: [J2EE:160200]Error resolving ejb-ref "ejb3.bean.HelloEjb3Servlet/helloEjb" from module "PVHelloWAR.war" of application "PVHelloEJBEAR". The ejb-ref does not have an ejb-link and the JNDI name of the target bean has not been specified. Attempts to automatically link the ejb-ref to its target bean failed because no EJBs in the application were found to implement the "ejb3.bean.HelloEjb" interface. Link or map this ejb-ref to its target EJB and ensure the interfaces declared in the ejb-ref are correct.
Exception received from deployment driver. See Error Log view for more detail.



This is the documentation of @EJB : https://docs.oracle.com/javaee/6/api/javax/ejb/EJB.html

So if from your Servlet/JSP you want to access a REMOTE EJB (i.e. without LocalBean) you must change your @EJB lookup to:
@EJB(lookup="HelloEjb#ejb3.bean.HelloEjbRemote")
private HelloEjbRemote helloEjb;


or using the @Local interface:
@EJB
private HelloEjbLocal helloEjb;


Sample project available:
git clone https://github.com/vernetto/JavaMonAmour
cd JavaMonAmour\jeesamples\HelloEJB


If you wonder about Portable JNDI Syntax, have a look here.

Friday, January 15, 2016

Singleton service in cluster to consume JMS messages with disaster recovery

"We consume messages from a (MQ) queue
We have two servers. One is the primary and consumes the messages. The secondary does not normally consume messages.
If the primary server falls over (DR), then the secondary should start consuming the messages.
How to implement this?
"

register a custom Singleton service (message listener) on a cluster, as JMS listener of the Queue, with automated migration: assign it by default to a specific instance: if this instance fails, the singleton is reassigned to another instance. Automated migration is ensured by the DB leasing mechanism.

http://docs.oracle.com/cd/E24329_01/web.1211/e24425/service_migration.htm#CLUST373
https://docs.oracle.com/middleware/1212/wls/WLACH/taskhelp/clusters/ConfigureSingletonService.html
http://docs.oracle.com/cd/E24329_01/apirefs.1211/e24391/weblogic/cluster/singleton/SingletonService.html
http://developsimpler.blogspot.ch/2012/03/weblogic-clusters-and-singleton-service.html
http://developsimpler.blogspot.ch/2012/03/weblogic-clusters-and-singleton-service.html
http://docs.oracle.com/html/E24401_02/taskhelp/clusters/ConfigureSingletonService.html

This should appear in your config.xml, after startup-class and before admin-server-name:


  <singleton-service>
    <name>Singleton Service-0</name>
    <class-name>com.pippo.pluto.MySingletonService</class-name>
    <cluster>Cluster-0</cluster>
  </singleton-service>






Same classloader for EJB and WAR

https://docs.oracle.com/middleware/1212/wls/WLPRG/classloading.htm#WLPRG293

you can alter the weblogic-application.xml with this

<classloader-structure> 
    <module-ref> 
       <module-uri>ejb1.jar</module-uri> 
    </module-ref>
    <module-ref> 
       <module-uri>web1.war</module-uri> 
    </module-ref>
 </classloader-structure> 


however it's recommended to either put your shared classes in APP-INF/lib, or remove circular dependencies if any

Thursday, January 14, 2016

rpm tutorial


https://rpm-packaging-guide.github.io/#preparing-software-for-packaging

https://rpm-guide.readthedocs.io/en/latest/rpm-guide.html


sudo yum install gcc rpm-build rpm-devel rpmlint make python bash coreutils diffutils patch rpmdevtools

cd /home/centos
mkdir rpmtest
cd rpmtest/
vi hello-world.spec

Name:       hello-world
Version:    1
Release:    1
Summary:    Most simple RPM package
License:    FIXME

%description
This is my first RPM package, which does nothing.

%prep
# we have no source, so nothing here

%build
cat > hello-world.sh <<EOF
#!/usr/bin/bash
echo Hello world
EOF

%install
mkdir -p %{buildroot}/usr/bin/
install -m 755 hello-world.sh %{buildroot}/usr/bin/hello-world.sh

%files
/usr/bin/hello-world.sh

%changelog
# let's skip this for now



rpmdev-setuptree
rpmbuild -ba hello-world.spec
cd /home/centos/rpmbuild/
find .
#install
sudo rpm -i -f ./RPMS/x86_64/hello-world-1-1.x86_64.rpm
hello-world.sh
which hello-world.sh
cat /usr/bin/hello-world.sh
#find package
rpm -qa | grep hello
#delete
sudo rpm -e hello-world-1-1.x86_64
#
cd /home/centos/rpmbuild/
sudo rpm -qpi ./RPMS/x86_64/hello-world-1-1.x86_64.rpm


Name        : hello-world
Version     : 1
Release     : 1
Architecture: x86_64
Install Date: (not installed)
Group       : Unspecified
Size        : 33
License     : FIXME
Signature   : (none)
Source RPM  : hello-world-1-1.src.rpm
Build Date  : Mon 03 Jun 2019 09:19:39 PM CEST
Build Host  : localhost
Relocations : (not relocatable)
Summary     : Most simple RPM package
Description :
This is my first RPM package, which does nothing.



This is to list the content of a rpm file without installing it:
rpm -q -filesbypkg -p filename.rpm
or also simply:
sudo rpm -ql hello-world-1-1.x86_64


To extract:

rpm2cpio ./RPMS/x86_64/hello-world-1-1.x86_64.rpm > /tmp/hello.cpio

and then

cpio -i --make-directories < /tmp/hello.cpio this will create under the current folder the file usr/bin/hello-world.sh See this nice presentation






Wednesday, January 13, 2016

Unhappy with your work? You can change!

before and after


An ex-colleague of mine - a woman - moved from an engineering job to a health sector job - earning a very difficult university degree - at the age of 50.

I have always thought that engineering work is mainly for males, because males are good at shooting and hunting while females are more oriented to social work. And even that it takes a special kind of males, mostly unsympathetic, unemotional, un-compassionate, uninterested in the world... to be happy about staring a computer screen the whole day, it takes rather dull people. So I always encourage everybody that I like in IT to quit this job.

I have asked a few questions:

Q: have you always disliked engineering or it took you some time to mature this feeling?

A: It took me a while. At the beginning I was enjoying making many fun calculations , it was making me feel smart... Then gradually the doubt emerged that all this was totally useless. but as long as I was having fun, the doubt was being removed. Then I started having less fun, but anyway I liked the people I was working with, so things were still going decently. Then I went into the phase where I was saying "well, maybe it's useless, but at least it's useful to me, to make a career etc. Also this last illusion died and I have eventually understood: OK it's useless and I don't like it.

Q: which events have pushed you to the decision to change job?

A: a thousand reasons, it's not at all clear to me... I would need a psychologist to understand it

Q: among your university colleagues, have you been treated with diffidence due to the age difference? How about the teachers?

A: with my school mates, after a first phase or embarassment (mine) and diffidence (their) I have been very warmly welcome, with sincere admiration and almost affection. With some of them I have matured a true friendship. The teachers have always treated me with fairness, if they had curiosity about me they have hidden it very well. As far as I am concerned I have always been very discrete about my strange condition.

Q: what advice would you give to women who find themselves doing a job "sterile" as Engineering or IT? To ignore the uneasiness and expect it to go away one day and you will get used? or rather "listen to your heart, he knows what is best for you"?

A: To my children I have always told to listen to their heart and be answerable only to themselves. In fact one is now in Australia working as a waiter, the other is a sportsman, the little one wants to be a Natural Park Guard to protect the animals on the mountains. They don't seem to be unhappy.

Q: what is your opinion about Engineers, compared to other professions?

A: I don't think anything. I think you can't generalize. A bit conceited, yes they are.

Q: how do you compare the world of Health Care with the world of Engineering?

A: in the hospital, everybody works VERY hard...from the chief of surgery to the last of the students. Outside of the hospital, it's all the same...



X11 tunneling with Tectia SSH client

https://support.ssh.com/manuals/client-user/61/client-tunnel-x11.html

Do "Edit/Tectia Connections"



ssh-broker-config.xml is in several places, verify that all files contains this

     <server-banners visible="yes" /> 
     <forwards> 
       <forward type="x11" state="on"/> 
       <forward type="agent" state="on"/> 
     </forwards> 


the files are:

  C:\Documents and Settings\PIPPO\AppData\Roaming\SSH\
   29.09.15│  5728│AI    │ssh-broker-config.xml
  C:\Documents and Settings\PIPPO\Application Data\SSH\
   29.09.15│  5728│AI    │ssh-broker-config.xml
  C:\Users\PIPPO\AppData\Roaming\SSH\
   29.09.15│  5728│AI    │ssh-broker-config.xml
  C:\Users\PIPPO\Application Data\SSH\
   29.09.15│  5728│AI    │ssh-broker-config.xml



BEA-110503 JTA migration policy : The migrator is not available

We see this Warning message in the logs

<Warning> <JTA> <BEA-110503> <The migrator(the AdminServer for manual JTA migration policy, or the Singleton Master for automatic JTA migration policy) is not available. Will skip JTA TRS failback because isStrictOwnershipCheck is [false]. This may lead to potencial TLOG corruption if TRS of myserver has been migrated to backup server and the backup server is accessing the TLOG of myserver . More safety can be achieved by setting isStrictOwnershipCheck to [true].>

https://docs.oracle.com/cd/E24329_01/web.1211/e24425/service_migration.htm#CLUST286 here an explanation of the Service Migration Policy

"TRS" is JTA Transaction Recovery Service "The Transaction Recovery Service automatically attempts to recover transactions on system startup by parsing all transaction log records for incomplete transactions and completing them. "

isStrictOwnershipCheck http://docs.oracle.com/cd/E14571_01/apirefs.1111/e13945/weblogic/management/configuration/JTAMigratableTargetMBean.html#isStrictOwnershipCheck%28%29



I will elaborate more once I find out more.



Tuesday, January 12, 2016

BEA-110433 Unable to obtain ownership of the transaction log

If you see "BEA-110433 Unable to obtain ownership of the transaction log", then

<Jan 12, 2016 3:41:57 PM CET> <Error> <JTA> <BEA-110433> <Unable to obtain ownership of the transaction log.> 
<Jan 12, 2016 3:41:57 PM CET> <Critical> <JTA> <BEA-111009> <activateDeployments failed during initialization. Failing reason: 
weblogic.server.ServiceFailureException: Cannot get ownership of Transaction Log.  Make sure that the Transaction Recovery Migratable Service is migrated back to the current server before restarting it.

weblogic.server.ServiceFailureException: Cannot get ownership of Transaction Log.  Make sure that the Transaction Recovery Migratable Service is migrated back to the current server before restarting it.
                at weblogic.transaction.internal.TransactionRecoveryService.checkTransactionLogOwnership(TransactionRecoveryService.java:408)
                at weblogic.transaction.internal.TransactionRecoveryService.resume(TransactionRecoveryService.java:183)
                at weblogic.transaction.internal.TransactionRecoveryService.initialize(TransactionRecoveryService.java:443)
                at weblogic.transaction.internal.StartupClass.main(StartupClass.java:32)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                Truncated. see log file for complete stacktrace
>



then check your transaction-log-jdbc-store in the config.xml, make sure it's the same datasource used by data-source-for-automatic-migration, the auto-migration-table-name should be ACTIVE_SINGLETON_SERVICES, then drop this table and build it again with
CREATE TABLE ACTIVE_SINGLETON_SERVICES (
SERVER VARCHAR2(150) NOT NULL,
INSTANCE VARCHAR2(100) NOT NULL,
DOMAINNAME VARCHAR2(50) NOT NULL,
CLUSTERNAME VARCHAR2(50) NOT NULL,
TIMEOUT DATE,
PRIMARY KEY (SERVER, DOMAINNAME, CLUSTERNAME)
) ;


The root cause of this issue is often that the WLS servers are killed by operators rather than being "gracefully shutdown" as recommended by Oracle. For instance this happens when the Server is in Overload condition and the Graceful Shutdown times out (by default after 120 s). Thanks to Carlo for the explanation.



Monday, January 11, 2016

java.net.ProtocolException: Did not meet stated content length of OutputStream

We were getting this error:
java.net.ProtocolException: Did not meet stated content length of OutputStream:  you wrote 139 bytes and I was expecting  you to write exactly 153 bytes!!!
                at weblogic.net.http.ContentLengthOutputStream.close(ContentLengthOutputStream.java:52)
                at java.io.FilterOutputStream.close(FilterOutputStream.java:160)



There are a number of posts suggesting that one needs to change encoding.... also the Oracle doc "ProtocolException is thrown if multibyte characters is specified for HttpServletResponse.sendError method (Doc ID 1902525.1)" suggests the same.
However in our case upgrading the JVM fixed the issue. Probably the communication was happening between 2 versions of JVM using a different serialization strategy, who knows....
Thanks to Andrea for the resolution.

Sunday, January 10, 2016

File.getName() in windows and Unix

If you have a full path like filename="c:\temp\pippo.txt" , on windows new File(filename).getName() will return pippo.txt, but on *nix it will return "c:\temp\pippo.txt".

This can be a nasty issue: you want a path to be parsed consistently regardless of the OS on which the JVM is running. Well, that's not the case. So you are screwed.

Luckily you can use https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FilenameUtils.html and it will work beautifully.

Wednesday, January 6, 2016

BEA-2165021 ResourceManagement is not enabled in this JVM

Starting WLS 12.2.1 with a JDK 8 I get this INFO message:

<Info> <RCM> <BEA-2165021> <"ResourceManagement" is not enabled in this JVM. Enable "ResourceManagement" to use the WebLogic Server "Resource Consumption Management" feature. To enable "ResourceManagement", you must specify the following JVM options in the WebLogic Server instance in which the JVM runs: -XX:+UnlockCommercialFeatures -XX:+ResourceManagement.>

here https://docs.oracle.com/javase/8/docs/technotes/tools/enhancements-8.html they say "##The options -XX:+ResourceManagement and -XX:ResourceManagementSampleInterval=value have been added. Resource Management is a commercial feature."

I think this has nothing to do with the try-with-resources clause.

Euphemistically speaking, there doesn't seem to be lot of documentation on this -XX:+ResourceManagement flag...



Saturday, January 2, 2016

Happy 2016 to all JMA readers



(I have found this on GlobalResearch.ca , that I read regularly)