Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » After generating the .jar from my IDE, I can not run it(I do not know if this question already exists and if it has found an answer, but it is now a month that I search on google and even on this site, but I have not found a solution to my problem. I am d)
After generating the .jar from my IDE, I can not run it [message #1807775] Sat, 08 June 2019 19:06 Go to next message
S. C Jerôme  Onadja is currently offline S. C Jerôme OnadjaFriend
Messages: 3
Registered: June 2019
Junior Member
java -jar "/home/instantech/Bureau/JAVA Projects/AfricaBadja/dist/AfricaBadja.jar"
Exception in thread "AWT-EventQueue-0" Local Exception Stack: 
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.6.1.v20150605-31e8258): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: jdk.internal.loader.ClassLoaders$AppClassLoader@1affbebc
Internal Exception: java.lang.NullPointerException
    at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:115)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
    at Entity.ManagerEntity.<init>(ManagerEntity.java:28)
    at Manager.AdminManager.<init>(AdminManager.java:21)
    at frontend.FormLogin.<init>(FormLogin.java:26)
    at frontend.FormLogin.lambda$main$0(FormLogin.java:213)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.NullPointerException
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2022)
    at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:100)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:104)
    ... 20 more


So this is my persistence.xml file configuration :

<?xml version="1.0" encoding="UTF-8"?>
<persistence >
  <persistence-unit name="AfricaBadjaPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>Manager.Admin</class>
    <class>Manager.Client</class>
    <class>Manager.Credit</class>
    <class>Manager.Role</class>
    <class>Manager.Produit</class>
    <class>Manager.Commande</class>
    <class>Manager.Depense</class>
    <class>Manager.LigneCommande</class>
    <class>Manager.Sauvegarde</class>
    <class>Manager.HistoryStock</class>
    <class>Manager.Caisse</class>
    <properties>
      <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/africa_badja_18_19"/>
      <property name="javax.persistence.jdbc.user" value="root"/>
      <property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
      <property name="javax.persistence.jdbc.password" value=""/>
      <property name="eclipselink.ddl-generation" value="create-tables"/>
      <property name="eclipselink.ddl-generation.output-mode" value="database"/>
      <property name="eclipselink.ddl-generation-mode" value="ddl_database_generation"/>
      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
    </properties>
  </persistence-unit>
</persistence>


This is my ManagerEntity that init database connexion :

 /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;

import javax.persistence.Persistence;

/**
 *
 * @author instantech
 */
public class ManagerEntity {

    private final EntityManagerFactory emfactory;
    private final EntityManager entitymanager;

    public ManagerEntity() {
        this.emfactory = Persistence.createEntityManagerFactory("AfricaBadjaPU");
        this.entitymanager = this.emfactory.createEntityManager();
    }

    public EntityManagerFactory getEmfactory() {
        return emfactory;
    }

    public EntityManager getEntitymanager() {
        return entitymanager;
    }

    public void close() {
        this.entitymanager.close();
        this.emfactory.close();
    }

    public boolean save(Object object) {
        try {
            this.getEntitymanager().getTransaction().begin();
            this.getEntitymanager().persist(object);
            this.getEntitymanager().getTransaction().commit();
            this.close();
            return true;
        } catch (Exception e) {
                System.err.println("Error : " + e.getMessage());
        } 

        return false;

    }

    public boolean remove(Object object, Integer id) {
        try {
            this.getEntitymanager().getTransaction().begin();
            object = this.getEntitymanager().find(object.getClass(), id);
            this.getEntitymanager().remove(object);
            this.getEntitymanager().getTransaction().commit();
            this.close();
            return true;
        } catch (Exception e) {
            System.err.println("Error : " + e.getMessage());
        }

        return false;
    }


}


If some one can help me to fix this error.
thank. So, i'm new to the forum
Re: After generating the .jar from my IDE, I can not run it [message #1807776 is a reply to message #1807775] Sat, 08 June 2019 20:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30309
Registered: July 2009
Senior Member
It's probably better to ask on the EclipseLink forum: https://www.eclipse.org/forums/index.php?t=thread&frm_id=111
Re: After generating the .jar from my IDE, I can not run it [message #1807785 is a reply to message #1807776] Sun, 09 June 2019 11:46 Go to previous messageGo to next message
S. C Jerôme  Onadja is currently offline S. C Jerôme OnadjaFriend
Messages: 3
Registered: June 2019
Junior Member
Thank you all. The problem was resolved. It's just that the version of eclipseLink I used is not compatible with jdk 11. I compiled with jdk8 on netbeans, while on my terminal on ubuntu uses jdk 11. So I just changed the default jdk of my machine.
Re: After generating the .jar from my IDE, I can not run it [message #1807786 is a reply to message #1807785] Sun, 09 June 2019 11:48 Go to previous message
S. C Jerôme  Onadja is currently offline S. C Jerôme OnadjaFriend
Messages: 3
Registered: June 2019
Junior Member
I ask the administrators to close the subject because I do not see the part to put the subject in solved.
Previous Topic:JRE Needed For JDK 12
Next Topic:Hanging on reote development for python scrips on RPI
Goto Forum:
  


Current Time: Fri Jul 19 14:37:13 GMT 2019

Powered by FUDForum. Page generated in 0.03082 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top