1 2 Previous Next 15 Replies Latest reply on Jan 8, 2002 11:32 AM by cnsxxx09

    I dont want DefaultDS as my datasource :(

    osw

      Hi.
      Hope I'm wrong but it seems like jboss does not allow any datasources but DefaultDS. I'm trying to deploy my beans working fine on weblogic. They have resource ref pointing to datasource named "DataSource". Works fine until calling ejbFind method: printing connection metadata says that connection really goes to hypersonic DB, not Oracle as I've pointed, as a result I get "TABLE does not exist".
      Commenting out DefaultDS entries in config file leads to the following error after bean verifier :

      [Container factory] Begin java:/comp/env for EJB mybean
      [Container factory] TCL java.net.URLClassLoader@50a649
      [Container factory] javax.naming.NameNotFoundException: DefaultDS not bound
      ....
      ....

      Help please, I've digged lots of pages with similar problem but none gives the key :(
      10.000 thanks in advance.

      Sorry for posting it both on newbie and db forums

        • 1. Re: I dont want DefaultDS as my datasource :(
          gt

          I have the same problem using Entity Managed Bean.

          My ressource reference is always linked to java:/DefaultDS

          extract of JNDIView

          java:comp namespace of the Fdbtab bean:
          + env (class: org.jnp.interfaces.NamingContext)
          | + as400[link -> java:/DefaultDS] (class: javax.naming.LinkRef)

          Documentation not very clear on this point.
          Thank for help


          • 2. Re: I dont want DefaultDS as my datasource :(
            delattrj

            I think you can change default datasource in jaws.xml

            jerome.

            • 3. Re: I dont want DefaultDS as my datasource :(
              delattrj
              • 4. Re: I dont want DefaultDS as my datasource :(
                osw

                Thakns for info, but I'm using Bean persistance and therefore dont need any type mappings jaws is supposed to deal with.

                Interesting thing I found in JBoss source (God save opensource):

                file org.jboss.ejb.Container.java:
                ====================================================
                if (ref.getType().equals("javax.sql.DataSource"))
                {
                // Go through JNDI and look for DataSource - use the first one
                Context dsCtx = new InitialContext();
                try
                {
                // Check if it is available in JNDI
                dsCtx.lookup("java:/DefaultDS");
                finalName = "java:/DefaultDS";
                } catch (Exception e)
                {
                Logger.debug(e);
                }
                }====================================================

                and no references to ref.getResourceName() or ref.getJndiName()

                • 5. Re: I dont want DefaultDS as my datasource :(
                  tbfmicke


                  If you look a few lines earlier in the same file you will find both getResourceName() and getJndiName() (with getJndiName() only in 2.4, not in 2.5, no idea why) and that the code snippet is in an if, and is only executed if the resource the code is really looking for is not found. (At least as far as I understand the code, I might be missing something)



                  >
                  > Interesting thing I found in JBoss source (God save
                  > opensource):
                  >
                  >
                  > and no references to ref.getResourceName() or
                  > ref.getJndiName()

                  • 6. Re: I dont want DefaultDS as my datasource :(
                    delattrj

                    did you try it ?
                    I've changed the default datasource in jaws for CMP first.
                    and I did not had your problem when testing BMP few days later ...

                    • 7. Re: I dont want DefaultDS as my datasource :(
                      osw

                      Hi again.
                      editing jaws didn't help me.
                      But I got my beans working after editing Container.java and placing class back to jboss.jar
                      =======
                      //dsCtx.lookup("java:/DataSource");
                      //finalName = "java:/DataSource";
                      dsCtx.lookup(finalName = "java:/" + resourceName);
                      =======
                      Sure it might be wrong in general (I'm not an jndi expert) but works fine for my case.

                      • 8. Re: I dont want DefaultDS as my datasource :(
                        cnsxxx09

                        Hi,

                        I have the same problem...(JBoss 3 Alpha)

                        I created the oracleds-service.xml (from the on-line manual...which I can see is created ok) and put the following in jaws.xml

                        OracleDS <type-mapping>Oracle8</type-mapping>

                        but when I try to use my beans I get the Deployment Exception:
                        Error: can't find data source: java:/DefaultDS

                        ....and yet there is no reference to DefaultDS anywhere in my jar file

                        If I had a TYPO somewhere maybe in my OracleDS or oracleds-service.xml then I could understand if that was the error message...but I'm baffled as to why DefaultDS is looked for...

                        Any ideas?

                        TIA

                        Chris
                        -=-=

                        • 10. Re: I dont want DefaultDS as my datasource :(
                          cnsxxx09

                          Thanks for the reply and the pointer...

                          I now have my oracleds-service.xml as follows...
                          OracleDS
                          which deploys as a JBOSS System Service:
                          service=ConnectionFactoryLoader,name=OracleDS

                          My ejb-jar.xml contains (per bean):
                          <resource-ref>
                          <res-ref-name>jdbc/Oracle</res-ref-name>
                          <res-type>javax.sql.DataSource</res-type>
                          <res-auth>Container</res-auth>
                          </resource-ref>

                          and my jboss.xml file (per bean):
                          <resource-ref>
                          <res-ref-name>jdbc/Oracle</res-ref-name>
                          <resource-name>OracleDS</resource-name>
                          </resource-ref>
                          and (general):
                          <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
                          <res-name>OracleDS</res-name>
                          <res-jndi-name>java:/OracleDS</res-jndi-name>
                          </resource-manager

                          and my jaws.xml file:
                          OracleDS <type-mapping>Oracle8</type-mapping>

                          ....but still no joy. I've been staring and staring at this for some time now that my eyes have gone square!
                          Is there something obvious I'm missing?

                          Thanks

                          Chris
                          -=-=-

                          • 11. Re: I dont want DefaultDS as my datasource :(
                            garymarsh

                            Hi,

                            I am using MS SQLSERVER as my datasource and I made the following changes to my standardjaws.xml file:

                            <?xml version="1.0" encoding="UTF-8"?>


                            <!--
                            java:/DefaultDS
                            <type-mapping>Hypersonic SQL</type-mapping>
                            false
                            -->

                            java:/SQLServerPool
                            <type-mapping>MS SQLSERVER2000</type-mapping>
                            false

                            ===========

                            I also made the following changes in the jboss.jcml,

                            <!-- ==================================================================== -->
                            <!-- JDBC -->
                            <!-- ==================================================================== -->

                            <!-- Add your JDBC Driver i.e. Microsoft JDBC for SQLServer here -->



                            org.hsqldb.jdbcDriver,
                            com.microsoft.jdbc.sqlserver.SQLServerDriver





                            <!-- This is the setup for MSSQLServer Connection Pool -->


                            org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
                            SQLServerPool
                            DatabaseName=PayeArchitecture;SelectMethod=cursor
                            jdbc:microsoft:sqlserver://localhost:1433
                            1200000
                            paye
                            richrules
                            10
                            false
                            false
                            false
                            true
                            120000
                            1800000
                            false
                            false
                            1.0
                            0



                            see if this might help.

                            Gary

                            • 12. Re: I dont want DefaultDS as my datasource :(

                              I assume </resource-manager is a mis-type and the >
                              is really there.
                              Also is your <resource-manager> a child of a
                              <resource-managers>?

                              I did find that if the resource-manager is not
                              present, the DefaultDS is only a debug message.
                              It will use whatever is in standardjaws.xml

                              DefaultDS is also mentioned in standardjbosscmp-jdbc.xml

                              I've just done what you did except with hsqldb,
                              changing DefaultDS to MyDS and it all worked fine,
                              not even the warning :-)

                              This is all 3.0 latest CVS by the way.

                              Regards,
                              Adrian

                              • 13. Re: I dont want DefaultDS as my datasource :(
                                cnsxxx09

                                Hi,

                                Thanks again for the reply...

                                I am using v3 alpha...CVS is blocked at work so I can't get the latest changes.

                                I had to change some lines in my oracle service xml file because:
                                <depends optional-attribute-name="
                                didn't work but
                                <mbean-ref name="
                                did work.

                                Anyway, the answer is yes to both your first and 2nd questions......

                                Also I have now changed DefaultDS in the 2 files you mention to OracleDS and it now works (well, I no longer get the DefaultDS error message)....
                                but I guess this is not the way it should be done...

                                Onto the next problem......

                                Chris
                                -=-=-=

                                • 14. Re: I dont want DefaultDS as my datasource :(
                                  giorgio42


                                  I have been fighting with the same problem the past days, but finally I have been able to solve this problem.

                                  Two hints from my experience:
                                  - If you switch from EJB1.1 to EJB2.0 you have to use jbosscmp-jdbc.xml instead of jaws.xml, else your jaws.xml will silently be ignored and the settings will be taken from standardjbosscmp-jdbc.xml.

                                  - In jaws.xml setting the datasource directly below the top-level element works fine. In jbosscmp-jdbc.xml I have to put it inside a tag.

                                  HTH.

                                  Georg

                                  1 2 Previous Next