Solved

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

Posted on 2004-09-27
5
333 Views
Last Modified: 2008-02-20
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.
0
Comment
Question by:ldbkutty
  • 3
  • 2
5 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 12166938
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
 
LVL 32

Author Comment

by:ldbkutty
ID: 12175486
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
 
LVL 32

Author Comment

by:ldbkutty
ID: 12176284
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
 
LVL 32

Author Comment

by:ldbkutty
ID: 12176376
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
 
LVL 35

Accepted Solution

by:
TimYates earned 500 total points
ID: 12177606
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse compiler vs Installed JREs option 3 75
github account with ecipse 1 42
Java SE 8u111  Lot of stuff broke 11 54
Arrays.asList  VS  ArrayList 4 44
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now