Google Analytics

Tuesday, December 6, 2016

:javax.faces.FacesException: javax.faces.FacesException: oracle.adf.controller.ControllerException

If you get below error check the bean constructor.

Error:
javax.faces.FacesException: javax.faces.FacesException: oracle.adf.controller.ControllerException:
ADFC-10001: cannot instantiate class

More info:
http://javaosdev.blogspot.com/2012/03/adf-odd-error-adfc-10001-cannot.html

Friday, November 25, 2016

Oracle ADF weservice call org.xml.sax.SAXParseException

Oracle ADF soap Web service returns org.xml.sax.SAXParseException in debug mode.  When we validate the response XML, we observed some validation errors related/same to below error.

Error: org.xml.sax.SAXParseException: The prefix "urn" for element "urn:Coxxxxx-Interface-XXXXXXXXXX" is not bound.

Problem is resolved once we deploy the ADF EAR to the Standalone weblogic server. However we couldn't debug with intergrated weblogic.

Sunday, November 20, 2016

Java for loop escape one loop

To avoid an iteration use CONTINUE key word. Presentation

for (Vehicle printVehicle : getParkedVehicles()) {
if("VAN".equals(printVehicle.getVehicleType().toUpperCase())){
vanCount++;
if(vanCount == 2){
vanCount = 0;
continue;//SKip the iteration related to additional Van record
}
}
}

Collection.sort() method override

If need to sort a object considering it attributes, we can do as below.


//Some class
private void sortList(){
   // Sorting
   Collections.sort(getParkedVehicles(), new Comparator<Vehicle>() {
   @Override
    public int compare(Vehicle vehicle2, Vehicle vehicle1)
    {
          DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
          return LocalDateTime.parse(vehicle1.getEntryTime(),formatter).compareTo(                                                                                    LocalDateTime.parse(vehicle2.getEntryTime(),formatter));
                }
            });
    }

public class Vehicle {
    private String idPlate;
    private String brand;
    private String entryTime;



    public String getIdPlate() {
        return idPlate;
    }

    public void setIdPlate(String idPlate) {
        this.idPlate = idPlate;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getEntryTime() {
        return entryTime;
    }

    public void setEntryTime(String entryTime) {
        this.entryTime = entryTime;
    }
}


More details:
http://stackoverflow.com/questions/18441846/how-to-sort-an-arraylist-in-java

Java 8 Locale date

Existing classes (such as java.util.Date and SimpleDateFormatter) aren’t thread-safe and use package java.time

More info:
http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html
http://stackoverflow.com/questions/25747499/java-8-calculate-difference-between-two-localdatetime

Example:
Current date time:

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

LocalDateTime dt =  LocalDateTime.now();
//Format date time to String:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
String entryDateTime = dt.format(formatter);

//Reverse formatting to LocalDateTime

LocalDateTime fromStartDateTime = LocalDateTime.parse(entryDateTime );
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
String strCurrDateTime = LocalDateTime.now().format(formatter);
LocalDateTime toCurrentDateTime =   LocalDateTime.parse(strCurrDateTime);//now    



Tuesday, November 8, 2016

Derby connection error ERROR XJ041: DERBY SQL error: ERRORCODE: 40000 in Oracle ADF 12C Alta UI

This issue occurred due to java version issue. Use Java 8 (Environment variable JAVA_HOME, set java path to Jdeveloper installation inbuilt JDK) with oracle ADF 12C.

More Details
http://stackoverflow.com/questions/33097205/derby-client-jdbc-driver-connection-error-failed-to-create-database-sample

Thursday, November 3, 2016

Tomcat Server Default Password

In tomcat add below lines to server.xml

<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>


More details refer below:
https://www.mkyong.com/tomcat/tomcat-default-administrator-password/

Wednesday, November 2, 2016

tomcat server start java.net.SocketTimeoutException: Read timed out

If you see below errors it means you changed the port in the wrong place of the Server.xml .

Errors:
tomcat server start java.net.SocketTimeoutException: Read timed out
tomcat server standardserver.await: invalid command '' received

Locate 8080 port from server.xml and change the port to not using port

Wednesday, October 26, 2016

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.

If you see below error add below plugin to the POM.

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.


<plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.19.1</version>
        </plugin>
  </plugins>

This error may occur when you try to keep the Java version rather taking Eclipse default JDK.

