users@glassfish.java.net

"null Deployment Error"

From: <glassfish_at_javadesktop.org>
Date: Thu, 02 Aug 2007 13:03:14 PDT

Hi,

I'm having this weird problem with glassfish...
I created 2 Entity Beans and 1 Stateless Session Bean, and when deploying I get:

Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException: Deployment Error -- null
        at oracle.toplink.essentials.platform.database.PostgreSQLPlatform.platformSpecificSequencingInitialization(PostgreSQLPlatform.java:413)
        at oracle.toplink.essentials.internal.sequencing.SequencingManager.onConnect(SequencingManager.java:568)
        at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.initializeSequencing(DatabaseSessionImpl.java:137)
        at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:371)
        at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:360)
        at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:677)
        at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:559)
        at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:180)
        at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:230)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:113)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:107)
        at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.loadPersistenceUnitBundle(PersistenceProcessor.java:468)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.createTablesInDB(PersistenceProcessor.java:325)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processAppBundle(PersistenceProcessor.java:190)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:125)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:193)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:152)
        at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:109)
        at com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:66)
        at com.sun.enterprise.deployment.backend.ModuleDeployer.handlePostDeployEvent(ModuleDeployer.java:689)
        at com.sun.enterprise.deployment.backend.ModuleDeployer.postDeploy(ModuleDeployer.java:677)
        at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:169)
        at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
        at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
        at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
        at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)

I am using Sun Java System Aptication Server Platform Edition 9.0 with Postgresql - the Project is a Java EE 5 project

############################
Stateless Session Bean:
############################

@Stateless
public class CrawlerBean implements CrawlerRemote, CrawlerLocal {
    
    @PersistenceContext(unitName="SAM-ejbPU")
    private EntityManager em;
    
    /** Creates a new instance of CrawlerBean */
    public CrawlerBean() {
    }
    
    private String parseISToString(java.io.InputStream is){
        java.io.DataInputStream din = new java.io.DataInputStream(is);
        StringBuffer sb = new StringBuffer();
        try{
            String line = null;
            while((line=din.readLine()) != null){
                sb.append(line+"\n");
            }
        }catch(Exception ex){
            ex.getMessage();
        }finally{
            try{
                is.close();
            }catch(Exception ex){}
        }
        return sb.toString();
    }
    
    public boolean CrawlAndSave(String uri) {
        Website site = new Website();
        site.setUri(uri);
        Crawl crawl = new Crawl();
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        crawl.setCrawlDate(cal);
        try {
            
            URL url = new URL(uri);
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestProperty("User-Agent","Q-Client");
            con.connect();
            String html = parseISToString(con.getInputStream());
            crawl.setHtml(html);
            
            em.persist(crawl);
            em.persist(site);
            return true;
        } catch (MalformedURLException ex) {
            ex.printStackTrace();
            return false;
        } catch (IOException ex) {
            ex.printStackTrace();
            return false;
        }
    }
    
    public void persist(Object object) {
        // TODO:
        // em.persist(object);
    }

}

###################
1st Entity:
###################

@Entity
public class Crawl implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    @Temporal(value = TemporalType.TIMESTAMP)
    private Calendar crawldate;
    
    @Lob
    private String html;
    
    /** Creates a new instance of Crawl */
    public Crawl() {
    }

    public void setHtml(String html) {
        this.html = html;
    }
    
    public String getHtml() {
        return html;
    }
    
    public Calendar getCrawlDate() {
        return crawldate;
    }
    
    public void setCrawlDate(Calendar crawldate) {
        this.crawldate = crawldate;
    }
    
    /**
     * Lädt den id dieses Crawl.
     * @return Der id
     */
    public Long getId() {
        return this.id;
    }

    /**
     * Setzt den id dieses Crawl auf den angegebenen Wert.
     * @param id der neue id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Liefert einen Hashwert für das Objekt. Die Implementation berechnet
     * a hash code value based on the id fields in this object.
     * @return ein Hashwert für das Objekt this.
     */
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    /**
     * Entscheidet, ob ein anderes Objekt gleich this ist Crawl. Das Ergebnis ist
     * <code>true</code> genau dann wenn das Argument nicht null ist und ein Crawl Objekt, das
     * dieselben ID-Feldwerte wie das Objekt this hat.
     * @param Objekt das Referenzobjekt zum Vergleich
     * @return <code>true</code> wenn das Objekt this gleich dem Argument ist;
     * <code>false</code> sonst.
     */
    @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 Crawl)) {
            return false;
        }
        Crawl other = (Crawl)object;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
        return true;
    }

    /**
     * Liefert eine Textdarstellung des Objektes. Diese Implementation berechnet
     * die Darstellung auf Basis der ID-Feldwerte.
     * @return eine Textdarstellung des Objektes.
     */
    @Override
    public String toString() {
        return "sam.core.ejb.Crawl[id=" + id + "]";
    }
    
}

####################
2nd Entity:
####################

@Entity
public class Website implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    @OneToMany @OrderBy("crawldate desc")
    private List<Crawl> site;
    
    /** Creates a new instance of Website */
    public Website() {

    }

    public String getHtml() {
        return site.get(0).getHtml();
    }
    
    /**
     * Lädt den id dieses Website.
     * @return Der id
     */
    public Long getId() {
        return this.id;
    }

    /**
     * Setzt den id dieses Website auf den angegebenen Wert.
     * @param id der neue id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Liefert einen Hashwert für das Objekt. Die Implementation berechnet
     * a hash code value based on the id fields in this object.
     * @return ein Hashwert für das Objekt this.
     */
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    /**
     * Entscheidet, ob ein anderes Objekt gleich this ist Website. Das Ergebnis ist
     * <code>true</code> genau dann wenn das Argument nicht null ist und ein Website Objekt, das
     * dieselben ID-Feldwerte wie das Objekt this hat.
     * @param Objekt das Referenzobjekt zum Vergleich
     * @return <code>true</code> wenn das Objekt this gleich dem Argument ist;
     * <code>false</code> sonst.
     */
    @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 Website)) {
            return false;
        }
        Website other = (Website)object;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
        return true;
    }

    /**
     * Liefert eine Textdarstellung des Objektes. Diese Implementation berechnet
     * die Darstellung auf Basis der ID-Feldwerte.
     * @return eine Textdarstellung des Objektes.
     */
    @Override
    public String toString() {
        return "sam.core.ejb.Website[id=" + id + "]";
    }

    /**
     * Enthält den Wert der Eigenschaft uri.
     */
    private String uri;

    /**
     * Abfrage für Eigenschaft uri.
     * @return Wert der Eigenschaft uri.
     */
    public String getUri() {
        return this.uri;
    }

    /**
     * Zuweisung für Eigenschaft uri.
     * @param uri Neuer Wert der Eigenschaft uri.
     */
    public void setUri(String uri) {
        this.uri = uri;
    }
    
}
[Message sent by forum member 'vajav' (vajav)]

http://forums.java.net/jive/thread.jspa?messageID=229245