4 Replies Latest reply on Sep 22, 2008 5:43 AM by darrylburke

    NetBeans - Database application project template

    843810
      I am trying to create database application in NetBeans and it create and compile project. When I am running this project it returns error message. Can anybody help me? I have spent 2 days with looking for my fault.... :-)

      15.2.2008 18:27:53 org.jdesktop.application.Application$1 run
      SEVERE: Application class desktopapplication2.DesktopApplication2 failed to launch
      javax.persistence.PersistenceException: No Persistence provider for EntityManager named carsPU: The following providers:
      oracle.toplink.essentials.PersistenceProvider
      oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
      Returned null to createEntityManagerFactory.

      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
      at desktopapplication2.DesktopApplication2View.initComponents(DesktopApplication2View.java:281)
      at desktopapplication2.DesktopApplication2View.<init>(DesktopApplication2View.java:35)
      at desktopapplication2.DesktopApplication2.startup(DesktopApplication2.java:19)
      at org.jdesktop.application.Application$1.run(Application.java:171)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
      Exception in thread "AWT-EventQueue-0" java.lang.Error: Application class desktopapplication2.DesktopApplication2 failed to launch
      at org.jdesktop.application.Application$1.run(Application.java:177)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
      Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named carsPU: The following providers:
      oracle.toplink.essentials.PersistenceProvider
      oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
      Returned null to createEntityManagerFactory.

      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
      at desktopapplication2.DesktopApplication2View.initComponents(DesktopApplication2View.java:281)
      at desktopapplication2.DesktopApplication2View.<init>(DesktopApplication2View.java:35)
      at desktopapplication2.DesktopApplication2.startup(DesktopApplication2.java:19)
      at org.jdesktop.application.Application$1.run(Application.java:171)
      ... 8 more
      BUILD SUCCESSFUL (total time: 3 seconds)

      Edited by: Qwertz on Feb 15, 2008 9:32 AM

      Edited by: Qwertz on Feb 15, 2008 9:33 AM
        • 1. Re: NetBeans - Database application project template
          843810
          Right off the top of my head, I'd have to say that the "compiled applicatoin" cannot find your Oracle Home or at least your Oracle library software.
          • 2. Re: NetBeans - Database application project template
            843810
            Have you find any solution for this yet?
            • 3. Re: NetBeans - Database application project template
              843810
              hi there !, i was able to partially resolve that issue, you see, i am working in a java desktop application, this application has at least 28 or so entities, two were created by netbeans and the other ones I created them (mySql databse with innodb engine), so i had to code additional primitive variables to the 2 entities generated by netbeans (cliente and cartas) and had this error message:
              GRAVE: Application class jbintegra.JBIntegraApp failed to launch
              javax.persistence.PersistenceException: No Persistence provider for EntityManager named JBIntegraPU: Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory: 
              oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
              Local Exception Stack: 
              Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
              Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7
              Internal Exception: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
              Exception Description: predeploy for PersistenceUnit [JBIntegraPU] failed.
              Internal Exception: Exception [TOPLINK-7244] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.ValidationException
              Exception Description: An incompatible mapping has been encountered between [class jbintegra.Cliente] and [class jbintegra.Produccion]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer.
                      at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)
                      at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)
                      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
                      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
              
              .... bla bla bla....
              So i checked my code and commented this :
              package jbintegra;
              
              import java.beans.PropertyChangeListener;
              import java.beans.PropertyChangeSupport;
              import java.io.Serializable;
              import java.util.Collection;
              import javax.persistence.CascadeType;
              import javax.persistence.Column;
              import javax.persistence.Entity;
              import javax.persistence.GeneratedValue;
              import javax.persistence.GenerationType;
              import javax.persistence.Id;
              import javax.persistence.JoinColumn;
              import javax.persistence.ManyToOne;
              import javax.persistence.NamedQueries;
              import javax.persistence.NamedQuery;
              import javax.persistence.OneToMany;
              import javax.persistence.OneToOne;
              import javax.persistence.Table;
              import javax.persistence.Transient;
              
              /**
               *
               * @author dave
               */
              @Entity
              @Table(name = "cliente")
              @NamedQueries({@NamedQuery(name = "Cliente.findByRfc", query = "SELECT c FROM Cliente c WHERE c.rfc = :rfc"), @NamedQuery(name = "Cliente.findByIdTipoCliente", query = "SELECT c FROM Cliente c WHERE c.idTipoCliente = :idTipoCliente"), @NamedQuery(name = "Cliente.findByIdEntidad", query = "SELECT c FROM Cliente c WHERE c.idEntidad = :idEntidad"), @NamedQuery(name = "Cliente.findByIdAgente", query = "SELECT c FROM Cliente c WHERE c.idAgente = :idAgente")})
              public class Cliente implements Serializable {
                  @Transient
                  private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
                  private static final long serialVersionUID = 1L;
                  @Id
                  @GeneratedValue(strategy=GenerationType.IDENTITY)
                  @Column(name = "rfc", nullable = false)
                  private String rfc;
                  @JoinColumn(name = "idTipoCliente", referencedColumnName = "id")
                  @ManyToOne
                  private Tipocliente idTipoCliente;
                  @JoinColumn(name = "idEntidad", referencedColumnName = "id")
                  @OneToOne
                  private Entidad idEntidad;
                  @JoinColumn(name = "idAgente", referencedColumnName = "id")
                  @ManyToOne
                  private Agente idAgente;
                  @OneToMany(cascade = CascadeType.ALL, mappedBy = "rfcCliente")
                  private Collection<Carta> cartaCollection;
                  @OneToMany(cascade = CascadeType.ALL, mappedBy = "rfcCliente")
                  private Collection<Contrato> contratoCollection;
                  @OneToMany(cascade = CascadeType.ALL, mappedBy = "rfcCliente")
                  private Collection<Relacion> relacionCollection;
                  @OneToMany(cascade = CascadeType.ALL, mappedBy = "rfcCliente")
                  private Collection<Documento> documentoCollection;
              //    @OneToMany(cascade = CascadeType.ALL, mappedBy = "rfcCliente")
              //    private Collection<Produccion> produccionCollection;
              
                  public Cliente() {
                  }
              
                  public Cliente(String rfc) {
                      this.rfc = rfc;
                  }
              
                  public Cliente(String rfc, Tipocliente idTipoCliente, Entidad idEntidad, Agente idAgente) {
                      this.rfc = rfc;
                      this.idTipoCliente = idTipoCliente;
                      this.idEntidad = idEntidad;
                      this.idAgente = idAgente;
                  }
              
                  public String getRfc() {
                      return rfc;
                  }
              
                  public void setRfc(String rfc) {
                      String oldRfc = this.rfc;
                      this.rfc = rfc;
                      changeSupport.firePropertyChange("rfc", oldRfc, rfc);
                  }
              
                  public Tipocliente getIdTipoCliente() {
                      return idTipoCliente;
                  }
              
                  public void setIdTipoCliente(Tipocliente idTipoCliente) {
                      Tipocliente oldIdTipoCliente = this.idTipoCliente;
                      this.idTipoCliente = idTipoCliente;
                      changeSupport.firePropertyChange("idTipoCliente", oldIdTipoCliente, idTipoCliente);
                  }
              
                  public Entidad getIdEntidad() {
                      return idEntidad;
                  }
              
                  public void setIdEntidad(Entidad idEntidad) {
                      Entidad oldIdEntidad = this.idEntidad;
                      this.idEntidad = idEntidad;
                      changeSupport.firePropertyChange("idEntidad", oldIdEntidad, idEntidad);
                  }
              
                  public Agente getIdAgente() {
                      return idAgente;
                  }
              
                  public void setIdAgente(Agente idAgente) {
                      Agente oldIdAgente = this.idAgente;
                      this.idAgente = idAgente;
                      changeSupport.firePropertyChange("idAgente", oldIdAgente, idAgente);
                  }
              
                  public Collection<Carta> getCartaCollection() {
                      return cartaCollection;
                  }
              
                  public void setCartaCollection(Collection<Carta> cartaCollection) {
                      this.cartaCollection = cartaCollection;
                  }
              
                  @Override
                  public int hashCode() {
                      int hash = 0;
                      hash += (rfc != null ? rfc.hashCode() : 0);
                      return hash;
                  }
              
                  @Override
                  public boolean equals(Object object) {
                      // TODO: Warning - this method won't work in the case the id fields are not set
                      if (!(object instanceof Cliente)) {
                          return false;
                      }
                      Cliente other = (Cliente) object;
                      if ((this.rfc == null && other.rfc != null) || (this.rfc != null && !this.rfc.equals(other.rfc))) {
                          return false;
                      }
                      return true;
                  }
              
                  @Override
                  public String toString() {
                      return "jbintegra.Cliente[rfc=" + rfc + "]";
                  }
              
                  public void addPropertyChangeListener(PropertyChangeListener listener) {
                      changeSupport.addPropertyChangeListener(listener);
                  }
              
                  public void removePropertyChangeListener(PropertyChangeListener listener) {
                      changeSupport.addPropertyChangeListener(listener);
                  }
              
                  public Collection<Contrato> getContratoCollection() {
                      return contratoCollection;
                  }
              
                  public void setContratoCollection(Collection<Contrato> contratoCollection) {
                      this.contratoCollection = contratoCollection;
                  }
              
                  public Collection<Relacion> getRelacionCollection() {
                      return relacionCollection;
                  }
              
                  public void setRelacionCollection(Collection<Relacion> relacionCollection) {
                      this.relacionCollection = relacionCollection;
                  }
              
                  public Collection<Documento> getDocumentoCollection() {
                      return documentoCollection;
                  }
              
                  public void setDocumentoCollection(Collection<Documento> documentoCollection) {
                      this.documentoCollection = documentoCollection;
                  }
              
              //    public Collection<Produccion> getProduccionCollection() {
              //        return produccionCollection;
              //    }
              //
              //    public void setProduccionCollection(Collection<Produccion> produccionCollection) {
              //        this.produccionCollection = produccionCollection;
              //    }
              
              }
              After i did that, the 'no persistance...' problem was solved but... i cant integrate my data properly... the 'producto' entity uses a composed PK defined in ProductoPK class, does this has something to view ???

              As you can see, other properties such as:
              @OneToMany(cascade = CascadeType.ALL, mappedBy = "rfcCliente")
                  private Collection<Documento> documentoCollection;
              dont give any trouble... so, what shall i do ??
              • 4. Re: NetBeans - Database application project template
                darrylburke
                Kindly stop resurrecting old threads. 5 posts and every one a resurrection!

                This was pointed out to you the first time you posted:
                [http://forums.sun.com/thread.jspa?threadID=789190]
                See response #2: check the timestamp on the original post kiddo...

                If you have something to say/ask, please get your own thread. If relevant, provide a link to any old thread on an associated topic.

                db