Referencing JNDI data source: Tomcat 6 vs WebSphere 6.1

Hi,
I've noticed a problem whereby there is a difference in the way I have to specify my JNDI data source depending on the application server I deploy it on.
In Tomcat my code specifies "java:comp/env/DB_NAME" and this works fine.
This doesn't work though in WebSphere and I have to remove the "java:comp/env" prefix to get it to work.
Is there a common solution for this whereby my code/properties can specify the same JNDI value?
Thanks

jwenting wrote:
mycoffee wrote:
ted_hankey wrote:
Hi,
I've noticed a problem whereby there is a difference in the way I have to specify my JNDI data source depending on the application server I deploy it on.
In Tomcat my code specifies "java:comp/env/DB_NAME" and this works fine.
This doesn't work though in WebSphere and I have to remove the "java:comp/env" prefix to get it to work.
Is there a common solution for this whereby my code/properties can specify the same JNDI value?
ThanksShould not be different
wrong. There's nothing in any specification stating that jndi resource names should be identical between platforms.
On weblogic for example it would be jdbc/DB_NAME :)No
Tomcat, websphere or weblogic are not different in that term
The differences are about configuration of the servers. If the servers are configured the same, it should be the same. (Check all the config xml files)
This post is more clear
http://www.theserverside.com/discussions/thread.tss?thread_id=42158
I wrote my code like this
Context intC = new InitialContext();
Context c = (Context )intC.lookup("java:comp/env");
DataSource ds = (DataSource)c.lookup("myDataBase");
con = ds.getConnection();and it works for Tomcat + Websphere (did not try on Weblogic yet but believe it should be OK)

