JPA + SwingWorker : Query Error
I have a JFrame named "**jf_suggestion**" contains a JList initially empty, it will be filled by a list of String from DB , its named "**jf_seggestion_liste**".
This Jframe&JList is displayed whenever the user types a character in the JXFormatedTextField its named "**libel_article**"..

This is a customized suggestion system... Here's the source code :

      //This is the method of triggering event
     private void libel_articleKeyTyped(java.awt.event.KeyEvent evt) {                                       
    
        SwingWorker<Vector,String> sw=new SwingWorker<Vector,String>() {

            @Override
            protected Vector doInBackground() throws Exception {
                ArticleJpaController ajc=null;
                
            Vector l_article=(Vector) ajc.finArticleBylibelle(libel_article.getText());
           
            return l_article;
            }
            
           @Override
         protected void done(){
                Vector l_article=null;
                try {
                   l_article=get();
                } catch (InterruptedException ex) {
                    Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
                } catch (ExecutionException ex) {
                    Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
                }
             
   
                 // filling the JList by ​​recovered values 
                jf_seggestion_liste.setListData(l_article);
                 //we display our suggestion box
              jf_suggestion.setVisible(true);
            
      
           
     //recovering the size of our JXForamtedTextField  
       Rectangle rect = libel_article.getBounds();
       
     //we create a new rectangle & setbounds(...) to the JFrame
       Rectangle rectc = new Rectangle(rect.x+rect.width+23, rect.y+rect.height, 250, 350);
       jf_suggestion.setBounds(rectc);
         }
    
    };
        
      sw.execute();  
    
    }         

the method that retrieves the list of Strings :

       public List<String> finArticleBylibelle(String libelle){
         EntityManager em = getEntityManager();
        Query qr= em.createQuery("SELECT a.libel FROM Article a WHERE   a.libel='"+libelle+"'");
       return qr.getResultList();
       }


I also tried :


       public List<String> finArticleBylibelle(String libelle){
         EntityManager em = getEntityManager();
        Query qr= em.createQuery("SELECT a.libel FROM Article a");
       return qr.getResultList();
       }

I get this Error (in the line    **l_article=get();**):

        java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
	at java.util.concurrent.FutureTask.get(FutureTask.java:111)
	at javax.swing.SwingWorker.get(SwingWorker.java:602)
	at glob.main$20.done(main.java:1241)
	at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
	at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
	at    javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
	at javax.swing.Timer.fireActionPerformed(Timer.java:312)
	at javax.swing.Timer$DoPostEvent.run(Timer.java:244)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
	at java.awt.EventQueue.access$000(EventQueue.java:101)
	at java.awt.EventQueue$3.run(EventQueue.java:666)
	at java.awt.EventQueue$3.run(EventQueue.java:664)
	at java.security.AccessController.doPrivileged(Native Method)
	at   java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at   java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
        Caused by: java.lang.NullPointerException
	at glob.main$20.doInBackground(main.java:1232)
	at glob.main$20.doInBackground(main.java:1226)
	at javax.swing.SwingWorker$1.call(SwingWorker.java:296)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at javax.swing.SwingWorker.run(SwingWorker.java:335)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)

        Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at javax.swing.JList$5.getSize(JList.java:1722)
	at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1342)
	at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1311)
	at javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:578)
	at javax.swing.JComponent.getPreferredSize(JComponent.java:1660)
	at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:790)
	at java.awt.Container.layout(Container.java:1503)
	at java.awt.Container.doLayout(Container.java:1492)
	at java.awt.Container.validateTree(Container.java:1688)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validate(Container.java:1623)
	at java.awt.Container.validateUnconditionally(Container.java:1660)
	at java.awt.Window.show(Window.java:1032)
	at java.awt.Component.show(Component.java:1651)
	at java.awt.Component.setVisible(Component.java:1603)
	at java.awt.Window.setVisible(Window.java:1013)
	at glob.main$20.done(main.java:1252)
	at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
	at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)

HELPS PLEASE!

JPA + SwingWorker : Query Error
===

