Solved

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

Posted on 2004-09-27
5
332 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

760 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

19 Experts available now in Live!

Get 1:1 Help Now