JBoss DeploymentException: can't find data source: java:/ZeittoolDS; NameNotFoundException: ZeittoolDS not bound

I use MyEclipse, JBoss Application server with SQL SERVER 2000 DB. When i try to deploy my EJB project, I get the exception:

................
................
org.jboss.deployment.DeploymentException: Error: can't find data source: java:/ZeittoolDS; - nested throwable: (javax.naming.NameNotFoundException: ZeittoolDS not bound)
................
................
Caused by: javax.naming.NameNotFoundException: Zeittoolejb not bound
...............

This is my mssql-ds.xml file (I am sure the detials here are correct):
--------------------------------------------------------------------------------

<datasources>
  <local-tx-datasource>
    <jndi-name>ZeittoolDS</jndi-name>
    <connection-url>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=zeittool</connection-url>
    <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
    <user-name>sa</user-name>
    <password></password>
  </local-tx-datasource>
</datasources>


My xdoclet-build.xml ( file which is created based on the 'Properties' of the 'Zeittoolejb' EJB Project) :
------------------------------------------------------------------------------------------------------------------

.................
................
<jboss Version="3.2"  datasource="java:/ZeittoolDS"  datasourceMapping="MS SQLSERVER2000"  createTable="true"  removeTable="false"  destDir="src/META-INF" >
</jboss>
................
................

when i see the JNDI-VIEW in my jmx-console i get:
------------------------------------------------------------

null

java:comp
GesperrteMonate

env
org.jnp.interfaces.NamingContext

.........................
........................

where "GesperrteMonate" is my entity Java class.


I have "MS SQLSERVER2000" datasourceMapping in my stabdardjboss-jdbc.xml. I am not sure what might be the other reason for my problem ?
Any help is appreciated.
LVL 32
ldbkuttyAsked:
Who is Participating?
 
TimYatesConnect With a Mentor Commented:
It's probably getting confused over the two "* @ejb.pk-field" tags, so creating the constructor twice...

Hmmmm

Instead of:

     /**
      * @author bj 17.09.2004
      * BenutzerId
      *
      * @ejb.interface-method view-type = "both"
      * @ejb.pk-field
      *
      * @return
      */
     public abstract Integer getBenutzerId();

     /**
      * @ejb.interface-method view-type = "both"
      * @param benutzerId    
      */
     public abstract void setBenutzerId(Integer benutzerId);
     
     /**
      * @author bj 17.09.2004
      * AufgabenId
      *
      * @ejb.interface-method view-type = "both"
      * @ejb.pk-field
      *
      * @return
      */
     public abstract Integer getAufgabenId();

     /**
      * @ejb.interface-method view-type = "both"
      * @param aufgabeId    
      */
     public abstract void setAufgabenId(Integer aufgabeId);

can't you just have:

     /**
      * @author bj 17.09.2004
      * BenutzerId
      *
      * @ejb.interface-method view-type = "both"
      * @ejb.pk-field
      *
      * @return
      */
     public abstract FavoritenPK getKey();

     /**
      * @ejb.interface-method view-type = "both"
      * @param pk    
      */
     public abstract void setKey( FavoritenPK pk );
     
?

Not sure...hopefully that will fix it...  My XDoclet experience is slight :-(  But I am learning ;-)

Hope it does fix it....the XDoclet documentation on the web is (ironically) rubbish ;-)

Tim
0
 
TimYatesCommented:
Does it look like it is Deploying ok in the server.log?

It should say something like:

ZeittoolDS bound to java:/ZeittoolDS

And are you trying to get to this datasource from an external client?

If so, you can't...the datasource is only available internally to jboss and the EJBs...
0
 
ldbkuttyAuthor Commented:
Hi TimYates,

Same result in my server.log !!

and, everything is in my local system only.

I hope i miss somthing which is very basic. Could you tell me what might the reason for "Naming Exception" and "Datasource not bound" ?
0
 
ldbkuttyAuthor Commented:
Hai Tim,

Atlast, i re-installed and re-configured JBoss with SQLSERVER and am successful. :-) I will just put the link that helped me(for future reference):
http://www.oreillynet.com/cs/user/view/cs_msg/33739
0
 
ldbkuttyAuthor Commented:
Tim,

I hope you wont mind to clear this problem for me :-) and get the points. It was you who helped me in creating this Class: http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21134850.html