I have a JFrame named "**jf_suggestion**" contains a JList initially empty, it will be filled by a list of String from DB , its named "**jf_seggestion_liste**".
This Jframe&JList is displayed whenever the user types a character in the JXFormatedTextField its named "**libel_article**"..

This is a customized suggestion system... Here's the source code :

      //This is the method of triggering event
     private void libel_articleKeyTyped(java.awt.event.KeyEvent evt) {                                       
    
        SwingWorker<Vector,String> sw=new SwingWorker<Vector,String>() {

            @Override
            protected Vector doInBackground() throws Exception {
                ArticleJpaController ajc=null;
                
            Vector l_article=(Vector) ajc.finArticleBylibelle(libel_article.getText());
           
            return l_article;
            }
            
           @Override
         protected void done(){
                Vector l_article=null;
                try {
                   l_article=get();
                } catch (InterruptedException ex) {
                    Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
                } catch (ExecutionException ex) {
                    Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
                }
             
   
                 // filling the JList by ​​recovered values 
                jf_seggestion_liste.setListData(l_article);
                 //we display our suggestion box
              jf_suggestion.setVisible(true);
            
      
           
     //recovering the size of our JXForamtedTextField  
       Rectangle rect = libel_article.getBounds();
       
     //we create a new rectangle & setbounds(...) to the JFrame
       Rectangle rectc = new Rectangle(rect.x+rect.width+23, rect.y+rect.height, 250, 350);
       jf_suggestion.setBounds(rectc);
         }
    
    };
        
      sw.execute();  
    
    }         

the method that retrieves the list of Strings :

       public List<String> finArticleBylibelle(String libelle){
         EntityManager em = getEntityManager();
        Query qr= em.createQuery("SELECT a.libel FROM Article a WHERE   a.libel='"+libelle+"'");
       return qr.getResultList();
       }


I also tried :


       public List<String> finArticleBylibelle(String libelle){
         EntityManager em = getEntityManager();
        Query qr= em.createQuery("SELECT a.libel FROM Article a");
       return qr.getResultList();
       }

I get this Error (in the line    **l_article=get();**):

        java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
	at java.util.concurrent.FutureTask.get(FutureTask.java:111)
	at javax.swing.SwingWorker.get(SwingWorker.java:602)
	at glob.main$20.done(main.java:1241)
	at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
	at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
	at    javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
	at javax.swing.Timer.fireActionPerformed(Timer.java:312)
	at javax.swing.Timer$DoPostEvent.run(Timer.java:244)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
	at java.awt.EventQueue.access$000(EventQueue.java:101)
	at java.awt.EventQueue$3.run(EventQueue.java:666)
	at java.awt.EventQueue$3.run(EventQueue.java:664)
	at java.security.AccessController.doPrivileged(Native Method)
	at   java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at   java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
        Caused by: java.lang.NullPointerException
	at glob.main$20.doInBackground(main.java:1232)
	at glob.main$20.doInBackground(main.java:1226)
	at javax.swing.SwingWorker$1.call(SwingWorker.java:296)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at javax.swing.SwingWorker.run(SwingWorker.java:335)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)

        Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at javax.swing.JList$5.getSize(JList.java:1722)
	at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1342)
	at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1311)
	at javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:578)
	at javax.swing.JComponent.getPreferredSize(JComponent.java:1660)
	at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:790)
	at java.awt.Container.layout(Container.java:1503)
	at java.awt.Container.doLayout(Container.java:1492)
	at java.awt.Container.validateTree(Container.java:1688)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validateTree(Container.java:1697)
	at java.awt.Container.validate(Container.java:1623)
	at java.awt.Container.validateUnconditionally(Container.java:1660)
	at java.awt.Window.show(Window.java:1032)
	at java.awt.Component.show(Component.java:1651)
	at java.awt.Component.setVisible(Component.java:1603)
	at java.awt.Window.setVisible(Window.java:1013)
	at glob.main$20.done(main.java:1252)
	at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
	at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)

HELPS PLEASE!