 <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.2</version>
         <configuration>
             <source>1.7</source>
             <target>1.7</target>
         </configuration>
 </plugin>

More info:
http://stackoverflow.com/questions/36427868/failed-to-execute-goal-org-apache-maven-pluginsmaven-surefire-plugin2-12test/36429564

Sonar Qube plugin

Sonar cube plugin is support to Eclipse IDE. It shows code quality errors on the go.

Plugin name : SonarLint

More Details:
http://www.sonarlint.org/eclipse/

Sonar Qube Issue Report generate

Sonar qube issue report can be generate using below command. You must start sonar qube server and the sonar runner from the source code path.

sonar-runner -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true

More info:
http://docs.sonarqube.org/display/SONARQUBE53/SonarLint+for+Command+Line

Sonar Qube 404 error


If the Sonar runner throw localhost/9000 unreachable with 404 code, try to upgrade the Sonar DB. (Need to up and running Sonar Qube server)

Below is the upgrade url.

http://127.0.0.1:9000/setup

More info:
http://stackoverflow.com/questions/32097414/error-sonar-server-http-localhost9000-can-not-be-reached

Tuesday, October 25, 2016

Eclipse JDK version change

If we want to keep the JAVA_HOME environment variable to a different JDK version than Eclipse, we can change the JDK version of the Eclipse.

Add below entry to the beginning line of eclipse.ini file .

-vm
 C:/Program Files/Java/jdk1.7.0_79/bin/javaw.exe 

Sunday, June 5, 2016

Tomcat server is not starting - WELD-000100 Weld initialized. Validating beans

If Tomcat server is not starting from "DEBUG org.jboss.weld.Bootstrap - WELD-000100 Weld initialized. Validating beans" line, try to do below steps:

1)Check DB connections.
or
2)If external services access via network, disable the any internet/network connections.
or
3)Try to debug Skip all debug points.
or
4)if you are experienced this issue in Debug mode, try to run the app without debug mode.


DEBUG org.jboss.weld.Bootstrap - WELD-000100 Weld initialized. Validating beans

Tuesday, May 10, 2016

Prime Face Sub data tables represent in workaround

In p:dataTable, if we need to add List of values (List<String>) we can use another p:dataTable oppose to p:subTable. Although this workaround is worked, we need to do some adjustments to add scroll bars to the sub table. Below is the prime face source.

Check the div tags and styles use to get the scroll bar. In this case we didn't use prime face scrollerble property.

Source:



Output:


Jasper Reports - Customized field values for List

Jasper supports List of values in a single field. However jasper prints List<String> as below format.
(Jasper List of Values) Presentation

Print format of the Jasper - [aaa,bbb,ccc].

If you want to print above value line by line with additional horizontal dash line, you can modify your .jrxml field as below.

From java side field value sends :

List<String> xxx = new List<String>;
String d = "xx1"+"("+"ssss"+")"+ "-"+Date+"/"+"OOO";
String e = "xx2"+"("+"vvvv"+")"+ "-"+Date+"/"+"HHH";
String f = "xx3"+"("+"hhhh"+")"+ "-"+Date+"/"+"KKK";

xxx.add(d);
xxx.add(e);
xxx.add(f);

--------------------------------------------------------------------------------------------
In Jrxml

($F{xxx}.substring(1, $F{xxx}.length() - 1 )).replaceAll( ",", System.getProperty("line.separator")+"-----------------------------------------------"+ System.getProperty("line.separator"))


-------------------------------------------------------------------------------------------------

Out put:

xx1 (ssss) - 03/11/2015 / OOO
-----------------------------------------------
 xx2 (vvvv) - 05/10/2015 / HHH
----------------------------------------------- 
xx3 (hhhh) - 02/08/2015 / KKK



Monday, March 7, 2016

Oracle ADF DB Sequence execution

You can write this pease of code in Application Module Impl class.
"ORDER_SEQ" is a Oracle DB Sequence.

import oracle.jbo.server.DBTransaction;
import oracle.jbo.server.SequenceImpl;

SequenceImpl orderIdSeq =
            new SequenceImpl("ORDERS_SEQ", this.getDBTransaction());
        orderIdSeq.getSequenceNumber();

        String pOrderId = orderIdSeq.getSequenceNumber().toString();

Friday, February 19, 2016

How to default a value in ADF LOV

Please refer below link to set default value for ADF LOV.

http://husaindalal.blogspot.com/2010/05/how-to-default-lov-with-its-first-value.html

Thursday, February 11, 2016

ADF application unexpected behave in runtime

>>If you experienced any abnormal behavior in ADF application check the weblogic              server space.

>>Also the 'tmp' folder space. 

ADF get Terminal Id/ Machine Id

public static String getTerminalName() {
        String sTerminalName = null;
        try {
            sTerminalName = InetAddress.getLocalHost().getHostName();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
 
        return sTerminalName;
    }