Ok.. I have this 'Entity' Class now ... sorry for the length :-( :

------------------------------------------------------------------------------------------------------------------------
package de.grassgmbh.zeittool.entity.ejb;

import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;

import de.grassgmbh.zeittool.entity.interfaces.AufgabeLocal;
import de.grassgmbh.zeittool.entity.interfaces.MitarbeiterLocal;
import de.grassgmbh.zeittool.entity.interfaces.FavoritenPK;

/**
 *
 * @ejb.bean name = "Favoriten"
 *           type = "CMP"
 *           cmp-version = "2.x"
 *           display-name = "Favoriten"
 *           description = "Favoriten EJB"
 *           view-type = "both"
 *           jndi-name = "ejb/FavoritenHome"
 *           local-jndi-name = "ejb/FavoritenLocalHome"
 *
 * @ejb.pk generate = "true"    
 * @ejb:util
 * @ejb.persistence  table-name = "tfavoriten"
 * @ejb.util generate="physical"
 *
 * @ejb.finder
 *       signature = "java.util.Collection findAll()"
 *       query = "select object(c) from Favoriten as c "
 *  
 * @ejb.value-object match = "*" name="Favoriten"
 * @jboss.persistence remove-table = "false"
 * @jboss.entity-command name = "mssql-fetch-key"
 *
 */

public abstract class Favoriten implements EntityBean {

      /**
       * @author bj 17.09.2004
       * Priorität
       *
       * @ejb.interface-method view-type = "both"
       * @ejb.persistence column-name = "fprioritaet"
       * @return
       */
      public abstract Integer getPrioritaet();

      /**
       * @ejb.interface-method view-type = "both"
       * @param prioritaet
       */
      public abstract void setPrioritaet(Integer prioritaet);
      
      /**
       * @author bj 17.09.2004
       * BenutzerId
       *
       * @ejb.interface-method view-type = "both"
       * @ejb.pk-field
       *
       * @return
       */
      public abstract Integer getBenutzerId();

      /**
       * @ejb.interface-method view-type = "both"
       * @param benutzerId      
       */
      public abstract void setBenutzerId(Integer benutzerId);
      
      /**
       * @author bj 17.09.2004
       * AufgabenId
       *
       * @ejb.interface-method view-type = "both"
       * @ejb.pk-field
       *
       * @return
       */
      public abstract Integer getAufgabenId();

      /**
       * @ejb.interface-method view-type = "both"
       * @param aufgabeId      
       */
      public abstract void setAufgabenId(Integer aufgabeId);
      
      /**
       * @author bj 17.09.2004
       * Favoriten Aufgabe Relation
       *
       * @ejb.interface-method
       *       view-type = "local"
       *
       * @ejb.relation
       *       name = "favoriten_aufgabe"
       *  role-name = "favoriten from aufgaben"
       *  
       * @jboss.relation
       *       fk-column = "faufgaben_id"
       *       related-pk-field = "id"
       *       fk-constraint = "true"
       */
      public abstract AufgabeLocal getAufgabe();

      /**
       * @ejb.interface-method view-type = "local"
       * @param aufgabe
       */
      public abstract void setAufgabe(AufgabeLocal aufgabe);
      
      /**
       * @author bj 17.09.2004
       * Favoriten Mitarbeiter Relation
       *
       * @ejb.interface-method
       *       view-type = "local"
       *
       * @ejb.relation
       *       name = "favoriten_mitarbeiter"
       *  role-name = "favoriten from mitarbeiter"
       *  
       * @jboss.relation
       *       fk-column = "fmitarbeiter_id"
       *       related-pk-field = "id"
       *       fk-constraint = "true"
       */
      public abstract MitarbeiterLocal getMitarbeiter();

      /**
       * @ejb.interface-method view-type = "local"
       * @param mitarbeiter
       */
      public abstract void setMitarbeiter(MitarbeiterLocal mitarbeiter);
      
      
      /** The EntityContext */
      private EntityContext context;

      public FavoritenPK ejbCreate() throws CreateException {
            return null;
      }

      public void ejbPostCreate() throws CreateException {
      }

      public void ejbActivate() throws EJBException {
      }

      public void ejbPassivate() throws EJBException {
      }

      public void ejbLoad() throws EJBException {
      }

      public void ejbStore() throws EJBException {
      }

      public void ejbRemove() throws EJBException, RemoveException {
      }

      public void setEntityContext(EntityContext newContext) throws EJBException {
            context = newContext;
      }

      public void unsetEntityContext() throws EJBException {
            context = null;
      }
}

------------------------------------------------------------------------------------------------------------------------

The only problem is My 'XDoclet' creates two times same method in the 'FavoritenPK.java' Class. Like this:

public class FavoritenPK
   extends java.lang.Object
   implements java.io.Serializable
{
   private int _hashCode = 0;
   private StringBuffer _toStringValue = null;

   public FavoritenPK()
   {
   }

   public FavoritenPK(  )
   {
   }

// and so on.

Everytime, i re-XDoclet my EJB project, i need to delete one of FavoritenPK( ) method and delpoy.

Any suggestion !?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.