Similar Messages

  • How to create JNDI data source name in Tomcat 6.0.18 server?

    Hai,
    How to create JNDI data source name in Tomcat 6.0.18 server?
    Regards,
    MariMuthu.A

    [http://google.com/search?q=jndi+site:tomcat.apache.org+6.0]

  • JNDI data source

    I'm trying to use a JNDI data source in CF 10. We used to do it in CF 8 in the JRun admin, and was able to use data sources across coldFusion and java code. Any ideas on how to make it work in CF 10? I've tried several online resources, setting up a resource in Context.xml:
      <Resource name="mydatasource" auth="Container" type="javax.sql.DataSource"
                   maxActive="100" maxIdle="30" maxWait="10000"
                   username="myuser" password="mypass" driverClassName="macromedia.jdbc.MacromediaDriver"
                   url="jdbc:macromedia:sqlserver://127.0.0.1:1433;databaseName=mydb;SendStringParametersAsU nicode=false;SendStringAsUnicode=false"/>
    then a resource-ref in web.xml
    <resource-ref>
          <description>DB Connection</description>
          <res-ref-name>mydatasource</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
                </resource-ref>
    but I'm getting errors
    java.lang.IllegalArgumentException: Cannot convert value of type [jav
    a.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'
    : no matching editors or conversion strategy found

    If you want to turn your application into a provider, refer to the Developer's Guide at http://docs.sun.com/source/816-6362-10/index.html

  • Jndi data source references at deployment time

    hi,
    i have been thinking and trying for days now, so any hint is greatly appreciated.
    we have an enterprise java application with adf faces, bc4j and jpa all in one ear which runs on weblogic 10.3. we want several instances of the same application running on the same weblogic server, with different context-root's and database connections. what I don't know how to do is how I could create an application-wide jndi link to a jdbc data source at deployment time - because the data source jndi name is listed in bc4j application modules and persistence.xml - so one global jndi link for the application would be great.
    e.g.
    jndi names of data sources installed in the weblogic server:
    jdbc/customer1
    jdbc/customer2
    deployment1:
    context-path: /app-customer1
    local data source name: java:comp/env/jdbc/customer
    deployment 2:
    context-path: /app-customer2
    local data source name: java:comp/env/jdbc/customer
    so the goal is, at deployment time, to create a link to jdbc/customer1 for the first deployment and jdbc/customer2 for the second deployment using .. ?
    thank you very much,
    matt

    hi Anand,
    thank you for your answer. It is indeed a part of the solution I would need to apply - resource references in web.xml to have the bc4j application modules reference a jndi data source under java:comp/env. The other part to it is that we have an ejb jar in our jee application, built with hibernate and a persistence.xml file (yes we are crazy enough to use both bc4j and jpa in one ear). The jndi name of the data source specified in persistence.xml would not pick up a resource reference specified in web.xml would it - actually i should just try this out. So that's the 2nd part of the solution.
    cheers,
    Matt

  • JNDI, Data Source and Tomcat

    Hi,
    I am using Tomcat 4.1
    I am using JDBC to connect to to SQL 2000.
    In the past I use JDBC 2.0 standsrd package to connect to it and it was fine.
    Now, for some reason, I need to use DataSource via JNDI.
    Here is my server.xml
    <Resource name="jdbc/SQLNorthwind" scope="Shareable" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/SQLNorthwind">
    <parameter>
    <name>validationQuery</name>
    <value>select * from Products</value>
    </parameter>
    <parameter>
    <name>url</name> <value>jdbc:microsoft:sqlserver://W2KSERVER1:1433;DatabaseName=Northwind</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>george</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>20</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>george</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>2</value>
    </parameter>
    </ResourceParams>
    It was generated by the Tomcat admin tools via the web browser.
    It is my web.xml
    <servlet>
    <servlet-name>JNDIDatabase</servlet-name>
    <display-name>JNDIDatabase</display-name>
    <description>JNDIDatabase</description>
    <servlet-class>com.testing.servlet.jdbc.jndi.JNDIDatabase</servlet-class>
    </servlet>
    Now here is my servlet source code for connection testing
    private Connection conn;
    private Statement stmt;
    private ResultSet rs;
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    try {
    Context ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("jdbc/SQLNorthwind");
    conn = ds.getConnection("george", "george");
    } catch(NamingException e) {
    this.log("Naming exception in JNDIDatabase init", e);
    e.printStackTrace();
    } catch(SQLException e) {
    this.log("SQL exception in JNDIDatabase init", e);
    e.printStackTrace();
    The problem is no connection is obtained in init(). So what's wrong with my setting/code? Please help me to fix my setting/code.
    Thank you in advance.

    Follow what you said, no more NamingException. Thanks, Dave.
    now I receive another error.....
    2002-10-18 00:34:12 JNDIDatabase: SQL exception in JNDIDatabase init
    java.sql.SQLException: Cannot load JDBC driver class 'com.microsoft.jdbcx.sqlserver.SQLServerDataSource'
         at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
         at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:329)
         at hk.com.scope.servlet.jdbc.jndi.JNDIDatabase.init(JNDIDatabase.java:37)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:924)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:658)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2388)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
         at java.lang.Thread.run(Thread.java:536)
    I am sure msutil.jar, mssqlserver.jar and msbase.jar are stored in /WEB-INF/lib directory and using them in standard JDBC is OK!
    This is an extraction from MS JDBC help file.....
    The data source class for the SQL Server driver is:
    com.microsoft.jdbcx.sqlserver.SQLServerDataSource
    For information on SQL Server 2000 Driver for JDBC data sources, see "Connecting Through Data Sources".
    The driver class for the SQL Server driver is:
    com.microsoft.jdbc.sqlserver.SQLServerDriver
    com.microsoft.jdbc.sqlserver.SQLServerDriver is working properly, I am sure.

  • WAS 6.1 JNDI data source connection CRXI R2 Developer

    Hi all,
    I've been tasked to get a JNDI connection from a WAS 6.1 server to a Oracle DB to use in developing a report.
    The CR developer I'm using is CR Developer;Product Type: Full Product Version: 11.0.0.1282
    I have created a simple Java 'main' class to test the JNDI connection using the following jars:
    com.ibm.ws.admin.client_6.1.0.jar
    com.ibm.ws.runtime_6.1.0.jar
    com.ibm.ws.webservices.thinclient_6.1.0.jar
    ibmorb.jar
    ojdbc-14.jar
    rsadbutils.jar
    rsahelpers.jar
    I have been able to retrieve data from the Oracle DB through the 'main' class and display it on the console.
    However, after I set the CRConfig.xml file's classpath to use these jars, along with a jar I created that contains a jndi.properties file that contains the org.omg.CORBA.ORBClass=com.ibm.CORBA.iiop.ORB property because the JVM that the CR developer is pointing at is a Sun 1.6 HotSpot JVM.
    When I try getting the connection, Database -> Database Expert -> Create New Connection -> JDBC (JNDI), select the JNDI Connection option and enter the relevant information, the developer finds the JNDI names that I'm looking for. Then I 'Click' the Finish button and receive the following error pop-up:
    Logon Failed.
    Details: SQL Exception: SQL State: null ERROR Message: Invalid argument(s) in callDSRA0010E: SQL State= null, Error Code = 17,068 Database Vendor Code: 17068
    I have noticed that I can replicate this error message, through the 'main' class I used to test the connection, if I remove the username/password arguments from the method I use to get the DB connection.
    Is there anything that I'm missing to successfully use this WAS data source?
    I have tested a WebLogic 10.3 connection and the CR Developer had no problem finding/using the connection?
    Any help that can be provided would be greatly appreciated.
    Below is the JDBC tag from the CRConfig.xml file that I'm using:
    <JDBC>
         <CacheRowSetSize>100</CacheRowSetSize>
         <JDBCURL></JDBCURL>
         <JDBCClassName></JDBCClassName>
         <JDBCUserName></JDBCUserName>
         <JNDIURL>iiop://server:bootstrap_address-port</JNDIURL>
         <JNDIConnectionFactory>com.ibm.websphere.naming.WsnInitialContextFactory</JNDIConnectionFactory>
         <JNDIInitContext>cell/clusters/clusterName/jdbc</JNDIInitContext>
         <JNDIUserName>schema-username</JNDIUserName>
         <GenericJDBCDriver>
              <Option>No</Option>
              <DatabaseStructure>catalogs,tables</DatabaseStructure>
              <StoredProcType>Standard</StoredProcType>
              <LogonStyle>Oracle</LogonStyle>
         </GenericJDBCDriver>
    </JDBC>
    Thanks in Advance
    Edited by: java_geek on Jul 28, 2010 3:31 AM

    Hi all,
    I've been tasked to get a JNDI connection from a WAS 6.1 server to a Oracle DB to use in developing a report.
    The CR developer I'm using is CR Developer;Product Type: Full Product Version: 11.0.0.1282
    I have created a simple Java 'main' class to test the JNDI connection using the following jars:
    com.ibm.ws.admin.client_6.1.0.jar
    com.ibm.ws.runtime_6.1.0.jar
    com.ibm.ws.webservices.thinclient_6.1.0.jar
    ibmorb.jar
    ojdbc-14.jar
    rsadbutils.jar
    rsahelpers.jar
    I have been able to retrieve data from the Oracle DB through the 'main' class and display it on the console.
    However, after I set the CRConfig.xml file's classpath to use these jars, along with a jar I created that contains a jndi.properties file that contains the org.omg.CORBA.ORBClass=com.ibm.CORBA.iiop.ORB property because the JVM that the CR developer is pointing at is a Sun 1.6 HotSpot JVM.
    When I try getting the connection, Database -> Database Expert -> Create New Connection -> JDBC (JNDI), select the JNDI Connection option and enter the relevant information, the developer finds the JNDI names that I'm looking for. Then I 'Click' the Finish button and receive the following error pop-up:
    Logon Failed.
    Details: SQL Exception: SQL State: null ERROR Message: Invalid argument(s) in callDSRA0010E: SQL State= null, Error Code = 17,068 Database Vendor Code: 17068
    I have noticed that I can replicate this error message, through the 'main' class I used to test the connection, if I remove the username/password arguments from the method I use to get the DB connection.
    Is there anything that I'm missing to successfully use this WAS data source?
    I have tested a WebLogic 10.3 connection and the CR Developer had no problem finding/using the connection?
    Any help that can be provided would be greatly appreciated.
    Below is the JDBC tag from the CRConfig.xml file that I'm using:
    <JDBC>
         <CacheRowSetSize>100</CacheRowSetSize>
         <JDBCURL></JDBCURL>
         <JDBCClassName></JDBCClassName>
         <JDBCUserName></JDBCUserName>
         <JNDIURL>iiop://server:bootstrap_address-port</JNDIURL>
         <JNDIConnectionFactory>com.ibm.websphere.naming.WsnInitialContextFactory</JNDIConnectionFactory>
         <JNDIInitContext>cell/clusters/clusterName/jdbc</JNDIInitContext>
         <JNDIUserName>schema-username</JNDIUserName>
         <GenericJDBCDriver>
              <Option>No</Option>
              <DatabaseStructure>catalogs,tables</DatabaseStructure>
              <StoredProcType>Standard</StoredProcType>
              <LogonStyle>Oracle</LogonStyle>
         </GenericJDBCDriver>
    </JDBC>
    Thanks in Advance
    Edited by: java_geek on Jul 28, 2010 3:31 AM

  • Data Sources (Tomcat) - mysql

    I tried setting up a Data Source in Tomcat to use a mysql driver, but couldn't get it to work (my Servet wasn't able to find it using a context lookup). I got told by someone that Tomcat had a problem with Data Sources.
    So I placed the mm.mysql.jar file into Tomcat's /common/lib/ and am now using the drivers directly like this;
    ClassLoader cl = this.getClass().getClassLoader();
    Class.forName("org.gjt.mm.mysql.Driver", true, cl).newInstance();
    conn = DriverManager.getConnection("jdbc:mysql://xxx.xxx.no/dbname?user=xxx&password=xxxx");It works fine,
    but I'm wondering if this will cause problems for me later? What about connection pooling etc. that I had to specify when setting up the data source in Tomcat.

    PROGRESS !!
    Initial problem
    To set up a connection with DataSource by following
    JWSDP-1.0 tutorial on Servlet's
    I set up a connection with DriverManager by following
    http://www-106.ibm.com/developerworks/java/library/j-banner/?dwzone=java
    I set up a connection with DataSource by following
    -- TOMCAT 4.1.12 > DOCUMENTATION > JNDI DataSource Howto
    My guessing thought is that the root cause might be a mysql-configuration theme ..
    for example, to configure
    "javauser@localhost identified by 'javadude' "
    actually GIVES acces,but if you try
    c:>mysql -u javauser -pjavadude
    I get denied acces ..!?

  • Weblogic & JNDI Data Source with proxy user.

    We're trying to use Oracle proxy user authentication on a data source configured in WebLogic 10.3.6, however, we want to approach it in a programatic way. So we want to obtain the DataSource, and set the proxy related properties inside the application.
    We came up with the following snippet:
    Hashtable<String, Object> env = new Hashtable<String, Object>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.PROVIDER_URL, "t3://10.1.1.10:7003");
    env.put(Context.SECURITY_PRINCIPAL, "weblogic");
    env.put(Context.SECURITY_CREDENTIALS, "weblogic");
    Context context = new InitialContext(env);
    javax.sql.DataSource ds = (javax.sql.DataSource) context.lookup("ds_puser");
    OracleConnection oconn = (OracleConnection) ds.getConnection();
    The problem comes up when we try to cast the connection to OracleConnection, the thing is that the returned type is actually a 1036_WLStub.
    How can we avoid that type or cast to it to something useful? I found this reference on Oracle forums and he's being able to cast it directly:
    Re: My problem in using weblogic Datasource and proxy user
    Can someone help us out?
    Thanks a lot in advance!
    Edited by: 990800 on 27-feb-2013 13:26

    A DataSource is an Interface. What the code gets from the jndi tree is some concrete object that
    the code doesn't need to know the name of, or anything specific about it, as long as it implements
    the DataSource Interface, which it successfully casts to, to allow calling the methods defined in the
    DataSource Interface. If you call for a plumber, you don't need to know his name as long as you
    can get a plumber, and can call the "Fix this leak" method, defined in the Plumber Interface.

  • Problem  of  javafx2   remote  call  ejb3 and jndi data source

    netbean7.2 javafx2 glassfish3.1.2.2
    My javafx2 project through jndi remote access the ejb and data source,
    I select to run as an independent in netbeans ,without problems!
    However, When I select it to run as the web start. Or in the browser inside always error!
    Want a lot of ways it is not solved, especially to help!
    Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory
    at sun.plugin2.applet.Plugin2ClassLoader $ 2.run (Unknown Source)
    at java.security.AccessController.doPrivileged (Native Method)
    at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper (Unknown Source)
    at sun.plugin2.applet.JNLP2ClassLoader.findClass (Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0 (Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass (Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass (Unknown Source)
    at java.lang.ClassLoader.loadClass (ClassLoader.java: 356)
    at java.lang.Class.forName0 (Native Method)
    at java.lang.Class.forName (Class.java: 264)
    at com.sun.naming.internal.VersionHelper12.loadClass (VersionHelper12.java: 63)
    at javax.naming.spi.NamingManager.getInitialContext (NamingManager.java: 671)
    ... 47 more

    The program has been signed (unlimited access). This is jvm tracking information, What can I do?
    java.io.FileNotFoundException: \D:\eejj\JavaFXApplication18\dist\modules\jsr173_1.0_api.jar
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath.access$000(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$1.next(Unknown Source)
         at com.sun.deploy.security.DeployURLClassPath$1.hasMoreElements(Unknown Source)
         at java.net.URLClassLoader$3$1.run(Unknown Source)
         at java.net.URLClassLoader$3$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader$3.next(Unknown Source)
         at java.net.URLClassLoader$3.hasMoreElements(Unknown Source)
         at sun.misc.CompoundEnumeration.next(Unknown Source)
         at sun.misc.CompoundEnumeration.hasMoreElements(Unknown Source)
         at com.sun.naming.internal.VersionHelper12$InputStreamEnumeration$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.naming.internal.VersionHelper12$InputStreamEnumeration.getNextElement(Unknown Source)
         at com.sun.naming.internal.VersionHelper12$InputStreamEnumeration.hasMore(Unknown Source)
         at com.sun.naming.internal.ResourceManager.getApplicationResources(Unknown Source)
         at com.sun.naming.internal.ResourceManager.getInitialEnvironment(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
    java.io.FileNotFoundException: \D:\eejj\JavaFXApplication18\dist\lib\grizzly-websockets.jar
    java.io.FileNotFoundException: \D:\eejj\JavaFXApplication18\dist\lib\grizzly-http-ajp.jar
    eg.....(<font color=red > a lot of *.jar find nothing </font> )
    java.lang.RuntimeException: java.lang.ExceptionInInitializerError
         at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:251)
         at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
         at com.sun.glass.ui.View.notifyMouse(View.java:922)
         at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
         at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
         at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:67)
         at java.lang.Thread.run(Unknown Source)
    <font color=red >
    Caused by: java.lang.ExceptionInInitializerError
    </font>
         at com.sun.enterprise.module.single.SingleModulesRegistry.<init>(SingleModulesRegistry.java:79)
         at com.sun.enterprise.module.single.SingleModulesRegistry.<init>(SingleModulesRegistry.java:67)
         at com.sun.enterprise.module.single.StaticModulesRegistry.<init>(StaticModulesRegistry.java:66)
         at org.glassfish.internal.api.Globals.getStaticHabitat(Globals.java:84)
         at com.sun.enterprise.naming.impl.SerialInitContextFactory.<init>(SerialInitContextFactory.java:236)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at javafxapplication18.NewClass.v(NewClass.java:51)
         at javafxapplication18.JavaFXApplication18$1.handle(JavaFXApplication18.java:50)
         at javafxapplication18.JavaFXApplication18$1.handle(JavaFXApplication18.java:42)
         at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
         at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
         at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
         at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
         at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
         at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
         at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
         at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
         at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
         at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
         at javafx.event.Event.fireEvent(Event.java:171)
         at javafx.scene.Node.fireEvent(Node.java:6863)
         at javafx.scene.control.Button.fire(Button.java:179)
         at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
         at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
         at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
         at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
         at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
         at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
         at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
         at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
         at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
         at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
         at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
         at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
         at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
         at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
         at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
         at javafx.event.Event.fireEvent(Event.java:171)
         at javafx.scene.Scene$MouseHandler.process(Scene.java:3324)
         at javafx.scene.Scene$MouseHandler.process(Scene.java:3164)
         at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3119)
         at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1559)
         at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2261)
         at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:228)
         ... 6 more
    <font color=red>
    Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.class.path" "read")
    </font>
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at com.sun.enterprise.module.single.ProxyModuleDefinition.<clinit>(ProxyModuleDefinition.java:185)
         ... 59 more
    帖子经 user7993481编辑过
    帖子经 user7993481编辑过
    帖子经 user7993481编辑过
    帖子经 user7993481编辑过

  • JNDI Data Source Authentication

    Why doesn't the following work?
    public void getConnection(String dbuser, String dbpass) throws SQLException, NamingException {
    Context context = new InitialContext();
    DataSource ds = (DataSource)context.lookup(DATA_SOURCE_NAME);
    return ds.getConnection(dbuser,dbpass);
    It seems like this authenticates against the WebLogic security realm, and not the database (which is what the Java API specifies). Is this supposed to be the case? How can I work around this so that SQL calls are made in the dbuser's name and not the credentials I supplied for the Data Source?
    Message was edited by:
    bernerbits

    Derek Berner wrote:
    Why doesn't the following work?
    public void getConnection(String dbuser, String dbpass) throws SQLException, NamingException {
    Context context = new InitialContext();
    DataSource ds = (DataSource)context.lookup(DATA_SOURCE_NAME);
    return ds.getConnection(dbuser,dbpass);
    It seems like this authenticates against the WebLogic security realm, and not the database
    (which is what the Java API specifies). Is this supposed to be the case? How can I work
    around this so that SQL calls are made in the dbuser's name and not the credentials I supplied for the Data Source?
    Message was edited by:
    bernerbitsHi. This is running as designed. The DataSource to a WebLogic JDBC connection
    pool will be delivering one of the identically-made already existing connections
    in the pool. As such the typical call is the no-argument getConnection() call.
    We do implement weblogic security with the user/password form.
    If you want a JDBC connection with a named user/password, you should
    either have a pool with such ( and use the no-argument call) or you must
    make a non-pooled direct connection. Note that you can have as many pools
    as you want, each perhaps with only one connection, and you can dynamically
    create pools.
    For an upcoming release of WLS we will offer heterogenous (multiple DBMS
    user) pools.
    Joe

  • How to create new JNDI Data source in Tomcat 5.0 server

    hi ...
    I have created new datasource but its giving an error like
    ERROR: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: null
    Nested Exception: java.lang.NullPointerException
    please can anybody help me out to solve this bug ?
    regards
    djshivu

    This problem is due to your files server.xml and web.xml. Have you modified them???
    I ve the same problem, can you compare these files to mine (you can find my files here: http://forum.java.sun.com/thread.jspa?threadID=635640&tstart=0)

  • Jndi data source problem

    I am starting up using Jdeveloper with the integrated WebLogic server. I immediately ran into the problem described in this thread:
    http://forums.oracle.com/forums/message.jspa?messageID=3348590#3348590
    I followed the instructions for the workaround, but i can't make it work. I have a couple of questions:
    1. Step one of the workaround, <name>-jdbc.xml, is the <scope>Application tag the key change here? If yes, my file already had it.
    2. As far as i can see, the weblogic-application.xml file is created automatically when i deploy. How do i edit the file?
    3. Adding <property name="eclipselink.target-server" value="WebLogic_10"/> to persistence.xml, as suggested in the thread, causes deployment to fail with no specific error message.
    4. What's the deal with the ".../jdbc/jdbc..." vs ".../jdbc..." part of the setup? I assume it should be ".../jdbc/jdbc...", but why the mix-up in the documentation?
    5. Is there a fix available if i upgrade my Jdeveloper? Am i wasting my time on a workaround for an error that's been solved?
    Can someone please help me out here?

    I ended up using a workaround instead.

  • How to create JDBC data source w/o LDAP server

    I am trying to test using JDBC data source on a computer without a LDAP server. Is there an alterative JNDI solution? How about using file system or RMI registry JNDI service providers?

    Any J2EE container should be able to handle that. I use JNDI data sources with Tomcat 4.1.27. I'm sure any other J2EE app server (e.g., WebLogic, WebSphere, JBOSS, etc.) would be able to manage it, too. - MOD

  • Data source needs to be specified in context.xml instead of web.xml - why?

    Hi,
    I'm using a Spring JndiObjectFactoryBean to create my JNDI data source in my code:
    <bean id="jndiDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
              <property name="jndiName" value="java:comp/env/jdbc/DS_OURDB_DB2" />
              <property name="lookupOnStartup" value="false"/>
              <property name="proxyInterface" value="javax.sql.DataSource"/>
         </bean>I have the necessary Resource added to my Tomcat's server.xml:
    <Resource accessToUnderlyingConnectionAllowed="false"
                defaultAutoCommit="true" defaultReadOnly="false"
                driverClassName="com.ibm.db2.jcc.DB2Driver"
                factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
                initialSize="0" logAbandoned="false" maxActive="8"
                maxIdle="8" maxOpenPreparedStatements="0" maxWait="-1"
                minEvictableIdleTimeMillis="1800000" minIdle="0"
                name="jdbc/DS_OURDB_DB2" numTestsPerEvictionRun="3"
                password="ourpass" poolPreparedStatements="false"
                removeAbandoned="false" removeAbandonedTimeout="300"
                testOnBorrow="true" testOnReturn="false"
                testWhileIdle="false" timeBetweenEvictionRunsMillis="-1"
                type="javax.sql.DataSource"
                url="jdbc:db2://machine1:60056/DBD1" username="ouruser"
                   validationQuery="SELECT current date FROM sysibm.sysdummy1"/>I then have the resource referenced in my web.xml:
    <resource-ref>
              <res-ref-name>jdbc/DS_OURDB_DB2</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
              <res-sharing-scope>Shareable</res-sharing-scope>
         </resource-ref>However, I'm getting JndiLookupFailureExceptions when I attempt to use this JNDI resource.
    I can resolve it by specifying the following in my META-INF/context.xml:
    <Context>
         <ResourceLink global="jdbc/DS_OURDB_DB2" name="jdbc/DS_OURDB_DB2" type="javax.sql.Datasource"/>
    </Context>I've read some of the JNDI/Tomcat documentation. However, I still do not understand why it doesn't work with the web.xml. Can anyone explain please? Thanks

    Can answer this myself after some more investigation. The reason I required the entry in the META-INF/context.xml was because I had specified the Resource as a Global Reference in the server.xml. By adding this Resource to my application's Context in the server.xml the configuration in the web.xml worked as expected.

  • JNDI DataSource on Tomcat 4.1.27

    I am running Tomcat 4.1.27 with JVM 1.3.1_07-b02 on WinXP and I am trying to connect to an Oracle 9i database. I have a datasource setup and when I supply a username and password in the datasource everything connects fine. However, I need to be able to pass the username and password from my application to the datasource for authentication. Whenever I try DataSource.getConnection(username,password) I get an "java.lang.UnsupportedOperationException" exception. I also tried using the BasicDataSource.getConnection(username,password) method with the same results. Here is a bit of the stack trace:
    java.lang.UnsupportedOperationException
         at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:125)
         at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:329)
         at foo.Login.loginSuccess(Login.java:45)
    Can I get explicit instructions on what I need to do to be able to pass the username and password to the datasource? Is there another/better way to do this? Thanks.

    The problem is that the JNDI data source pool is set up when your app is loaded into Tomcat. You're giving it a username/password in the context.xml to set that up, then the pool is loaded with connections based on that startup password.
    I think it's failing because on subsequent calls you're giving it the individual's username/password, which are different from the one used to set up the connection pool.
    If you want to authenticate the users against the database without a separate table, I think you have to give up the advantage of having a connection pool and create a new connection for each user. It's a design choice: is it better for your app to have a separate username/password table and a connection pool or to use the Oracle authentication and have to create a connection each time? Your call. - MOD

Maybe you are looking for

  • Why iam unable to get the valu from combobox

    when i run this code everytime iam getting blank alert y iam unable to get the selected item from combo box thank u <%@ page import="java.util.Date"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"     pageEncoding="ISO-8859-1"%

  • Applet colors for Mac and Linux?!

    I've got an applet where I use Color(int, int, int) to set background colors of components. Running the applet on Windows in Netscape or Explorer gives the expected colors. But in Mac and Linux the backgrounds are only white (using Netscape or Explor

  • Tree Grid Control

    to show hierarchical list data we want to use a tree grid control like RadControl from Telerik (which is to slow for our needs) after looking for alternatives we found something like ezzylearning-asp-net-gridview-control. Ok, but we need collapse and

  • XDOLoader download

    I used below XdoLoader to download rtf file. Script ran successfully, but rtf file was not download. I ran this in unix home directory. Please advice. java oracle.apps.xdo.oa.util.XDOLoader DOWNLOAD -DB_USERNAME apps -DB_PASSWORD welcome -JDBC_CONNEC

  • When will sub-folders be allowed in the assets folder?

    I think it is critical that sub-folders be allowed in the assets folder. Until then it will be very difficult to organize the content of larger websites. The lack of this feature automatically eliminates Muse from consideration in the development of