Category Archive: Java

Sep 24

Eclipse dies on start up org.eclipse.mylyn.tasks.ui

Having a bug that blocks Eclipse from starting is frustating. Solving it is emotional. Bug is : Eclipse doesn’t start and dies showing org.eclipse.mylyn.tasks.ui. Searching Google i found an article talking about this bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=388170 . Reading it we found the solution to our problem and the cause of the bug. Cause seems to be …

Continue reading »

Aug 08

A temporal type must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar

Error in title “A temporal type must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar” cab be found during development using JPA and Google App Engine. To solve this issue you have to correctly annotate the field oh type Date so: @Entity @Table(name=”studio”) public class StudioDb {     @Id     @GeneratedValue(strategy …

Continue reading »

Aug 05

org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Transient error, please try again

The exception org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Transient error, please try again rises because persistance does not reach our database instance. So two chances : First : It a Google Cloud problem, it’s down…very unlikely Second : YOU make some mistyping when configuring your instance in your IDE or in yours configurations files. Check it very …

Continue reading »

Jul 12

UTF-8 problem with JSON and Java in Android

We have a web service that responds with JSON data. In this data you can find String object . Than we have a Mobile App built for Android devices that uses GSON library to parse JSON from that Web Service and than use SQLiteOpenHelper to save and retrieve data into Android DB .

Continue reading »

Jul 06

Diff two files in Eclipse

Developing with Eclispe could be tricky, just an example : what do you do when you want to compare two files? Solution is really near you, just: Select you file with CRTL+Click or CMD+Click Right Click on one file and select “Compare With” -> “Each Other”

Jul 06

Adding new jar library in GAE

When you begin using Google App Engine the first matter you encounter is to add support for your preferites jar libraries. That seems difficult will be a simple matter: Copy your jar library in NameOfYourApp/war/WEB-INF/lib directory Then Add it to Java Build Path : you can go to the project properties and then “Java Build …

Continue reading »

May 03

Check is form with enctype multipart/form-data is submitted in Java ServLet

When we work whit Java Servlet and make use of forms with enctype setted to multipart/form-data we need to know if the form is submitted. In classic implementation ( without multipart/form-data) we use request.getParameter(“submitButtonName”) function to check if submit button is clicked but with multipart/form-data we verify that request.getParameter(“submitButtonName”) return NULL value. Those because the …

Continue reading »

Apr 25

com.google.apphosting.api.ApiProxy$ApplicationException: ApplicationError: 7 in GAE

When you try using Google App Engine GAE with Google Cloud Storage you can come in touch with the following Exception: Uncaught exception from servlet java.io.IOException at com.google.appengine.api.files.FileServiceImpl.translateException(FileServiceImpl.java:615) at com.google.appengine.api.files.FileServiceImpl.makeSyncCall(FileServiceImpl.java:588) at com.google.appengine.api.files.FileServiceImpl.create(FileServiceImpl.java:506) at com.google.appengine.api.files.FileServiceImpl.createNewGSFile(FileServiceImpl.java:153) at com.myproject.ImageUploadServlet.doGet(ImageUploadServlet.java:36) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:57) at …

Continue reading »

Apr 17

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role

Sometimes Hibernate can be very tricky! Exception threwn by LazyInizialition means that we have set lazy loading in the part indicated by the exception. The simplest way to evercome to this situazion is to set both in hbm xml file and in java class the lazy value to true and Eager ( opposite of Lazy). …

Continue reading »

Apr 17

How to Iterate over HashMap in Java

HashMap is a powerful object in java made by a Key-Value association. Key and Value can be Object itself. So iteration could seem tricky, but Java offers us another object “Iterator” to performs iteration in a simple way. Just write code HashMap defaultTrans = new HashMap(); defaultTrasn.put(“it”,”Ciao”); defaultTrasn.put(“en”,”Hello”); defaultTrasn.put(“fr”,”Salut”); Iterator it = defaultTrans.entrySet().iterator();      while …

Continue reading »

Older posts «