lundi 29 août 2016

org.hibernate.LazyInitializationException: could not initialize proxy - no Session

org.hibernate.LazyInitializationException: could not initialize proxy - no Session
 org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
 org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
 org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)


This problem occurs when you have a relation between tow tables.
Your objects are lazy initialized. That's mean, they are initializing only on demand on non-closed session. 
To resolve this exception add laze=false  into you mapping file or  change FetchType.LAZY to FetchType.EAGER
if you use annotation.

In fact,the EAGER strategy is a requirement on the persistence provider runtime that data must be eagerly fetched. The LAZY strategy is a hint to the persistence provider runtime that data should be fetched lazily when it is first accessed.

vendredi 26 août 2016

Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program

finished with non-zero exit value 2

To resolve this issue you must go to your build.gradle on your module
and add:
 multiDexEnabled true

after defaultConfig {

and  add:
 compile 'com.android.support:multidex:1.0.0'

on dependencies {
   

mercredi 24 août 2016

org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net

 org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net
  hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net
    org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net
    hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net


This error happens only whenyou work  offline. hibernate try to read the DTD when parsing the config.

Hibernate can resolve the DTDs locally.

To solve this issue:

instead of:

<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
use:

<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"  

      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 



if the excpetion persist try to change


<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">


by this code:




!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">


the difference between them "www". 


lundi 22 août 2016

you don't have permission to access / on this server. wamp

you don't have permission to access / on this server. wamp

to resolve this exceptions you go to httpd.conf on your wamp and  change Require local by  Require all granted


    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    # Online --> Require all granted
    
    #   onlineoffline tag - don't remove
    
    Require local

</Directory>



will change to




    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    # Online --> Require all granted
    
    #   onlineoffline tag - don't remove
    
   Require all granted

</Directory>

Duplicate files copied in APK META-INF/DEPENDENCIES

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/DEPENDENCIES.


To resolve  this exception you must add this code to your  build.gradle,just before buildTypes


packagingOptions{
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
    }
 symbol  : class HttpServletRequest

This exception occurs when you build a maven project .



To resolve it just put this dependency on your pom.xml.

 <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
</dependency>