facebook

Sorry!!

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #220702 Reply

    justine
    Participant

    excuse me, I make a mistake in my CMP bean so I couldn’t see my ebj on my JBoss container.
    JNDI is the server namming on JBOSS.

    But now I have an other problem, when I run my application I have an exception like that :

    javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]

    can you help me please?

    #220713 Reply

    Riyad Kalla
    Member

    Justine,
    These are really JBoss issues. While we would certainly try and help you if we could, none of us here are JBoss gurus. Have you tried asking in the JBoss forums? I’m sure they have dealt with issues like this quite a few times and can probably tell you where to look right away.

    Moving to OT > Soft Dev.

    #220717 Reply

    justine
    Participant

    thank you for your answer but I think that it’s a problem with my cmp bean because I don’t know if I use local or remote entity bean !!!
    And I don’t precise it!
    And maybe it’s the problem?

    #220718 Reply

    Riyad Kalla
    Member

    justine,
    I think the best thing to do is head over to our new Documentation (http://www.myeclipseide.com/ContentExpress-display-ceid-67.html) and check out our EJB Tutorial here: http://www.myeclipseide.com/images/tutorials/quickstarts/firstejb/

    #220720 Reply

    justine
    Participant

    In fact, I already to do that do you want to see my code because don’t what is the problem.

    /*
    * Created on 7 déc. 2004
    *
    * TODO To change the template for this generated file go to
    * Window – Preferences – Java – Code Style – Code Templates
    */
    package test.ejb;

    //import test.interfaces.*;
    import javax.ejb.CreateException;
    import javax.ejb.EJBException;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    import javax.ejb.RemoveException;

    /**
    * @author SANTINI JUSTINE
    *
    * TODO To change the template for this generated type comment go to
    * Window – Preferences – Java – Code Style – Code Templates
    */

    /**
    * XDoclet-based CMP entity bean. This class must be declared
    * <code>public abstract</code> because the concrete class will
    * be implemented by the CMP provider’s tooling.<br>
    *
    * To generate code:
    * <br>
    * <ul>
    * <li> Add Standard EJB module to XDoclet project properties
    * <li> Customize XDoclet configuration
    * <li> Run XDoclet
    * </ul>
    * <br>
    * Please see the included XDoclet Overview
    * and the XDoclet Reference in the help system for details
    *
    * @ejb.bean name = “AjouterProjetBean”
    * type = “CMP”
    * cmp-version = “2.x”
    * display-name = “AjouterProjetBean”
    * description = “AjouterProjetBean EJB”
    * view-type = “both”
    * jndi-name = “ejb/AjouterProjetBeanHome”
    * local-jndi-name = “ejb/AjouterProjetBeanLocalHome”
    * primkey-field = “id_projet”
    * @ejb.persistence table-name = “Projet”
    * @jboss.persistence table-name = “Projet”
    * @ejb:util
    * generate=”physical”
    */
    public abstract class AjouterProjetBean implements EntityBean {

    /** The EntityContext */
    private EntityContext context;

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “id_projet”
    * @ejb.pk-field
    * @return
    */
    public abstract String getId_projet();

    /**
    * @ejb.interface-method view-type = “both”
    * @param id_projet
    */
    public abstract void setId_projet(String id_projet);

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “id_logiciel”
    * @return
    */
    public abstract int getId_logiciel();

    /**
    * @ejb.interface-method view-type = “both”
    * @param id_logiciel
    */
    public abstract void setId_logiciel(int id_logiciel);

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “prix_vente”
    * @return
    */
    public abstract int getPrix_vente();

    /**
    * @ejb.interface-method view-type = “both”
    * @param prix_vente
    */
    public abstract void setPrix_vente(int prix_vente);

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “libelle”
    * @return
    */
    public abstract String getLibelle();

    /**
    * @ejb.interface-method view-type = “both”
    * @param libelle
    */
    public abstract void setLibelle(String libelle);

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “responsable”
    * @return
    */
    public abstract String getResponsable();

    /**
    * @ejb.interface-method view-type = “both”
    * @param responsable
    */
    public abstract void setResponsable(String responsable);

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “date_pre_deb”
    * @return
    */
    public abstract String getDate_pre_deb();

    /**
    * @ejb.interface-method view-type = “both”
    * @param date_pre_deb
    */
    public abstract void setDate_pre_deb(String date_pre_deb);

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “date_pre_fin”
    * @return
    */
    public abstract String getDate_pre_fin();

    /**
    * @ejb.interface-method view-type = “both”
    * @param date_pre_fin
    */
    public abstract void setDate_pre_fin(String date_pre_fin);

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “date_eff_deb”
    * @return
    */
    public abstract String getDate_eff_deb();

    /**
    * @ejb.interface-method view-type = “both”
    * @param date_eff_deb
    */
    public abstract void setDate_eff_deb(String date_eff_deb);

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “date_eff_fin”
    * @return
    */
    public abstract String getDate_eff_fin();

    /**
    * @ejb.interface-method view-type = “both”
    * @param date_eff_fin
    */
    public abstract void setDate_eff_fin(String date_eff_fin);

    /**
    * @ejb.interface-method view-type = “both”
    * @ejb.persistence column-name = “nom_client”
    * @return
    */
    public abstract String getNom_client();
    /**
    * @ejb.interface-method view-type = “both”
    * @param nom_client
    */
    public abstract void setNom_client(String nom_client);

    /**
    * There are zero or more ejbCreate<METHOD>(…) methods, whose signatures match
    * the signatures of the create<METHOD>(…) methods of the entity bean’s home interface.
    * The container invokes an ejbCreate<METHOD>(…) method on an entity bean instance
    * when a client invokes a matching create<METHOD>(…) method on the entity bean’s
    * home interface.<br>
    *
    * The entity bean provider’s responsibility is to initialize the instance in the ejbCreate<
    * METHOD>(…) methods from the input arguments, using the get and set accessor
    * methods, such that when the ejbCreate<METHOD>(…) method returns, the persistent
    * representation of the instance can be created. <br>
    *
    * The entity bean provider must not attempt to modify the values of cmr-fields in an ejbCreate<
    * METHOD(…) method; this should be done in the ejbPostCreate<METHOD(…) method instead.<br>
    *
    * The entity object created by the ejbCreate<METHOD> method must have a unique primary
    * key. This means that the primary key must be different from the primary keys of all the existing
    * entity objects within the same home. However, it is legal to reuse the primary key of a previously
    * removed entity object. The implementation of the bean provider’s ejbCreate<
    * METHOD>(…) methods should be coded to return a null.<br>
    *
    * An ejbCreate<METHOD>(…) method executes in the transaction context determined by
    * the transaction attribute of the matching create<METHOD>(…) method.
    * The database insert operations are performed by the container within the same
    * transaction context after the Bean Provider’s ejbCreate<METHOD>(…) method completes.
    *
    * @throws CreateException Thrown if the instance could not perform
    * the function requested by the container because of an system-level error.
    *
    * @ejb.create-method
    */
    public String ejbCreate() throws CreateException {
    //this.setId_projet(AjouterProjetBeanUtil.generateGUID(this));
    return null;
    }

    /**
    * For each ejbCreate<METHOD>(…) method, there is a matching ejbPostCreate<
    * METHOD>(…) method that has the same input parameters but whose return type is
    * void. The container invokes the matching ejbPostCreate<METHOD>(…) method on
    * an instance after it invokes the ejbCreate<METHOD>(…) method with the same arguments.
    * The instance can discover the primary key by calling getPrimaryKey() on its
    * entity context object. <br>
    *
    * The entity object identity is available during the ejbPostCreate<METHOD>(…)
    * method. The instance may, for example, obtain the component interface of the associated entity
    * object and pass it to another enterprise bean as a method argument.<br>
    *
    * The entity Bean Provider may use the ejbPostCreate<METHOD>(…) to set the values
    * of cmr-fields to complete the initialization of the entity bean instance.
    * An ejbPostCreate<METHOD>(…) method executes in the same transaction context as
    * the previous ejbCreate<METHOD>(…) method.
    *
    * @throws CreateException Thrown if the instance could not perform
    * the function requested by the container because of an system-level error.
    */
    public void ejbPostCreate() throws CreateException {
    }

    /**
    * The container invokes this method on the instance when the container picks the instance from
    * the pool and assigns it to a specific entity object identity. The ejbActivate() method gives
    * the entity bean instance the chance to acquire additional resources that it needs while it is in the
    * ready state.<br>
    *
    * This method executes with an unspecified transaction context. The entity bean must not
    * attempt to access its persistent state or relationships using the accessor methods during this
    * method.<br>
    *
    * The instance can obtain the identity of the entity object via the getPrimaryKey(), getEJBLocalObject(),
    * or getEJBObject() method on the entity context. The instance
    * can rely on the fact that the primary key and entity object identity will remain associated with
    * the instance until the completion of ejbPassivate() or ejbRemove().
    *
    * @throws EJBException Thrown if the instance could not perform
    * the function requested by the container because of an system-level error.
    */
    public void ejbActivate() throws EJBException {
    }

    /**
    * The container invokes this method on an instance when the container decides to disassociate
    * the instance from an entity object identity, and to put the instance back into the pool of available
    * instances. The ejbPassivate() method gives the instance the chance to release any
    * resources that should not be held while the instance is in the pool. (These resources typically
    * had been allocated during the ejbActivate() method.) <br>
    *
    * This method executes with an unspecified transaction context. The entity bean must not
    * attempt to access its persistent state or relationships using the accessor methods during this
    * method.<br>
    *
    * The instance can still obtain the identity of the entity object via the getPrimaryKey(),
    * getEJBLocalObject(), or getEJBObject() method of the EntityContext interface.
    *
    * @throws EJBException Thrown if the instance could not perform
    * the function requested by the container because of an system-level error.
    */
    public void ejbPassivate() throws EJBException {
    }

    /**
    * When the container needs to synchronize the state of an enterprise bean instance with the
    * entity object’s persistent state, the container calls the ejbLoad() method.<br>
    *
    * The entity Bean Provider can assume that the instance’s persistent state has been loaded just
    * before the ejbLoad() method is invoked. It is the responsibility of the Bean Provider to use
    * the ejbLoad() method to recompute or initialize the values of any instance variables that
    * depend on the entity bean’s persistent state. In general, any transient state that depends on the
    * persistent state of an entity bean should be recalculated using the ejbLoad() method. The
    * entity bean can use the ejbLoad() method, for instance, to perform some computation on
    * the values returned by the accessor methods (for example, uncompressing text fields).<br>
    *
    * This method executes in the transaction context determined by the transaction attribute of the
    * business method that triggered the ejbLoad method. <br>
    *
    * @throws EJBException Thrown if the instance could not perform
    * the function requested by the container because of an system-level error.
    */
    public void ejbLoad() throws EJBException {
    }

    /**
    * When the container needs to synchronize the state of the entity object’s persistent state with the
    * state of the enterprise bean instance, the container first calls the ejbStore() method on the
    * instance.<br>
    *
    * The entity Bean Provider should use the ejbStore() method to update the instance using
    * the accessor methods before its persistent state is synchronized. For example, the ejb-
    * Store() method may perform compression of text before the text is stored in the database.
    * The Bean Provider can assume that after the ejbStore() method returns, the persistent state
    * of the instance is synchronized.<br>
    *
    * This method executes in the same transaction context as the previous ejbLoad or ejbCreate
    * method invoked on the instance. All business methods invoked between the previous
    * ejbLoad or ejbCreate<METHOD> method and this ejbStore method are also invoked
    * in the same transaction context.
    *
    * @throws EJBException Thrown if the instance could not perform
    * the function requested by the container because of an system-level error.
    */
    public void ejbStore() throws EJBException {
    }

    /**
    * The container invokes the ejbRemove() method on an entity bean instance in response to a
    * client-invoked remove operation on the entity bean’s home or component interface or as the
    * result of a cascade-delete operation. The instance is in the ready state when ejbRemove() is
    * invoked and it will be entered into the pool when the method completes.<br>
    *
    * The entity bean provider can use the ejbRemove method to implement any actions that must
    * be done before the entity object’s persistent representation is removed.
    * The container synchronizes the instance’s state before it invokes the ejbRemove method.
    * This means that the state of the instance at the beginning of the ejbRemove method is the
    * same as it would be at the beginning of a business method.
    * This method and the database delete operation(s) execute in the transaction context determined
    * by the transaction attribute of the remove method that triggered the ejbRemove method.
    * The instance can still obtain the identity of the entity object via the getPrimaryKey(),
    * getEJBLocalObject(), or getEJBObject() method of the EntityContext interface.<br>
    *
    * After the entity Bean Provider’s ejbRemove returns, and in the same transaction context, the
    * Container removes the entity bean from all relationships in which it participates before removing
    * the entity object’s persistent representation. <br>
    * Since the instance will be entered into the pool, the state of the instance at the end of this
    * method must be equivalent to the state of a passivated instance. This means that the instance
    * must release any resource that it would normally release in the ejbPassivate() method.
    *
    * @throws EJBException Thrown if the instance could not perform
    * the function requested by the container because of an system-level error.
    *
    * @throws RemoveException Thrown if the enterprise bean does not allow destruction of the object.
    */
    public void ejbRemove() throws EJBException, RemoveException {
    }

    /**
    * Set the associated entity context. The container calls this method
    * after the instance creation. The entity bean must not attempt to
    * access its persistent state and relationships using the accessor
    * methods during this method. <br>
    *
    * The enterprise bean instance should store the reference to the context
    * object in an instance variable. <br>
    *
    * This method is called with no transaction context.
    *
    * @throws EJBException Thrown if the instance could not perform
    * the function requested by the container because of an system-level error.
    */
    public void setEntityContext(EntityContext newContext) throws EJBException {
    context = newContext;
    }

    /**
    * Unset the associated entity context. A container invokes this method
    * before terminating the life of the instance. The entity bean must not
    * attempt to access its persistent state and relationships using the
    * accessor methods during this method. <br>
    *
    * This method is called with no transaction context.
    *
    * @throws EJBException Thrown if the instance could not perform
    * the function requested by the container because of an system-level error.
    */
    public void unsetEntityContext() throws EJBException {
    context = null;
    }
    }

    Thank you for your help.

    justine

    #220726 Reply

    justine
    Participant

    Excuse me for my english, but I’m a french girl a little tired ! 😳
    In my last message, I wanted to say that I already did what you told me.
    I also wanted to know if you could take a look to my code please.
    My problem is a new exception :

    javax.ejb.CreateException: Could not create entity:java.sql.SQLException: Try to insert null into a non-nullable column: column: ID_PROJET table: PROJET in statement [INSERT INTO PROJET (id_projet, id_logiciel, prix_vente, libelle, responsable, date_pre_deb, date_pre_fin, date_eff_deb, date_eff_fin, nom_client) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]

    Thank you for your answer.

    Justine

    #220733 Reply

    Riyad Kalla
    Member

    Justine,
    I’m sorry I can’t help more. Our job is to support the MyEclipse product, the problem you are having is EJB development, and unfortunately I don’t know anything about EJBs, otherwise I would atleast offer some guidence.

    Although this is an open forum, other users are free to offer any help they may have.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Sorry!!

You must be logged in to post in the forum log in