Pages

20160524

Putty X11 and Tunnel config

Scope: 
While executing a remote host connection with SSH, and starting the whole Oracle's Middle-ware environment, eventually I need to double check if the administration server, and the deployed applications are accessible from the respective IP address. The following scenario describe better the obstacles to finish my task: 

1. Due to some VPN configuration, I have to use Windows, which in my case the Win. OS is running on a virtual machine. 
2. I only have the SSH protocol ( port 22 ). 
3. As explained above, I had to login into the WLS's Admin's Console, to finish configuration and run a simple check on the Managed Servers' deploy Apps to check the IP access. 

Actions: 
1. Download and install Putty, its a nice little software that enables Windows users to connect into a remote Unix like OS through the SSH protocol. 

2. Search and start putty from your Windows menu search: 

3. Next you need to provide the IP and by default SSL goes to port 22, but if the Unix Administrator had opened the SSH in another port, you could configure the connection to the provided port.




 4. The go to connection/SSH/X11, and select the 'Enable X11 forwarding'. This will enable the X11 port forwarding in case of exporting GUI into local machine. Also you need on Windows the Xming installed and running. 


5. Then go to  the connection/SSH/Tunnels and do the following action: 


  1. Add a local port to access, 7001; 
  2. Provide the remote Destination IP. Be careful with this configuration, Because you could be using the SSH connection to connect to another remote machine so you need to make sure the you provide the same IP as the connected SSH session;
  3. Provide the port in which the service is running on the provided IP;  


6. That's it, now you can access the Admin's Console on you localhost at http://localhost:7001/console and any application deployed on the managed server at http://localhost:15101/appName;


20160331

ODI 12c install Bug: Cyclic dependency detected among featureset libraries oracle.odi.sdk.clientLib.jar


I am currently installing WLS 12.2.1 Enterprise with multiple products on multiple environments; During the installation on ODI over FMW  Infrastructure, and I faced the following Exception printed out on the installation log located at the tmp directory:

Caused by: oracle.sysman.oii.oiif.oiifb.OiifbEndIterateException: com.oracle.cie.gdr.libraries.LibraryHandlerException: Cyclic dependency detected among featureset libraries: [/u01/oracle/products/fmw/modules/clients/oracle.odi.sdk.clientLib.jar]

What I know about the problem:


  1. The issue happen only during the ODI 12c install, and any other product such as SOA and OSB the installation was successfully. By investigating I heard that a college could run the installation without a problem; 
  2. I looked into the Oracle Support and found that is a bug on description phase, which means it would take a long time for a final solution: Bug 22262514 : ERROR WHEN INSTALLING ODI 12.2.1 ON HP UX 11.31; 
  3. The ODI installation is the only installation with the double jars to install: 
  4. The Oracles documentation provided me with the following step to install the ODI: 
  •  /home/Oracle/jdk1.8.0_60/bin/java -jar fmw_12.2.1.0.0_odi.jar

What I was doing:

Since I had to install the application on silent mode, I had something similar to the script bellow:

#!/bin/bash 
export JAVA_HOME=/home/Oracle/jdk1.8.0_60 
export PATH=$JAVA_HOME/bin:$PATH 
java -version 
java -d64 -Xms4g -Xmx4g -jar fmw_12.2.1.0.0_odi.jar -silent etc...

As you can see, the steps were done correctly and running similar scripts worked on the SOA and OSB installation; After some long hours looking and trying to install a successful ODI install, I remember something about how the JVM actually loads classes. By following the instruction from Oracle in providing a full path of the JDK, the JVM seems to load the second fmw_12.2.1.0.0_odi2.jar, therefore the issue was on my script and how I am calling the fmw_12.2.1.0.0_odi.jar; By setting the global PATH variable, I was not allowing the java command to load all needed classes and jars. 

Therefore the solution is simple, was just changing how I was calling the java command or use the -cp to set the classpath: 

java -d64 -Xms4g -Xmx4g -cp /fmw_12.2.1.0.0_odi2.jar -jar /fmw_12.2.1.0.0_odi.jar -silent etc...

If you do the above command and still get an error like bellow, its a good change the you had an failed installation on the FMW Infrastructure previously and you need to delete and reinstall the whole environment again. 

oracle.sysman.nextgen.NextGenInstallerException: oracle.sysman.oii.oiif.oiifb.OiifbEndIterateException: com.oracle.cie.gdr.maven.PomException: Errors were found during
POM generation. Please check the logs for more informatio



20150218

WHY Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy


I have been working on some some J2EE 7 fun projects, and suddenly I run into some problems during deployments on my project with NetBeans 8.0.2 and glassfish 4. As you can see below, the server writes some reflect output stack trace:


Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.reflect.Executable.declaredAnnotations(Executable.java:546)
at java.lang.reflect.Executable.getAnnotation(Executable.java:520)
at java.lang.reflect.Method.getAnnotation(Method.java:607)



