20 Aralık 2013 Cuma

Hibernate - JSF Project Error : JavaReflectionManager cannot be cast to MetadataProviderInjector

During working on Hibernate-JSF project on Eclipse, I got such errors;
java.lang.ClassCastException: org.hibernate.annotations.common.reflection.java.JavaReflectionManager cannot be cast to org.hibernate.annotations.common.reflection.MetadataProviderInjector
java.lang.NoSuchFieldError: INSTANCE
For this situation, two annotation modules are detected in library files that are already added into the project for Hibernate processes. It causes conflict. Since "hibernateX.jar - hibernate core library" can perform annotation task without other dependency, you should delete both "hibernate-annotations.jar" and "hibernate-commons-annotations.jar" files to solve these kinds of problems.

12 Kasım 2013 Salı

Referenced file contains errors (jar:file:/.../plugins/org.jboss.tools.jst.web_3.5.0.Final-v20130717-0309-B75.jar!/catalog/web-facesconfig_2_2.xsd)

When I create new JavaServer Faces v2.2 project on Eclipse Kepler, I get an error in faces-config.xml file such as; 

"Referenced file contains errors (jar:file:/.../plugins/org.jboss.tools.jst.web_3.5.0.Final-v20130717-0309-B75.jar!/catalog/web-facesconfig_2_2.xsd)."

faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">

</faces-config>

It is obvious that http://xmlns.jcp.org/xml/ns/javaee is generated twice. To handle this error, one of them should be removed. Matching library versions with the XSD version is important, that's why removing first appearance is more proper action.

26 Şubat 2013 Salı

Weka GUI - OutOfMemory

"Not enough memory. Please load a smaller dataset or use a larger heap size."

Weka sometimes gives this error, if you use large datasets. To handle it, specify a larger heap size by changing the RunWeka.ini configuration file. The file is in the Weka folder of your Program Files directory on Windows. You should increment the value of the variable which regulates maximum heap size, such as "maxheap=1024m".

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

While using eclipse to run Java program, I was faced with the error below;
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Reason;
Eclipse uses default value of memory, if you don't change it. While using large data in your program, this default value is not enough.
Solution;
Eclipse>Windows> Preferences> Java> Installed JREs> Select the JRE> Click edit> Write in the Default VM Arguments: -Xmx1024M or any other amount of memory ...

20 Kasım 2012 Salı

Installing Java SE Development Kit on Ubuntu

- Download Java SE 7u7 from Oracle and uncompress it;

$ tar xf jdk-7u7-linux-i586.tar.gz

- JDK 7 package is extracted into jdk1.7.0_07 directory. Move this directory to "/usr/lib/jvm/";

$ sudo mv ./jdk1.7.0_07 /usr/lib/jvm/jdk1.7.0_07-sun

- Then, run;

$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_07-sun/bin/java" 1

$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_07-sun/bin/javac" 1

$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_07-sun/bin/javaws" 1

- Set newly installed java as default;

$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config javaws

- Check the version of new JDK 7 installation;

$ java -version

References;
(1)http://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7
(2)http://greenmang0.wordpress.com/2012/05/28/installing-oracle-jdk-7-on-ubuntu-12-04

26 Temmuz 2012 Perşembe

Displaying external webpage on Samsung Smart Tv's screen

One more tip about Samsung Smart Tv SDK [2.5]...

Displaying external webpage on Samsung's screen is not so easy. Samsung Smart Tv uses Maple Browser and this browser does not support IFrame. It leads us on using JavaScript window.open method. However, it may not solve your problem!
External website may not display correctly on Maple which is not a full fledged browser. You may either take data from the website and push it in your application using customized UI following Maple Browser Specs of displaying a webpage.

2 Haziran 2012 Cumartesi

Access restriction on class due to restriction on required library rt.jar?

"Access restriction: The constructor BASE64Decoder() is not accessible due to restriction on required library C:\Program Files\Java\jdk1.5.0_16\jre\lib\rt.jar" gibi bir hata aldım Eclipse'de. Anladığım kadarıyla bir standart class, Java library'sindeki diğer bir class'ın yerine geçmeye çalışıyor ve sıkıntı oluşturuyor.

Çözüm için forum sitelerinde şu öneriyi buldum ve işe yaradı:
1) "Project Properties" kısmında "Build Path Settings"e gir.
2) "JRE System Library"i kaldır.
3) Daha sonra "Add Library" kısmını seç ve "JRE System Library"i tekrar ekle.