15 February 2019

Haskell Ubuntu install

sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:hvr/ghc
sudo apt-get update
sudo apt-get install ghc-8.6.3

sudo apt-get install cabal-install-2.4

export PATH=/opt/ghc/bin/:$PATH



16 January 2019

Log4j2 name JMX MBeans

To let name through JMX at MBeans, this can be assigned through

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-web</artifactId>
            <version>${log4j2.version}</version>
            <scope>provided</scope>
        </dependency>
      
and can be customized:

    <context-param>
        <param-name>log4jContextName</param-name>
        <param-value>spring-mvc-simple-32-nombre</param-value>
    </context-param>


https://logging.apache.org/log4j/2.x/manual/webapp.html


15 January 2019

WebLogic log4j2 asm

At starting or deploying time the next exception can be thrown with WebLogic Server :

Caused By: java.lang.IllegalArgumentException
        at com.bea.objectweb.asm.ClassReader.(Unknown Source)

        at com.bea.objectweb.asm.ClassReader.(Unknown Source)
        at weblogic.application.utils.annotation.ClassInfoImpl.(ClassInfoImpl.java:41)
        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.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:208)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:233)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:749)
        at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1238)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:252)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:172)



This is caused by having .class bytecode bigger than accepted

Tag: ASM_5_0

        // checks the class version
        if (readShort(off + 6) > Opcodes.V1_8) {
            throw new IllegalArgumentException();
        }

   
One workaround is to remove the classes compiled with newest bytecode (> 1.8 > 52)

more details:

https://issues.apache.org/jira/browse/LOG4J2-2124

http://mail-archives.apache.org/mod_mbox/logging-notifications/201711.mbox/%3CJIRA.13120226.1511356169000.299143.1511356200159@Atlassian.JIRA%3E

https://gitlab.ow2.org/asm


04 January 2019

Busy Socket

Common issue when reading from a socket without timeout:

"main" prio=10 tid=0x00007f79a4009800 nid=0x32ec runnable [0x00007f79aa67a000]
   java.lang.Thread.State: RUNNABLE
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:153)
    at java.net.SocketInputStream.read(SocketInputStream.java:122)
    at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2664)
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2680)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3157)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:865)
    at java.io.ObjectInputStream.(ObjectInputStream.java:362)
    at com.sun.btrace.client.Client.submit(Client.java:402)
    at com.sun.btrace.client.Main.main(Main.java:206)


---

      sock.setSoTimeout(5 * 1000); //milliseconds

Other details on sockets:



03 January 2019

Btrace cheat sheet

Btrace is a not very popular and powerful tool to debug class at runtime.

The plugin must be installed to run it from visualvm:


Second button to execute it:


Copy the script to be executed thru btrace :


See the results:


It can be executed through command line as well:

btrace <pid> <btrace-script>

$ ./btrace -v -p 2020 -d ./dump/ 64834 TracingScript.java 


More info:
  1. https://github.com/btraceio/btrace
  2. https://dzone.com/articles/btrace-hidden-gem-java
  3. https://www.zcfy.cc/original/btrace-wiki-userguide-mdash-project-kenai

24 December 2018

After Now Archeology

Although it has passed 4 years from original thesis about puzzle game design. Jakko has defend a complete document and began a game.

The blog a thesis can be found at :  http://afternowarcheology.blogspot.fi/

The research refers to several important books/games in the field.

21 December 2018

OpenGrok

Open source project from Oracle.

It retrieves information from different control version source code and are indexed with Apache Lucene, making a fast solution for searching (and keep updating).



https://github.com/oracle/opengrok/wiki/How-to-setup-OpenGrok
http://demo.opengrok.org/
https://github.com/oracle/opengrok


18 December 2018

Most interesting Socket Options

  • TCP_NODELAY
  • SO_SNDBUF
  • SO_RCVBUF
  • Don't forget timeout !

      socket = new Socket(host, port);
      sock.setSoTimeout(5 * 1000); //milliseconds

      socket.setTcpNoDelay(true);
      socket.setSendBufferSize(1000);
      socket.setReceiveBufferSize(1000);


https://eklitzke.org/the-caveats-of-tcp-nodelay
http://normanmaurer.me/presentations/2013-jax-networking-on-jvm/#/41

Don't want to Hassle

    There are a few frameworks to rescue....

12 December 2018

Bfile++

Quick analysis as alternative and abstract layer for Oracle BFILE.

- http://www.jcraft.com/jsch/
  JSch library
  https://docs.spring.io/spring-integration/reference/html/sftp.html
  Under the covers, the SFTP Session Factory relies on the JSch library to provide the SFTP capabilities.
 
- https://commons.apache.org/proper/commons-net/
  FTPFile (Apache Commons Net 3.6 API)

- Commons VFS
  https://commons.apache.org/proper/commons-vfs

- Xodus (JetBrains)
  https://github.com/JetBrains/xodus
  It has three types of database- a key-value storage, an entity-store and a database for files and streams.

- Flexible Storage System (FS2)
  https://github.com/robertjchristian/fs2
  (un solo developer :( esta buena la idea )

Servers:
(out of scope)

- http://www.alluxio.org/ (service)
- https://www.syncany.org/ (tool)


More info:

https://docs.oracle.com/cd/B28359_01/java.111/b31224/oralob.htm#i1059941
https://stackoverflow.com/questions/51503297/managing-oracle-bfiles
http://www.orafaq.com/wiki/BFILE
https://docs.oracle.com/cd/B28359_01/java.111/b31224/oralob.htm#i1059941

My Blog List

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.