This ArrayStoreException came wrapped in another exceptions, by reading the stack and taking consideration the moment in which the Exception actually happens we can get some thoughts of what might be going on:


  1. The server does not deploy the application, could be due to missing libs or bad configuration.
  2. The ArrayStoreException with the TypeNotPresentExceptionProxy, tells me that something is missing, but since there is no java.lang.NoClassDefFoundError, it means is not a classpath's path.
  3. The java.lang.reflect.Method.getAnnotation() method, it tells is something to do with annotations.

Its time to look at the Exception wrapper. So it may give some clues where to look for more information:

Severe:   sun.reflect.annotation.TypeNotPresentExceptionProxy
Severe:   Exception while deploying the app [ProjectEulerAnswers]
Severe:   Exception during lifecycle processing
java.lang.IllegalStateException: sun.reflect.annotation.TypeNotPresentExceptionProxy. Related annotation information: annotation [@javax.ejb.Stateless(name=, description=, mappedName=)] on annotated element [class com.euler._25Beans.q11UPBean] of type [TYPE]

The log provided by GlassFish is very clear and confirms all I have learned so far ,and actually prints the name  project ProjectEulerAnswer, the culprit for  failing deployment and provides the name of a bad Bean (q11UPBean). 

On the bean q11UPBean, has the following annotations: 

/**
+ This EJBeuler.jar module is being locally injected from my PorjectEulerAnswers.war Web module
**/
@Stateless
@LocalBean
public class q11UPBean extends prop11Gen{

@javax.interceptor.Interceptors(LoggingInterceptor.class) //this annotation is from a external module EJBintercept.jar**
    private Map<String, String[]> walkingleft(String[] lineArray) {
//some code here
}

//some code here
}

As we can notice, it's the usual Stateless local EJB declaration, which we could call EJBeuler, in which should not give any trouble. Then there is an interceptor's annotation, and in this case this Interceptor is living on a different EJB module, we could call EJBintercept. Checking the Libraries on NetBeans and as expected my my EJBeuler does have reference to my EJBintercept, if there weren't it would give me a compile exception.

But accordingly is the  ProjectEulerAnswers the one failing, which means the Web Project possible needs the library reference to EJBintercept. Which proven to be true and the solution to my ArrayStoreExcpeiton; Which means that at compile time the container is not capable to check all the second hand annotations references, and throws some Exceptions which is very hard to identify the real issue. 

Therefore, when programing with annotation from different modules, we must check if the following example is true: 

EJBeuler ---- uses compiles Libraries ----> EJBintercep; 
ProjectEulerAnswers ---- uses compiles Libraries ----> EJBintercep; 
ProjectEulerAnswers ---- uses compiles Libraries ----> EJBeuler; 





20141127

Java's parametrize Lambda;

Lambda is a new feature on the java se - JDK 8; yeat not implemented on the java EE specs. This now tool provides a lot more flexibility for the java programmers to code reuse, but also can generate unnecessary complexity;

All you really need is an interface with a single method. The annotation @FunctionalInterface (java.lang.annotation.FunctionalInterface - JDK 8), only enforces that the interface must have one and only one abstract method, but you could live without it.  To me, is just to tell others programmers not to declare anything else;

Example:
@FunctionalInterfaceinterface Calculator{    double calculate(int x , int y); }
or
interface Calculator{    double calculate(int x , int y); }
Both Works the same, and a consequence it limits other Object Oriented aspect as method overloading; 

Bad Example: 
interface Calculator{    double calculate(int x , int y);     double calculate(Long x , int y); }
Wrapping also seems not to have problems with Lambda expressions:

package lambda.expression;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

//Lambda primitive type
@java.lang.FunctionalInterface
interface Calculator {
    double calculate(long x, int y);
}

//lambda generic Object
@java.lang.FunctionalInterface
interface ObjectImpl<E> {
    E doOString(E obj1, E obj2);
}

public class Test {
    public static void main(String[] argv) {
        //This is a very simple example; with declaration type and passing the expression;
        Calculator calc = (long x, int y) -> Math.min(x, y);
        System.out.printf("%6.2f\n", calc.calculate(255, 7));
       
        //A little more complex, is the use of collection;
        List<Calculator> listCalc = new ArrayList<>();
        listCalc.add((x, y) -> x + y);
        listCalc.add((x, y) -> x - y);
        listCalc.add((x, y) -> x / y);
        listCalc.add((x, y) -> x % y);
        listCalc.add((x, y) -> Math.hypot(x, y));
        Iterator<Calculator> interate = listCalc.iterator();
        while (interate.hasNext()) {
            Calculator calculator = interate.next();
            System.out.printf("%6.2f\n", calculator.calculate(255, 7));
        }
        //to make your day, Generics is here to add some more complexity;
        ObjectImpl<String> objectImpls = (obj1, obj2) -> obj1 + obj2;
        String result = objectImpls.doOString("Hello ", "World!!");
        System.out.println(result);
        //Adding with Integer Object and wrappers;
        ObjectImpl<Integer> objectImplsNum = (obj1, obj2) -> obj1 + obj2;
        Integer resultint = objectImplsNum.doOString(new Integer(2),3);
        System.out.println(resultint);
       
    }
}

