Solved

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

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 58
servlet example 17 58
eclipse buid path vs tomcat lib path 10 37
Unhandled exception type Exception 18 52
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

679 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