BC4J and J2EE Patterns (JNDI Datasource)

Hallo Everybody,
My Application reads from connections.xml the jdbc connection settings,
in order to connect to the oracle database.
I don't like the fact that I have to force my Customer to edit this File by Hand for the JDBC Settings.
I would like to use a "JNDI Datasource Name" for example jdbc/MyDatabase that will evaluated
from the Applicationserver (not from bc4j interal JNDI!!!!)
In this case, the Customer can define the jdbc Connection Settings in his Applicationserver
by creating a "Resource-Reference" for a javax.sqlDataSource with the name "jdbc/MyDatabase" .
( This is also Possible in Tomcat. )
This is the usual way to configure jdbc Connections in a managed Enviroment.
How can I say to the Applicaton Module "please obtain your jdbc-connections over the datasource java/MyDataBase" ???
Is this in bc4j Framework possible ? ( note: I'm new to bc4j but not to j2ee )
Thank for any Hint,
regarts,
Manolis
(sorry for my bad english, learned it through compiler error messages ;-) )

See
Re: What software do I need to get started with GIS development

Similar Messages

  • BC4J and JNDI DataSource Configuration

    Hi,
    I need help in making the BC4J use a DataSource for creating connections. Could you anyone tell me step by step instructions to do it?
    I have created a Database Connection using JDBC for creating a BC4J App Module, View Objects etc.
    Then I created a Business Component Package by using the wizard. Everything worked fine till now. But I was to use a connection pool that is created in my App Server which happens to be a WebLogic 7.0 App Server. I have created a JDBCConnection pool and a JDBCDataSource in the App Server. The configuration for it is as follows in the weblogic configuration file.
    <JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
    MaxCapacity="5" Name="OracleConnectionPool"
    Password="{3DES}n51DlVgPmmQ="
    Properties="user=empac;dll=ocijdbc9;protocol=oci"
    Targets="myserver" URL="jdbc:oracle:oci:@DB921C"/>
    <JDBCDataSource JNDIName="OCIDataSource" Name="OCIDataSource"
    PoolName="OracleConnectionPool" Targets="myserver"/>
    I wanted to edit the "Configurations" to specify the JDBC DataSource. When I saved the configuration for the App Module this is how my bc4j.xcfg looks.
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <BC4JConfig>
    <AppModuleConfigBag>
    <AppModuleConfig name="BuyerModuleLocal">
    <java.naming.security.principal>system</java.naming.security.principal>
    <DeployPlatform>LOCAL</DeployPlatform>
    <jbo.TypeMapEntries>Java</jbo.TypeMapEntries>
    <JDBCDataSource>OCIDataSource</JDBCDataSource>
    <jbo.project>BC4JTry</jbo.project>
    <AppModuleJndiName>com.explore.bc4j.BuyerModule</AppModuleJndiName>
    <ApplicationName>com.explore.bc4j.BuyerModule</ApplicationName>
    <java.naming.security.credentials>security</java.naming.security.credentials>
    </AppModuleConfig>
    </AppModuleConfigBag>
    <ConnectionDefinition name="DB921C">
    <ENTRY name="JDBC_PORT" value="1521"/>
    <ENTRY name="ConnectionType" value="JDBC"/>
    <ENTRY name="HOSTNAME" value="joshua"/>
    <ENTRY name="user" value="empac"/>
    <ENTRY name="ConnectionName" value="DB921C"/>
    <ENTRY name="SID" value="DB921C"/>
    <ENTRY name="JdbcDriver" value="oracle.jdbc.driver.OracleDriver"/>
    <ENTRY name="password" value="empac"/>
    <ENTRY name="ORACLE_JDBC_TYPE" value="thin"/>
    <ENTRY name="DeployPassword" value="true"/>
    </ConnectionDefinition>
    </BC4JConfig>
    When I tried to run a testClient which uses the App Module it is failing giving me an exception saying could not lookup for the DataSource. In one of the detailed error messages, I got this error.
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    I checked the "Configurations" window and it was having
    "oracle.jbo.common.JboInitialContextFactory" for the property "java.naming.factory.initial".
    Could anyone tell me how to solve this issue. I did read the BC4J & JNDI Datasource configuration thread in the same forum and unfortunately that did not help.
    Krish

    What does you test client code look like and can you give us the complete stack trace.
    Dhiraj

  • Connecting locally with BC4J and JDBC DataSource

    I have a BC4J project/module which I'm using as the data access layer for a web application, and that is deployed in 'local' mode on the OC4J server. In the config for the BC4J Module, I'm using the 'JDBC DataSource' connection type. When I deploy to OC4J, the appropriate entries are made in data-sources.xml and things run fine.
    W/in JDev, however, I'd like to be able to use the BC4J Tester and/or some local java classes (ie, run with a main method, outside the context of OC4J) to do some testing as I develop, including accessing the DB via my BC4J module, with the JDBC DataSource connection type. Currently, in order to run outside of the context of OC4J, I need to modify my config to use a connection type of 'JDBC URL' in order to successfully connect via the tester or via a main method driven class. (But then must be sure to change it back to 'JDBC DataSource' prior to redeploying.) If don't do this, and instead try to use the DataSource connection type, I get the errors "oracle.jbo.JboException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/ADD_OWNER_DEV2DS" and "javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial" (among others)
    It seems pretty clear that I need to somehow/somewhere specify the context factory or such when running in JDev vs under OC4J, or somehow point the IDE to the local OC4J instance as the source of the info, etc?
    When trying to connect from the development environment, I have a local OC4J instance up and running, and I have what I think is an appropriate entry in data-sources.xml (I've tried this in 4 locations - j2ee\home\config, multi\system\oc4j-config, system9.0.3.1035\oc4j-config and as a new Data Sources Descriptor in the project.)
    Is there a way to set things up such that I can use the 'JDBC DataSource' connection type regardless of whether I'm running inside or outside of OC4J?
    Thanks,
    Jim

    Jim,
    You need some jndi implementation to bind(define) the datasource that can be looked up at runtime. Unfortunately, currently the only jndi implementation available in which you can bind datasources comes from oc4j. So you have to run in oc4j for using the datasource as your connection type.
    Dhiraj

  • DAO pattern & Lookup datasource with NamingException in the same J2EE APP

    Hello Experts:
    I'm developing an J2EE application with EJB's for transactional operations (that works fine!) and I'm implementing the J2EE DAO Pattern using a DAO ConnectionFactory with OpenSQL/JDBC standard for Querying the DB, but here my problems begins:
    The DAOConnectionFactory Singleton Class is placed in a java package inside the same application that holds my Entitys & Sessions (remember this ejb's works fine!) and I'm trying to get the "localy-configured-in-the-j2ee-application" alias-datasource for my DAO Querys, but "lookup" doesn't find this resource!!!.
    I'm thinking, there's not remote access to this resouce because the DAO-CF is in the same context and JVM, but this appreciation is correct? or  what I miss?
    Another remark: I've been used the Telnet Administrator and the same lookup string is founded correctly!.
    Here is the Codec:
    public class ConexionFactory implements Serializable {
         private static ConexionFactory singleton = null;
         private DataSource ds;
         protected ConexionFactory() {
              String source = "jdbc/BURO_COMM";
              try {
                   Context ctx = new InitialContext();
                   ds = (DataSource) ctx.lookup(source);
                   if (null == ds) {
                        throw new RuntimeException("Couldn't get the datasource");
              } catch (NameNotFoundException e) {
                   throw new RuntimeException(e.getMessage());
              } catch (NamingException e) {
                   throw new RuntimeException(e.getMessage());
         public static ConexionFactory getInstance() {
              if (null == singleton) {
                   singleton = new ConexionFactory();
              return singleton;
    .... (some other methods)

    Hello all again:
    I've been making some tests (and investigation reading other posts) and I found that everything is related with the Resource Sharing Scope of my Session Object that commands the process. And it works fine.
    By now, for my conceptual test is Ok and finally i must work in this app arquitecure path:
    ->Web Service (with a POJO in a web module)
    >ProcessRender Class (a POJO with the main control logic)
    >BussinesDelegate's -->ServiceLocator
    >SessionFacades --->Entity's
    >DAO Connection Factory---->OpenSQL/JDBC Querys

  • How does J2EE SDK provide JNDI DataSource ?

    Still new to J2EE and working my way thorugh Wrox press "professional java server programming". Im using the deploy tool and im wondering how does J2EE provide JNDI names for a DataSource ? Im somewhat familiar with JNDI and I thought you had to use a directory service such as OpenLDAP to use JNDI.
    my questions then are:
    (1) What kinds of things can you do with JNDI without using a directory service ?
    (2) How does the J2EE SDK physically store references to a DataSource without using a directory service. In otherwords, how does the J2EE server provide for using JNDI names for a DataSource and is this a typical feature of J2EE containers ?

    i wish someone would answer this. i curious myself about these exact same things.

  • Please Help With TopLink and JNDI datasource

    Hello
    I have been trying to figure this out for a while now and I am stuck. I have a simple J2EE project that uses toplink to access 1 table with 2 coulumns (JDev 10.1.3).
    I setup a sessions.xml and in there set my data Source Location to be my JNDI datasource.
    In my tlMap1 file I am required to put a Deployment Connection and no matter what I do it uses that connection. Is there some way I can make it use the JNDI connection that I specified in sessions.xml instead?
    i turned on debugging and it gives the following:
    [TopLink Config]: 2006.06.02 10:21:06.140--ServerSession(1216)--Connection(1242)--Thread(Thread[RMICallHandler-0,5,RequestThreadGroup])--connecting(DatabaseLogin(
         platform=>Oracle10Platform
         user name=> "access_tst_d"
         connector=>JNDIConnector datasource name=>jdbc/accessEJB
    [TopLink Config]: 2006.06.02 10:21:06.328--ServerSession(1216)--Connection(1244)--Thread(Thread[RMICallHandler-0,5,RequestThreadGroup])--Connected: jdbc:oracle:thin:@access-web-test.admin.uni.edu:1525:WEBT
         User: ACCESS_TST_D
         Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - 64bit Production
    With the Partitioning and Data Mining options
         Driver: Oracle JDBC driver Version: 10.1.0.5.0
    [TopLink Info]: 2006.06.02 10:21:06.343--ServerSession(1216)--Thread(Thread[RMICallHandler-0,5,RequestThreadGroup])--default login successful
    [TopLink Finer]: 2006.06.02 10:21:06.343--ServerSession(1216)--Thread(Thread[RMICallHandler-0,5,RequestThreadGroup])--client acquired
    [TopLink Finest]: 2006.06.02 10:21:06.343--ClientSession(1246)--Thread(Thread[RMICallHandler-0,5,RequestThreadGroup])--Execute query ReadAllQuery(pl.model.PlLoginPrefixes)
    [TopLink Fine]: 2006.06.02 10:21:06.375--ServerSession(1216)--Connection(1229)--Thread(Thread[RMICallHandler-0,5,RequestThreadGroup])--SELECT LOGIN_PREFIX_ID, PREFIX FROM PL_LOGIN_PREFIXES
    [TopLink Finer]: 2006.06.02 10:21:06.953--ClientSession(1246)--Thread(Thread[RMICallHandler-0,5,RequestThreadGroup])--client released
    It looks like it sees the JNDI connection but it uses the "user name" parameter from tlMap1 instead. I am really getting desparate and any help would be greatly appreciated.
    Thanks
    troy

    Sorry to be such a pest about this but I have a bit more info now. If I go in to my tlMap file and select <none selected> for my deployment connection, the compiler gives me warnings and the mapping status report gives an error but it uses the jndi source from session.xml.
    Does anyone know of a way to do this (use the jndi datasource) without these compiler warnings? I just have this feeling I am doing something wrong, something that should be simple but nevertheless is turning out to be nearly impossible for me to figure out.
    thanks
    troy

  • Need Help in JNDI Datasource using tomcat and spring

    Hi,
    I am trying to connect my local database using JNDI datasource in tomcat and spring
    I have done the below configuration in Tomcat 7 server:
    In tomcat server.xml (Path: E:\apache-tomcat-7.0.35\conf) I added the below configuration
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
    <Resource name="jdbc/myApp" auth="Container"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:oracle:thin:hr@localhost:1521:XE>"
    username="testUser" password="password"
    maxActive="10" maxIdle="5"
    maxWait="60000" removeAbandoned="true"
    removeAbandonedTimeout="60" logAbandoned="true"/>
    In web.xml, I have added the below config:
    <resource-ref>
    <description>Oracle Spring JNDI Datasource</description>
    <res-ref-name>jdbc/myApp</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    And in my Spring context xml (ws-context.xml), added below config:
    <bean name="myDataSourceInJndi" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/jdbc/myApp"/>
    </bean>
    <jee:jndi-lookup id="dataSource" jndi-name="/jdbc/myApp" resource-ref="true"/>
    In my Java code, I am trying the below code to connect DataBase:
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    DataSource ds = (DataSource) envCtx.lookup("jdbc/myApp");
    ds.getConnection();
    But I am getting the below exception while executing ****ds.getConnection();***
    java.lang.IllegalStateException: Connection factory returned null from createConnection
    at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:584)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at com.wipro.spring.impl.EmployeeImpl.getDetails(EmployeeImpl.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
    at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
    at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.doPost(WSSpringServlet.java:52)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Can you please me to resolve this issue? Am I missing any configuration or any mistake in my java code please suggest your suggestions.
    Thanks

    Hi,
    I am trying to connect my local database using JNDI datasource in tomcat and spring
    I have done the below configuration in Tomcat 7 server:
    In tomcat server.xml (Path: E:\apache-tomcat-7.0.35\conf) I added the below configuration
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
    <Resource name="jdbc/myApp" auth="Container"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:oracle:thin:hr@localhost:1521:XE>"
    username="testUser" password="password"
    maxActive="10" maxIdle="5"
    maxWait="60000" removeAbandoned="true"
    removeAbandonedTimeout="60" logAbandoned="true"/>
    In web.xml, I have added the below config:
    <resource-ref>
    <description>Oracle Spring JNDI Datasource</description>
    <res-ref-name>jdbc/myApp</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    And in my Spring context xml (ws-context.xml), added below config:
    <bean name="myDataSourceInJndi" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/jdbc/myApp"/>
    </bean>
    <jee:jndi-lookup id="dataSource" jndi-name="/jdbc/myApp" resource-ref="true"/>
    In my Java code, I am trying the below code to connect DataBase:
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    DataSource ds = (DataSource) envCtx.lookup("jdbc/myApp");
    ds.getConnection();
    But I am getting the below exception while executing ****ds.getConnection();***
    java.lang.IllegalStateException: Connection factory returned null from createConnection
    at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:584)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at com.wipro.spring.impl.EmployeeImpl.getDetails(EmployeeImpl.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
    at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
    at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.doPost(WSSpringServlet.java:52)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Can you please me to resolve this issue? Am I missing any configuration or any mistake in my java code please suggest your suggestions.
    Thanks

  • JNLP and Tomcat JNDI DataSource

    Software
    JDK 1.5 Update 6
    Tomcat 5.5.4
    Requirements
    I have a Client Side requirement and this project is going to be deployed to 5 users initially all in a lan but there are very chances of adding more users simultaneously.
    I am thinking of deploying in JNLP Environment.
    At present the Swing application though in development phase is running a little slow and therefore I required the way by which I could store the references of the Object in some server.Getting Connection Object is also a major time consumer and so I needed some way by which I can use the Tomcat DataSource and use the JNDI facility to store certain intermediate values in the server.
    Can I use the JNDI in the JNLP Application.
    Please provide me the way by which I can do this stuff
    Thanks in advance
    CSJakharia

    .> I am using tomcat 5.5.9 and oracle 9i. I am hosting a
    portal which uses connection pooling.
    I have decided to use the connection pooling through
    tomcat's JNDI naming lookup.Excellent idea.
    for this i have used the following steps --
    1) made entry of <resource-ref> in webapp's web.xml
    2) made relevant and corresponding entry in tomcat's
    ${TOMCAT_HOME}/conf/context.xml (for JNDI
    JDBC-datasource)No, don't do it that way.
    .> my problems are--
    1) making the entry for context.xml in tomcats
    conf folder makes the application war dependent
    on web server which i dont want to make.Yes, it does.
    2) i have to put classes12.jar in tomcats
    ${TOMCAT_HOME}/common/lib folder and only then the
    application connection pooling works else the
    exception coming on tomcat console is --
    org.apache.tomcat.dbcp.dbcp.SQLNestedException.
    Why aren't you using the latest JDBC driver from Oracle? That's in ojdbc14.jar.
    .> I dont want to put classes12.jar in web server i want
    the web server's JNDI lookup to pick the driver frm
    my webapps' internal lib folder. please help me on
    these very pressing and immediate issues. all the
    help coming from anyone in this regard is very much
    welcome.
    thanks in advance!
    VaivYour instinct is correct.
    (1) Put ojdbc14.jar in WEB-INF/lib of your WAR file.
    (2) Edit the <Context> XML into a file named context.xml and put it in META-INF of your WAR. Tomcat should pick up the context information for the JNDI data source from that.
    Everything is in the WAR, and you don't have any dependence on the server that way.
    %

  • CF8 with JBoss JNDI datasource

    After installing and configuring a CF8 for J2EE running on
    JBoss 4.2.2.GA with Java 6, I have created a JNDI datasource for
    Oracle 10g in the oracle-ds.xml file. I have configured a CF8
    datasource that uses the JNDI resource.
    Any query that is NOT using cfqueryparam works quite well.
    As soon as cfqueryparam is used, I get an "Error casting an
    object of type org.jboss.resource.adapter.jdbc.WrappedConnection
    cannot be cast to coldfusion.server.j2ee.sql.JRunConnectionHandle
    to an incompatible type.".
    The configuration and the exception is pretty much the same
    as described in
    Problem
    description.
    This is clearly a CF8 bug and I was wondering if there is any
    known workaround for it.

    In web.xml making the following entry:
    <web-app>
    <description>MySQL Test App</description>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    Next, add a file jboss-web.xml under WEB-INF/ folder of the web-application. This file should contain entry as:
    <jboss-web>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <jndi-name>java:/jdbc/test</jndi-name>
    <res-auth>Container</res-auth>
    </resource-ref>
    </jboss-web>
    Next, in JBOSS_HOME/server/default/deploy folder make a xx-ds.xml file or else, a similiar file can be found in that same folder with the name hsqldb-ds.xml. Make following entries in that xml file:
    <datasources>
    <local-tx-datasource>
    <jndi-name>/jdbc/test</jndi-name>
    <type-mapping>MySQL</type-mapping>
    <connection-url>jdbc:mysql://localhost:3306/shopping_cart</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>root</user-name>
    <password>root123</password>
    <min-pool-size>1</min-pool-size>
    <max-pool-size>5</max-pool-size>
    </local-tx-datasource>
    This should bind the jndi name.
    In our client application, we need to look up as:
    Context ctx = new InitialContext();
    DataSource ds = (DataSource)ctx.lookup("java:/jdbc/test");
    Connection conn = ds.getConnection();
    This works perfectly.

  • How to use jndi datasource on Weblogic instead of adding a DB data source

    Hi All,
    version: 11.1.1.4
    I am trying to figure out how in my ADF applications I can use an existing jndi datasource out on our weblogic servers instead of having to bury the Database db source in my adf applications. Like SOA I would like to reference the DB directly during design so I can pull in entities and build view objects, but when I deploy I want it to reference the jndi datasource out on the weblogic server.
    Is this possible? If so I am not sure how to configure it like I would a DB adapter in SOA.
    As always appreciate the info.
    Thanks,
    S

    If you use ADF in the model layer (application modules) you can configure them to use JNDI Datasources. Just right click on the application module and select 'Configurations...'. In the next dialog you see all the configurations currently available (one named xxxxxlocal and one named xxxxxshared at least). Select the local and hit the edit button. This open the DB connect dialog where you can change the connection from JDBC URL to JDBC Datasource (JNDI). Save your work and when you now start the app it will use the JNDI name.
    Timo

  • How to use JNDI datasource instead of database connection settings JDev 10g

    Hi,
    In order to use the different database from other environments, we are not able to use the JNDI datasource configuration settings, all the time need to configure the database connection settings from JDeveloper by changing the database connectivity settings in the JDeveloper for each environment separately, need a solution on how to make the database connectivity unique using the JNDI datasource name for all the environments for database connectivity settings through the application server console rather than changing the database adapter configuration in JDeveloper.
    Please provide the update at the earliest. Your help is greatly appreciated. Thanks in advance..

    What are you not clear on?
    What you need to do is get your developers to conform to a database naming standard, as stated above, so if you have an oracle database that is for eBusiness Suite you get all developers to create a DB connection in JDev called, ora_esb as an example.
    When the developer creates a DB adapter this will create a JNDI name of eis/DB/ora_ebs. When the BPEL project is deployed it looks for the JNDI name in the oc4j-ra.xml file to see its connection details. If they don't exist then they use the developers connection details. The issue with this is that they generally always point to the development DB. It is best practice for the developers to remove the mcf settings in the DB adapter WSDL. This way if the JNDI name has not been configured it will fail.
    So when you migrate from dev-test-prod what you have is the JNDI name eis/DB/ora_ebs. The dev points to the dev instance of ebs, test points to the test instance and so on. This means that you don't need to adjust any code in the BPEL projects.
    cheers
    James

  • 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

  • Welcome to this forum on "Core J2EE Patterns" by the Sun Java Center

    Welcome to this forum on Core J2EE Patterns by the Sun Java Center!
    CONTEXT:
    This forum is intended for discussing the patterns from the Sun Java Center J2EE Pattern Catalog and other topics discussed in our book, Core J2EE Patterns.
    We, the authors of the book, welcome you to this forum.
    WHO WE ARE:
    We are Enterprise Java Architects from the Sun Java Center (SJC), which is the Java consulting organization of Sun Microsystems. We are a world-wide group of architects focusing on all consulting related to Java technologies.
    Visit our web-site for more information on SJC:
    http://www.sun.com/service/sunps/jdc/index.html
    BACKGROUND:
    Over the last few years, we at SJC have worked with our customers in architecting, designing, and implementing solutions on the J2EE platform. We have worked on documenting the J2EE patterns for over two years and released the patterns for public review in Beta form via the Java Developer Connection in May, 2001.
    The beta version of the patterns is available online as The Sun Java Center J2EE Pattern Catalog at:
    http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
    Subsequent to the release, we received great feedback and comments from hundreds of reviewers. We then worked towards incorporating the feedback into the pattern documentation. One of the common comments was about the lack of code examples in the online documentation. The latest pattern documentation provides many code examples and incorporates all the feedback received so far.
    BOOK INFORMATION:
    Core J2EE Patterns, the book, was released at JavaOne 2001 during June 4-9, and will be available in stores around the end of June 2001.
    The book includes the complete updated Sun Java Center J2EE Pattern Catalog with 15 patterns covering these J2EE technologies: Java Server Pages (JSP), Servlets, Enterprise JavaBeans (EJB), and Java Message Service (JMS). In addition to the J2EE Pattern Catalog, the book also provides other chapters that discuss design considerations,
    bad practices, and J2EE Refactorings. Example code is included for all patterns and strategies.
    If you wish to view the complete table of contents or order the book, please visit one of the following online bookstores:
    Fatbrain.com: http://www1.fatbrain.com/asp/bookinfo/bookinfo.asp?theisbn=0130648841
    Amazon.com: http://www.amazon.com/exec/obidos/ASIN/0130648841
    COMMUNITY:
    The online community for discussing the patterns included in our book Core J2EE Patterns has grown over the past year, since our first presentation at JavaOne 2000. This community is supported by our LISTSERV and is available for public participation at:
    http://archives.java.sun.com/j2eepatterns-interest.html
    You can view the past discussions on this list at the above URL.
    FORUM LOGISTICS:
    John and Dan are on the east coast and Deepak is on the west coast. We will be tuned into the forum and answering the messages periodically between June 19 and June 25, 2001. If you want to discuss the J2EE Patterns after June 25, you are invited to join the aforementioned J2EE Patterns Interest list.
    FORUM DISCLAIMER:
    All responses to questions posed in this News Group are given on an "as is" basis. We believe the solutions or explanations given here are correct, but do not guarantee that responses will be complete, without error and/or work for all platforms and system configurations.
    The forum is now open! Let the discussion begin...
    John Crupi - Chief Java Architect
    Dan Malks - Enterprise Java Architect
    Deepak Alur - Enterprise Java Architect
    ---Authors of Core J2EE Patterns

    Rajakannan,
    There are numerous ways to implement a templating mechanism in support of the composite view pattern, included in the catalog as a presentation-tier pattern.
    The goal is to avoid simply having monolithic views with all the formatting code embedded directly withing the view. If we have common subviews that are shared across several or more views then we end up with a copy-and-paste type of reuse...undesirable. So, modularity is one issue. Another major force when considering the Composite View pattern is that we may want to manage the layout of our pages and the content of our pages separately. We may have some logical regions defined, such as a search panel and main body, and a subview that plugs into those logical regions that map to a physical page (ie: x.jsp and y.jsp). We may then want to vary one independent of the other...ie: we may want to modify the layout of the page w/o changing the content and we may want to vary the content w/o touching the layout.
    There are a number of implementation strategies that can be used to implement the Composite View pattern, ranging from relatively simple to much more sophisticated. We describe each in our book and include source code examples.
    The example in the book that allows for supporting all the issues described above is implemented using the "Custom Tag View Management Strategy" and uses a tag library written by David Geary, that supports the Composite View pattern. The library is also included in David's new book, Adv. JavaServer Pages, Prentice Hall, 2001.
    Again, it's simply one implementation and, as you mention, there are many different ways to implement this strategy.
    Thanks for your question,
    Dan

  • How to design using J2EE pattern?

    I am new to J2EE and I would like some ideas on how I should design the following system in J2EE pattern. I am required to use JSP pages + EJB to implement a very simple online shopping system. And I already created the following classes:
    This is the EJB object interface.
    package assignment;
    import java.rmi.*;
    import javax.ejb.*;
    import java.util.Vector;
    public interface ShoppingSystem extends EJBObject {
         public boolean LoginAsCust(String id,String pwd) throws RemoteException;
         public boolean LoginAsAdmin(String id,String pwd) throws RemoteException;
         public Vector getMusicCategories() throws RemoteException;
         public Vector getCategoryItems(String category) throws RemoteException;
         public MusicRecording getMusicRecording(String id) throws RemoteException;
    }This is the home interface.
    package assignment;
    import java.rmi.*;
    import javax.ejb.*;
    public interface ShoppingSystemHome extends EJBHome {
         public ShoppingSystemHome create() throws RemoteException, CreateException;
    }This is the session bean objects.
    package assignment;
    import java.rmi.*;
    import javax.ejb.*;
    import java.util.Vector;
    public class ShoppingSystemBean implements SessionBean {
         // data item to hold a reference to a passed Session context
         private SessionContext ctx;
         // save the session context
         public void setSessionContext(SessionContext x) { ctx = x;}
         // the various method implementations
         // imposed on us by interface
         public void ejbCreate() {}
         public void ejbActivate() {}
         public void ejbPassivate() {}
         public void ejbRemove() {}
         public boolean LoginAsCust(String id,String pwd) throws RemoteException{
         public boolean LoginAsAdmin(String id,String pwd) throws RemoteException{
         public Vector getMusicCategories() throws RemoteException{
         public Vector getCategoryItems(String category) throws RemoteException{
    public MusicRecording getMusicRecording(String id) throws RemoteException{
    }I will probably need to create a shopping cart class and a database accessor class. What I would like to know is , do I need to divide the shopping cart class into three components: Home interface, EJB object interface, SessionBean object.
    Please give me some ideas on how I can develop this system using EJB. (This is just a school assignment)
    Thanks.

    know is , do I need to divide the shopping cart class
    into three components: Home interface, EJB object
    interface, SessionBean object.Shopping cart is a typical example of a stateful session bean. So you need to write a session bean. And, of course, every session bean consists of three things: remote interface, home interface and bean class.
    Please give me some ideas on how I can develop this
    system using EJB. (This is just a school assignment)In this case you can tell them to fuk off.

  • Core J2EE Patterns - ActionMap XML

    I am reading through Core J2EE Patterns and I'm confused about a coupel fo thing and hoping someone can shed some light for me.
    1. I'm confused on how to actually implement the Map, refered to on page 208, which hold references to handles that represent target resoruces.
    2. In the example micro-architecture in chapter, page 603, references an XML file called HireEmployeeActionMap.xml. I believe this to be the action mapping file, but it's not clear how it is used. More imortant, the class in example 9.4 simply has a coment that I should "Get real commandstring from mapfile usign Action", while being helpful that it is included, is not so helpful if you don't actually know how to go about reading this XML file.
    More to the point, here is my task:
    I have a servlet (existing code from someone else) that I am going to refactor and make more expandable by implementing some of the J2EE patterns I've been reading about. My understanding of the patterns is varied, of course.
    This servlet does one basic thing. It accepts an HTTP transaction from an app that sends it request parameters (liek a form) to perform a specific transaction, of which there are about 12. Each transaction requests a different task to be peformed, of course. Speifically, data lookups in a various enterprise system or placing requests into various system queuss and such.
    Right now this sevlet has a huge if/else block checking for each transaction ID sent in the parameters and then calls a method to handle that transaction (calling delegates, facades, and services in the down path).
    I'd like to refactor this so that I have an CommandMapper that uses an CommandMap to map out each transaction ID to an Command class specific to that transaction. This way, I can write the application controller once and then when new transactions are needed, I simply add the new comand to the CommandMap XML file and add the new Command class (and delegates, facades, ejbs, etc.) and I'm done. No regression testing on the other transactions because there was no core code modified.
    So I went looking for exmaples of how to implement CommandFactory and CommandMap and I'm stumped. I also can't find any good examples of reading an XML file for this purpose. Any help would be greatyl appreciated.

    One more thought: my questions above have nothing to do with the classes and interfaces found in javax.activation. I'm going from the book mentioned above.

Maybe you are looking for

  • I lost my iPod touch and now have a new one.  Is there a way to transfer all the songs on have in iTunes onto the new iPod?

    I lost my iPod touch and bought a new one?  Is there a way to transfer all the songs I have in iTunes onto the new iPod?  I am scared I will lose it all when I sync the new one or that I have to start all over.   Please help!!

  • Error while loading the data

    Hi, We are trying to copy data from one cube to another(it's exact copy). There are more than 11 million records so we have used calendar month as filter and divided the data in to many parts. While loading the first request to the target cube, it fa

  • In service date

    Where can I find the in service date for the different version of Oracle products?

  • AFL Live Pass voucher code

    AFL.com.au has rewarded me with an AFL live voucher code that grants me with a free subscription for the remainder of the year for completing an online survey. Problem is I can not seem to get afl live to recognise the subscription. I am super happy

  • Printing Calendar from desktop

    When I try to print from desktop, it tries to say to print hundreds of pages for one month.  I hit cancel when it got to the thousands. Help!! Post relates to: Palm Z22