The results: 

run:
  7.00
262.00
248.00
 36.00
  3.00
255.10
Hello World!!
5
BUILD SUCCESSFUL (total time: 2 seconds)

Lambda like break, continue, label and other features, can turn your code more complex; but its here to stay, and we should understand how it works and use it with precaution;  



20131217

Java Mission Control (jmc) Crashing: SIGSEGV at C [libsoup-2.4.so.1+0x6dab1] soup_session_feature_detac

I was checking around the new JMC, that comes bundle with the jdk1.7_45; this tool is like a mix of Jrockit Mission Control and jvisualvm. As for now, does not have as many tools as offers the JRMC and the connection is done through JMX, just like you would do while connecting with jvisualvm. 

But, to spoil my fun while running the ./jmc I got :



A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000003119a6dab1, pid=9245, tid=140539766241024
#
# JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libsoup-2.4.so.1+0x6dab1] soup_session_feature_detach+0x11
#
# Core dump written. Default location: /usr/java/jdk1.7.0_45/bin/core or core.9245

Yes, its a nice coredump, and with a filedump in which I got the header above. By looking at the filedump, I could check that this .so lib was being use by an or.eclipse.swt.internal.webkit:

Stack: [0x00007fd1f6c7f000,0x00007fd1f6d80000], sp=0x00007fd1f6d7cb20, free space=1014kNative frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)C [libsoup-2.4.so.1+0x6dab1] soup_session_feature_detach+0x11
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)j
 org.eclipse.swt.internal.webkit.WebKitGTK._soup_session_feature_detach(JJ)V+0j org.eclipse.swt.internal.webkit.WebKitGTK.soup_session_feature_detach(JJ)V+9j org.eclipse.swt.browser.WebKit.create(Lorg/eclipse/swt/widgets/Composite;I)V+920j org.eclipse.swt.browser.Browser.<init>(Lorg/eclipse/swt/widgets/Composite;I)V+81j org.eclipse.ui.internal.intro.impl.presentations.BrowserIntroPartImplementation.createPartControl(Lorg/eclipse/swt/widgets/Composite;)V+19j org.eclipse.ui.internal.intro.impl.model.IntroPartPresentation.createPartControl(Lorg/eclipse/swt/widgets/Composite;)V+74j org.eclipse.ui.intro.config.CustomizableIntroPart.createPartControl(Lorg/eclipse/swt/widgets/Composite;)V+64j org.eclipse.ui.internal.ViewIntroAdapterPart.createPartControl(Lorg/eclipse/swt/widgets/Composite;)V+9j org.eclipse.ui.internal.ViewReference.createPartHelper()Lorg/eclipse/ui/IWorkbenchPart;+406j org.eclipse.ui.internal.ViewReference.createPart()Lorg/eclipse/ui/IWorkbenchPart;+5j org.eclipse.ui.internal.WorkbenchPartReference.getPart(Z)Lorg/eclipse/ui/IWorkbenchPart;+65j org.eclipse.ui.internal.Perspective.showView(Ljava/lang/String;Ljava/lang/String;)Lorg/eclipse/ui/IViewPart;+16j org.eclipse.ui.internal.WorkbenchPage.busyShowView(Ljava/lang/String;Ljava/lang/String;I)Lorg/eclipse/ui/IViewPart;+59j org.eclipse.ui.internal.WorkbenchPage$20.run()V+21

Investigating the issue with eclipse bugs, I came across this Bug 404776; Which nicely provided a simple workaround by just adding two new parameters:

-Dorg.eclipse.swt.browser.DefaultType=mozilla
-Dorg.eclipse.swt.browser.XULRunnerPath=/urs/lib64/xulrunner
The XULRunnerPath should be set to the actual xulrunner on your OS. At this case, mine is a 64bits Fedora 19...

To Java Mission Control take these parameters, you need to edit the following file:

/usr/java/jdk1.7.0_45/lib/missioncontrol/configuration/config.ini

Just need to append those two parameters at the end of config.ini file and the Java Mission Control should start without a problem.

#echo org.eclipse.swt.browser.DefaultType=mozilla >> /usr/java/jdk1.7.0_45/lib/missioncontrol/configuration/config.ini
#echo org.eclipse.swt.browser.XULRunnerPath=/urs/lib64/xulrunner/ >> /usr/java/jdk1.7.0_45/lib/missioncontrol/configuration/config.ini

# --> root user...