vendredi 8 janvier 2016

com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java

com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)

and another exception :

Caused by: java.net.UnknownHostException: www.springframework.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)


To resolve this problem you must

reeplace http://www.springframework.org/schema/tx/spring-tx-4.0.xsd on your spring configuration file by
 http://www.springframework.org/schema/tx/spring-tx.xsd and you'll be fine .you must  modify the context import as well.

java.nio.file.AccessDeniedException:

java.nio.file.AccessDeniedException:

org.hibernate.PersistentObjectException: detached entity passed to persist:

org.hibernate.PersistentObjectException: detached entity passed to persist:



you get this exception when want to add an object with JPA. 
The first time  everything goes fine and Object is inserted in the database. 
The second time,  it fails and you have this exception.
To resolve this do:
em.merge(user);
instead of
em.persist(user);




mercredi 6 janvier 2016

org.ksoap2.serialization.SoapPrimitive cannot be cast to org.ksoap2.serialization.SoapObject

org.ksoap2.serialization.SoapPrimitive cannot be cast to org.ksoap2.serialization.SoapObject

This  exceptions is generally due to invalid returned value from a method.

you have on your code:

SoapObject   soapObject = (SoapObject) envelope.getResponse();

you must correct it by using bodyIn not getResponse().

your code must be like this:


SoapObject   soapObject = (SoapObject) envelope.bodyIn ;





mardi 5 janvier 2016

java.sql.SQLException: Index de colonne non valide

Exception:java.sql.SQLException: Index de colonne non valide
this problem occurs when we work with jdbc and want to know the value of a column that the index is worng for example we do:

ResultSet rs= stm.executeQuery(SQL);
long id=0;
while (rs.next()) {
id=rs.getLong(0);
}

to resolve this exception we must change  id=rs.getLong(0); by  id=rs.getLong(1);  you must be sur  that the index exist.

java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64

The exception "java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64" means that the class Base64 is not found on your classpath.

you must add a jar that contain this class and add it to your classpath.
This is the name of the jar :commons-codec-1.6.jar
if you work with maven,this is the dependency:

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.2</version>
</dependency>






webservice-from-android-using-ksoap2-parameters-are-null

The problem occured when we use jax-ws webservice.
This is not due to android code . 
You must  add annotations @WebMethod ,@WebParam  and not forget  targetNamespace .




lundi 4 janvier 2016

java.io.IOException: invalid SHA1 signature file digest

java.io.IOException: invalid SHA1 signature file digest 

This exception occurs when we user jarsigner.

This error can happen when the jar is signed twice.
it can be resolved if you open the jar that you  want to sign and "unsign" it.

 to unsign a jar , you must delete *.SF, *.DSA, *.RSA files from the jar's META-INF and then sign the jar again.