DBAdapter Using JNDI Configuration

Hi,
I have created a simple process with DBAdapter. (using a simple select from oracle 10g, calling one of the schema - not apps)
When I ran this process on client it ran with no problem.
When I ran it from the linux server it gave me a lot of exceptions, like:
07/11/13 18:36:29 0 - ORABPEL-00000
Exception not handled by the Collaxa Cube system
Exception: java.lang.NullPointerException
Handled As: com.collaxa.cube.CubeException
] -> [java.lang.NullPointerException: null]
ORABPEL-00000
Exception not handled by the Collaxa Cube system.
07/11/13 18:36:29 1 - java.lang.NullPointerException
<2007-11-13 18:36:29,575> <ERROR> <psnext_integration.collaxa.cube> <BaseCubeSessionBean::logError> Error while invoking bean "cube delivery": [com.collaxa.cube.CubeException: Exception not handled by the Collaxa Cube system.
<DispatchHelper::handleMessage> failed to handle message
ORABPEL-00000
<2007-11-13 18:36:29,618> <ERROR> Failed to handle dispatch message ... exception ORABPEL-05002.
I'm using soa suite 10.1.3.3 (Client and server).
I had no problem with this on another server (with same installation - another customer)
I think the process is looking for the JNDI definition and is not using the connection details from DB.wsdl in the process.
I tried to define the JNDI connection (data-sources.xml, connectors, oc4j-ra) with no success (tried from EM and manualy also).
Does anyone knows where in the server we define if we want to use JNDI or not.
And if so, what are the correct steps to define it.
Thanks
Arik                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

The jist of it is:
- define the jndi entry in $ORACLE_HOME/j2ee/<instance name>/application-deployments/default/DbAdapter/oc4j-ra.xml
- the above entry refers to a data-source entry in $ORACLE_HOME/j2ee/<instance name>/config/data-sources.xml (default instance name is "home")
As long as the above are set, it should work. Look at the example pre-seeded entry to avoid confusion with XA vs non-XA settings in the above entries.
To just get the service working without having to worry about the above configuration, make sure that the jndi entry (i.e eis/DB/...) referred to in the adapter service wsdl does not appear in the above oc4j-ra.xml; then the adapter uses the connection info specified in the wsdl directly. To confirm that it is working the way you want it regardless of which of the above routes you take, enable DEBUG level logging for *.ws logger, and take a look at the log file $ORACLE_HOME/bpel/domains/<domain name>/logs/domain.log. (default domain name is "default")

Similar Messages

  • How can I configure ang use JNDI datasource on Tomcat 4.0.x ?

    How can I configure ang use JNDI datasource on Tomcat 4.0.x ?
    Please help me , Thanks !

    Hello ,
    You need to go through the JNDI tutorial which you can access at the sun's site. It will explain all the things you need.
    By the way all you want to use JNDI datasource is JNDI class library and some naming or directory service provider, which also you can download from sun.
    Good Luck.

  • Configure j2ee to support oracle9 database using jndi

    how to configure j2ee1.3.1 to support access to oracle9 data base using jndi
    i'm using a java bean to access an oracle9 data base,this snippet is written in the bean:
    public connexionBD() Throws SQLException{
    String dbName "java:com/env/jdbc/connexionBD";
    DataSource ds=(DataSource)InitialContext().lookup(dbName);
    Connection con =ds.getConnection("system","manager");
    when i try to access the .jsp page that uses this javabeans the SQLException is thrown
    I think it's a server configuration problem.
    Knowing that the classpath and .jar files are configured, Can you help me resolve this problem
    Thank you

    These sections from the J2EE 1.4 platform sepc should hopefully help you understand java:comp/env.
    J2EE.5.2.1.1 Access to Application Component s Environment An application component instance locates the environment naming context using the JNDI interfaces. An instance creates a javax.naming.InitialContext object by using the constructor with no arguments, and looks up the naming environment via the InitialContext under the name java:comp/env. The application component s environment entries are stored directly in the environment naming context, or in its direct or indirect subcontexts. Java Naming and Directory Interface" (JNDI) Naming Context 61 Environment entries have the Java programming language type declared by the Application Component Provider in the deployment descriptor. The following code example illustrates how an application component accesses its environment entries. public void setTaxInfo(int numberOfExemptions,...) throws InvalidNumberOfExemptionsException { ... // Obtain the application component s // environment naming context. Context initCtx = new InitialContext(); Context myEnv = (Context)initCtx.lookup( java:comp/env ); // Obtain the maximum number of tax exemptions // configured by the Deployer. Integer max = (Integer)myEnv.lookup( maxExemptions ); // Obtain the minimum number of tax exemptions // configured by the Deployer. Integer min = (Integer)myEnv.lookup( minExemptions ); // Use the environment entries to // customize business logic. if (numberOfExemptions > max.intValue() || numberOfExemptions < min.intValue()) throw new InvalidNumberOfExemptionsException(); // Get some more environment entries. These environment // entries are stored in subcontexts. String val1 = (String)myEnv.lookup( foo/name1 ); Boolean val2 = (Boolean)myEnv.lookup( foo/bar/name2 ); // The application component can also // lookup using full pathnames. Integer val3 = (Integer)initCtx.lookup( java:comp/env/name3 ); Integer val4 = (Integer)initCtx.lookup( java:comp/env/foo/name4 ); ... }
    J2EE.5.2.4 J2EE Product Provider s Responsibilities The J2EE Product Provider has the following responsibilities: NAMING 64 " Provide a deployment tool that allows the Deployer to set and modify the values of the application component s environment entries. " Implement the java:comp/env environment naming context, and provide it to the application component instances at runtime. The naming context must include all the environment entries declared by the Application Component Provider, with their values supplied in the deployment descriptor or set by the Deployer. The environment naming context must allow the Deployer to create subcontexts if they are needed by an application component.

  • Managing Configuration Information using JNDI

    I'm considering using JNDI to manage our application configuration. Can
    you please comment on these design ideas?
    The Admin. server will master the configuration. The nodes will connect
    to the Admin. server's JNDI and create a copy of the configuration
    context in the local JNDI (anyone know any easy way to do this?).
    (I can't use auto. replication, if the admin. server goes down the node
    servers will unbind the config. information.)
    The nodes will register as NamingListeners to the Admin. server's JNDI.
    When a property changes in the Admin. JNDI, the nodes will automatically
    pick it up.
    I'm worried about when the Admin. server goes down. Do I have to
    re-register the nodes as NamingListeners?
    In a nutshell, my two questions are:
    1) How can I easily copy an entire context between two JNDI trees?
    2) How do I deal with the Admin. server going down (it does happen)?
    Thanks,
    Bob

    Bob Lee <[email protected]> wrote:
    Actually, that would be excellent. Do either of these implement what I'm
    talking about (clustered JNDI with local caches), or would I have ot use
    one of these to implement it myself?No, but you will get replication in the cluster. I've used JavaGroups to
    replicate JMX configuration and it worked pretty well.
    I'd really like to use JNDI for the interface. It's standard (nothing
    new for other developers to learn), it decouples the clients from the
    underlying storage implementation, and it has the notion of contexts
    built in which I really need.
    Thanks,
    Bob
    Dimitri I. Rakitine wrote:
    Why don't you simply use Tangosol product or Javagroups for this ?
    Bob Lee <[email protected]> wrote:
    I'm considering using JNDI to manage our application configuration. Can
    you please comment on these design ideas?
    The Admin. server will master the configuration. The nodes will connect
    to the Admin. server's JNDI and create a copy of the configuration
    context in the local JNDI (anyone know any easy way to do this?).
    (I can't use auto. replication, if the admin. server goes down the node
    servers will unbind the config. information.)
    The nodes will register as NamingListeners to the Admin. server's JNDI.
    When a property changes in the Admin. JNDI, the nodes will automatically
    pick it up.
    I'm worried about when the Admin. server goes down. Do I have to
    re-register the nodes as NamingListeners?
    In a nutshell, my two questions are:
    1) How can I easily copy an entire context between two JNDI trees?
    2) How do I deal with the Admin. server going down (it does happen)?
    Thanks,
    Bob
    Dimitri

  • Jndi Configuration

    Hi everyone..
    Iam trying to execute a simple helloworld application.
    Am using Eclipse editor and JBoss application Server.
    I have created the Bean and got synchronized with the server.
    While execuing the client am getting NoInitialContextException.
    Please mention the jndi properties for Jboss application server and please tell do i need to add any jar file of jboss to the class path to use jndi.
    Please give me a solution.

    I am assuming you are using the DBAdapter for this. Please Refer @ JCA database adapter issue due to database schema dependency
    You will have to comment out the below in the JCA file
    <property name="SchemaName" value="Test"/>
    This way when the schema name is not given, it will use the details from the Datasource configuration.
    Thanks,
    Patrick

  • 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

  • PI 7.11 JMS adapter using JNDI weblogic server issue

    Hi SAP experts,
    I have a scenario to integrate to a application using JMS adapters. we use SAP PI 7.11 version.
    We have deployed JMS drivers successfully and We face issue here to connect to weblogic server
    We are using JMS adapter using JNDI to connect to weblogic server version 10.3.
    Can anyone help with the exact format to be used in JMS properties table and additional parameters table in JMS communication channel. Your quick help will be appreciated.
    A channel error occurred. The detailed error (if any) : com.sap.aii.adapter.jms.api.connector.ConnectorException: Error looking up destination: AccrualDetailsQueue for profile:  ConnectionProfile of channel: CC_SND_JMS on node: 3010950 having object id: 673696a9fe8c39fdab32213f0930afb3: javax.naming.NameNotFoundException: Unable to resolve 'AccrualDetailsQueue'. Resolved ''<br> at com.sap.aii.adapter.jms.core.connector.JndiConnectorImpl.createDestination(JndiConnectorImpl.java:168)<br

    Hi Padmini,
    Refer to the following link:
    http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.htm
    It was very helpful to me, for configuring the additional parameters in the communication Channel JMS.
    I leave you some screenshots of the settings that I did.
    I seize the opportunity to ask you, where do I can get the drivers (.Jar) for Weblogic?
    Regards.
    Rodrigo.

  • AuthenticationFailedException when using JNDI and JavaMail with SMTP auth

    Hi all - I've been banging my head on this one for awhile now - hopefully someone else has done this.
    We are working in a servlet container (tomcat), and need obtain a mail session from JNDI. We do this as follows:
                   Context initCtx = new InitialContext();
                   Context envCtx = (Context) initCtx.lookup("java:comp/env");
                   Session mailSession=(Session) envCtx.lookup("mailSession/trumpetinc");so far so good. The jndi entry for the mail session is configured in server.xml as follows:
              <Resource name="mailSession/trumpetinc" scope="Shareable" type="javax.mail.Session"/>
              <ResourceParams name="mailSession/trumpetinc">
                <parameter>
                  <name>mail.smtp.host</name>
                  <value>mail.server.com</value>
                </parameter>
                <parameter>
                  <name>mail.smtp.password</name>
                  <value>ABCDEFG</value>
                </parameter>
                <parameter>
                  <name>mail.smtp.user</name>
                  <value>trumpet_kevin</value>
                </parameter>
             <parameter>
               <name>mail.smtp.auth</name>
               <value>true</value>
             </parameter>
              </ResourceParams>With the above, whenever we hit Transport.send(msg), we got an AuthenticationFailedException thrown. I have run into this before with SMTP authentication, so I decided to try using the transport.sendMessage() method instead.
    So, I get the transport:
    Transport trans = mailSession.getTransport("smtp");
    trans.connect();Then I send my message using:
    msg.saveChanges();
    trans.sendMessage(msg, msg.getAllRecipients());and finally, I close the transport:
    trans.close();Unfortunately, I'm still getting the exception. Is it possible that my connect() method is not picking up the JNDI properties set in the server.xml file (this seems likely)? If so, what's the best way for me to get those properties so I can set them explicitly in the connect() method?
    Thanks in advance,
    - Kevin

    Hi,
    I have faced the same problem and after some googling and trying I have discovered what causes the AuthenticationFailedException exception. I just wanted to share the knowedge maybe it will be helpfull to others.
    Here it is what the API says:
    To use SMTP authentication you'll need to set the mail.smtp.auth property (see below) and provide the SMTP Transport with a username and password when connecting to the SMTP server. You can do this using one of the following approaches:
    1.Provide an Authenticator object when creating your mail Session and provide the username and password information during the Authenticator callback.
    Note that the mail.smtp.user property can be set to provide a default username for the callback, but the password will still need to be supplied explicitly.
    This approach allows you to use the static Transport send method to send messages.
    2.Call the Transport connect method explicitly with username and password arguments.
    This approach requires you to explicitly manage a Transport object and use the Transport sendMessage method to send the message. The transport.java demo program demonstrates how to manage a Transport object. The following is roughly equivalent to the static Transport send method, but supplies the needed username and password:
    Using the Transport.connect makes the JNDI not very helpfull for configuration.
    It seems that using just the mail.smtp.user and mail.smtp.pass is not sufficient for the authentication.
    so, the solution is :
    just place these to lines in the JNDI configuration:
              username="test"
              password="test1"
    so it should looks as follows:
              <Resource name="mail/Session" auth="Container"
              type="javax.mail.Session"
              username="test"
              password="test1"
              mail.transport.protocol="smtp"
              mail.smtp.auth="true"     
              mail.smtp.host="localhost"
              mail.smtp.port="25"
              mail.smtp.user="test"
              mail.smtp.password="test1"
    />
    where test and test1 are the user's credentials
    Regards,
    Kiril
    Message was edited by:
    Kireto
    Message was edited by:
    Kireto

  • Clafirication on Login Detials  when using JNDI in Toplink

    Hi,
    I am using Toplink in my application for connecting to Database using JNDI ,which is specified in session.xml ,given below
    <toplink-configuration>
    <session>
    <name>default</name>
    <project-xml>META-INF/toplinkMapping.xml</project-xml>
    <session-type>
    <server-session/>
    </session-type>
    <login>
    <datasource>jdbc/PROD</datasource>
    </login>
    </session>
    </toplink-configuration>
    but in the toplinkMapping.xml mapping file i also have an entry for Login Credentials .
    The partial xml mapping file for Login details is given below.
    <toplink:login xsi:type="toplink:database-login">
    <toplink:platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</toplink:platform-class>
    <toplink:user-name>stage</toplink:user-name>
    <toplink:password>0186BD6F6439FA38D570EB1C6286D1EB41782C546151871A</toplink:password>
    <toplink:driver-class>oracle.jdbc.OracleDriver</toplink:driver-class>
    <toplink:connection-url>jdbc:oracle:thin:@localhost:1522:DEV</toplink:connection-url>
    </toplink:login>
    Can anyone please explain why the login details are required here in the mapping file ,while iam connecting DataBase through JNDI using DataSources in the Session.xml
    Thanks in advance

    Hi Jeremy,
    I've tried adding:
    php_value upload_max_filesize 30M
    to the .htaccess file but I get a 500 Internal Server Error
    Seems like using .htaccess files has been deactivated by your host.
    Please try with adding...
    ...on line 1 of the script which needs that, and see if that works -- if even this doesn´t work, I fear I can´t provide any other suggestion than transferring your site to a hosting provider which handles stuff the standard way and doesn´t force you to use such odd workarounds, which I have never heard of.
    Sorry, needed to get that off my chest, but some hosting companies out there are really strange :-)
    The problem is that I use the php.ini files to override the server setting
    I suspect (can be wrong though) that the php.ini file placed in whatever directory will start "from scratch" everytime a document in that folder is "triggered", and that´s why the session of page A are getting destroyed on page B
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Setting up LDAP Server to lookup Connection Factories using JNDI

    Can someone let me know how to setup LDAP server within 10G to lookup connection factories using JNDI?
    I read through the Advanced Queuing User Guide and Reference document where this is mentioned and it says use the Database Configuration Assistant to do this but I could not find how.
    When I install 10G is LDAP server automatically setup? How do I get to it?
    Thanks

    That is correct. I was indeed able to use the app server (10g) to give the LDAP user permission to access the objects, then used sql commands to register the objects inside the LDAP.
    However, I am finding NOTHING about actually creating a unique connection factory that can be registered in the LDAP. I find reference to registering Queues/Topics/Factories inside the LDAP, but nothing about actually creating the factories.
    In fact, here
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28420/aq_envir.htm#sthref409
    it's listed that you cannot use sql to create a connectionfactory... not to mention the create java commands for factories look strikingly similar to the queue/topic GET commands, and not the create commands. You can add an alias for that factory using sql, but can't actually create the factory using sql... ???

  • Please Help.  How can you monitor a directory using jndi connection to a ldap server?

    How can you monitor a directory using jndi connection to a ldap server? I
    want the ldap server to monitor the content change in a file system
    directory on another computer on the network. Can someone please help.
    Thanks
    Fred

    Hi,
    Why do you want to use LDAP for Hard disk monitoring..???
    U can do this by creating a MD5 checksum for all the files existing in some
    perticular
    directory and every hour or any configurable period u can recalculate the
    checksum
    to find out the change in the content.
    I guess all u need is to get the code for "updatedb" utility of Linux and
    instrument it for ur needs..
    Hope it helps...
    -aseem
    mr wrote:
    How can you monitor a directory using jndi connection to a ldap server? I
    want the ldap server to monitor the content change in a file system
    directory on another computer on the network. Can someone please help.
    Thanks
    Fred

  • Servlet with Issues writing to MySQL Database using JNDI

    I'm hung on one servlet for my site. It compiles fine, and is accessed fine by the JSP, but doesn't do as I intended: write my blog entries to the MySQL database!
    As mentioned in the title, I'm using JNDI for connection pooling, via META-INF/context.xml.
    I'm also using JDBC Realm with a form, and that's working just fine, so I'm sure my issue isn't context.xml, as it seems to be overriding Tomcat's context file just fine, at least for authentication.
    Below is the code from the servlet, to include the annotations:
    package projectEgress.web.blog;
    import java.io.*;
    import java.text.*;
    import java.sql.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.*;
    public final class blogInput {
         /* bean properties */
        private String blogHeader;
        private String blogSubheader;
        private String blogBody;
        private String externalLinks;
        Connection conn;
        Statement stmt;
            /* getters & setters */
            public String getBlogHeader() {
                return blogHeader;
            public void setBlogHeader(String blogHeader) {
                this.blogHeader = blogHeader;
            public String getBlogSubheader() {
                return blogSubheader;
            public void setBlogSubheader(String blogSubheader) {
                this.blogSubheader = blogSubheader;
            public String getBlogBody() {
                return blogBody;
            public void setBlogBody(String blogBody) {
                this.blogBody = blogBody;
            public String getExternalLinks() {
                return externalLinks;
            public void setExternalLinks(String externalLinks) {
                this.externalLinks = externalLinks;
            /* like it says, a void which writes to the database */
            public void writeToDatabase() {
                /* create the query string to fill the table */
                String query = "insert into blogEntry (blogHeader, blogSubheader, blogBody, externalLinks) values (\"" + this.blogHeader + "\", \"" + this.blogSubheader + "\", \"" + this.blogBody + "\", \""  + this.externalLinks + "\")";
                try {
                    /*establish the datasource and make the connection */
                    Context ctxt =  new InitialContext();
                    DataSource dsrc = (DataSource)ctxt.lookup("java:comp/env/jdbc/projectEgress");
                    conn = dsrc.getConnection();
                    stmt = conn.createStatement();
                    /* Add data to table 'blogEntry' in our database */
                    int input = stmt.executeUpdate(query);
                    /* close the connections */
                    stmt.close();
                    conn.close();
                    /* check for exceptions, ensure connections are closed */
                    } catch (SQLException sqlx) {
                        sqlx.printStackTrace();
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    } finally {
                        if (stmt != null) {
                            try {
                                stmt.close();
                        } catch (SQLException sqlx) {}
                        if (conn != null) {
                            try {
                                conn.close();
                        } catch (SQLException sqlx) {}
            Here are the settings I have in META-INF/context.xml (sans Realm stuff, which works):
    <Context debug="1" reloadable="true">
        <Resource name="jdbc/projectEgress"
            auth="Container"
            type="javax.sql.DataSource"
            username="********"
            password="********"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/projectEgress?autoReconnect=true"
            validationQuery="select 1"
            maxActive="15"
            maxIdle="8"
            removeAbandoned="true"
            removeAbandonedTimeout="120" />
        <WatchedResource>WEB-INF/web.xml</WatchedResource>
        <WatchedResource>META-INF/context.xml</WatchedResource>
    </Context>And, finally, the code I'm using in the JSP which calls the method (the form action is directed to this file's URL):
        <jsp:useBean id="blogInput" class="projectEgress.web.blog.blogInput">
        <jsp:setProperty name="blogInput" property="*" />
            <jsp:scriptlet>blogInput.writeToDatabase();</jsp:scriptlet>
        </jsp:useBean>
        -YES, I know I'm using a scriptlet in a JSP... I really don't want to create a custom tag to call the method, at least not until I'm far along enough in the project to justify creating a library... let's make it all work, first! :o)
    FINALLY, the form:
    <form action="/projectEgress/area51/blogInput" method="post" id="adminForm" enctype="application/x-www-form-urlencoded">
         <div>
            <span class="inputheader">Blog Header</span><br />
          <input type="text" name="blogHeader" size="35" class="form" /><br />
            <span class="inputheader">Blog SubHeader</span><br />
          <input type="text" name="blogSubheader" size="45" class="form" /><br />
            <span class="inputheader">Blog Body</span><br />
          <textarea class="content" name="blogBody" rows="9" cols="60"></textarea><br />
            <span class="inputheader">External Links</span><br />
          <input type="text" name="externalLinks" size="45" class="form" /><br />
          <input type="submit" value="Post!" class="submit" />
         </div>
        </form>As far as I can tell, it should work, and it doesn't throw any errors (in fact it shows the success message rather than the configured error page), but when I check the blogEntry table from the MySQL prompt, it responds with "Empty set".
    I've double checked to ensure that the table columns are present in MySQL and all the naming conventions line up and they do, so I figure it's my servlet that's broken.
    Advice? Ideas?
    Thanks in advance.
    Edited by: -Antonio on Apr 25, 2008 8:03 PM with additional info

    Okay, I changed a few things in the servlet code.
    For one, I'm trying a PreparedStatement in place of Statement. Don't ask me what made me think it would work any better, it just stores the sql query in cache, but I thought I'd just try something else.
    One thing this is allowing me to do is make the connection and statement (now PreparedStatement pStmt) objects local variables. It wouldn't allow me to do so before without giving me compile errors.
    package projectEgress.web.blog;
    import java.io.*;
    import java.text.*;
    import java.sql.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.*;
    public final class blogInput {
         /* bean properties */
        private String blogHeader;
        private String blogSubheader;
        private String blogBody;
        private String externalLinks;
            /* getters & setters */
            public String getBlogHeader() {
                return blogHeader;
            public void setBlogHeader(String blogHeader) {
                this.blogHeader = blogHeader;
            public String getBlogSubheader() {
                return blogSubheader;
            public void setBlogSubheader(String blogSubheader) {
                this.blogSubheader = blogSubheader;
            public String getBlogBody() {
                return blogBody;
            public void setBlogBody(String blogBody) {
                this.blogBody = blogBody;
            public String getExternalLinks() {
                return externalLinks;
            public void setExternalLinks(String externalLinks) {
                this.externalLinks = externalLinks;
            /* like it says, a void which writes to the database */
            public synchronized void writeToDatabase() {
                Connection conn = null;
                PreparedStatement pStmt = null;
                /* create the query string to fill the table */
                String Query = "INSERT INTO blogEntry (blogHeader, blogSubheader, blogBody, externalLinks) VALUES (\"" + this.blogHeader + "\", \"" + this.blogSubheader + "\", \"" + this.blogBody + "\", \""  + this.externalLinks + "\")";
                try {
                    /*establish the datasource and make the connection */
                    Context ctxt =  new InitialContext();
                    DataSource dsrc = (DataSource)ctxt.lookup("java:comp/env/jdbc/projectEgress");
                    conn = dsrc.getConnection();
                    pStmt = conn.prepareStatement(Query);
                    /* Add data to table 'blogEntry' in our database */
                    pStmt.executeUpdate();
                    pStmt.clearParameters();
                    /* close the connections */
                    pStmt.close();
                    conn.close();
                    /* check for exceptions, ensure connections are closed */
                    } catch (SQLException sqlx) {
                        sqlx.printStackTrace();
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    } finally {
                        if (pStmt != null) {
                            try {
                                pStmt.close();
                        } catch (SQLException sqlx) {}
                        if (conn != null) {
                            try {
                                conn.close();
                        } catch (SQLException sqlx) {}
    }Someone out there has to have a thought on this.
    Even if it's just something they think probably won't work, so long as it gives me another angle to see this from.

  • Unexpected ClassCastException when looking up Home using JNDI

    J2EE Gurus,
    In the attached sample program, a EJB (named MyScheduler in package mytest) is
    used to install a java code dynamically in weblogic service (8.1sp1), as well
    as to invoke a test java code (MyTest.run()) in it using Java reflection. Another
    EJB (named MyEJB in package myejb) is deployed dynamically using Weblogic console
    with its client side packaged with dynamically deployed java code. When invoked
    through MyScheduler, MyTest.run() simply looks up the home of MyEJB using JNDI,
    and when it is cast to MyEJBHome, a ClassCastException is thrown.
    Can someone explain why this exception occurs? Does this mean that a (dynamically)
    deployed code (java or EJB) cannot call other (dynamically) deployed EJBs, even
    when it has the client side of EJB packaged with it?
    Any help will be deeply appreciated.
    Thanks,
    Abhay
    [testjava.jar]

    "Nick" <[email protected]> wrote in message news:40343200$[email protected]..
    Because returned instance implements javax.sql.DataSource.Ha ha.
    No kidding :-)No. One could have found it himself by printing out returned type class
    or just by going to google and typing XADataSource weblogic +ClassCastException...
    Why would you want to do it? weblogic takes care of all the XA
    connection pooling, resource enlistments etc.Yeah, true.
    I should know this - I just got a little confused ... :-)
    I have just come from doing all the XA stuff myself... and got used to having
    XADataSources around...Thanks to J2EE, there is no need for low level plumbing when transaction
    support is needed.
    Also, with JMS resources, you DO have to have the XAQueueConnection etc etc for
    XA - even in an appserver.Per my knowledge weblogic allows you creating XA-aware JMS resources.
    Regards,
    Slava Imeshev
    >
    Thanks.
    "Slava Imeshev" <[email protected]> wrote:
    "Nick" <[email protected]> wrote in message news:403121e2$[email protected]..
    I am getting a ClassCast exception when I lookup a "Global Transaction"enabled
    JDBC DataSource.
    XADataSource xads = (XADataSource) ctx.lookup("jdbc/MyDS");
    Why is this?Because returned instance implements javax.sql.DataSource.
    How do I configure an XADataSource in JNDI?Why would you want to do it? weblogic takes care of all the XA connection
    pooling, resource enlistments etc.
    Regards,
    Slava Imeshev

  • UserTransaction -  Scope using JNDI lookup from jspInit() method

    Howdy,
    I'm using JSP's with JavaBeans accessing a DataSource and some other enviroment variables using JNDI lookups. I've read that JNDI lookups can take a fair amount of time and should be limited whenever possible. My previous configuration had the JNDI lookups inside the constructors of the JavaBeans but I've recently decided to move them to the jspInit() method of the calling JSP. This way the lookup only needs to be performed once and then I pass the values to the JavaBean in a method called setContextVariables. Two of the references to objects that i'm sending are the UserTransaction and DataSource objects. Within the Javabeans I have userTran.begin() and commit() statements. So far it's running great but i'm starting to wonder about the thread safety of this method. My question lies in the actual delagation of the UserTransaction object to the calling client method. It seems that i'm passing the same transaction to every Javabean (or am I?) Is the transaction actually issued when the begin() method is called, or at the time of the JNDI lookup? To test everything out, I opened two sessions and put a breakpoint inside one of the transactions. When I stopped at the breakpoint I ran another thread (also using a transaction retrieved from the same JSP). Then I went back and resumed the first thread and everything seemed to work ok. So... this seems completely fantabulastic so far (definitely noticable response time increases) but I'm still a little skeptical. If anyone is using a process similar to this I would appreciate some feedback. Thanks.

    Hi,
    The EJB bean will use the client transaction when the following attributes are specified in descriptor.
    1) Required
    2) Mandatory
    3) Supports
    In Required case, if the client is associated with Transaction, then the EJB bean will use the same transaction. This is achieved by Transaction context. The EJB bean will use the same transaction context set by client. if the client doesn't have any transaction, then the container will create new transaction context for EJB bean and completes the transaction.
    In Mandatory case, the client must be associated with Transaction so that EJB bean will use the same transaction. If the client doesn't associate with transaction, then container will throw TransactionRequiredException for EJB bean.
    In Supports case, it works similar to Required case except that if the client doesn't associate with transaction, then there won't be any transaction in EJB bean.
    hope this helps.

  • Using jndi.properties with weblogic 6.1

    Apologies if this is a basic question - I am new to Weblogic.
    I have successfully got a test EJB working with Weblogic 6.1 using a properties object to set up my JNDI InitialContext.
    In the weblogic examples I've downloaded it says you can also use a jndi.properties file to do this. I have set up a jndi.properties file, which is in the classpath for my class calling the EJB. But when I do my jndi .lookup("ejbname") I get the error:
    javax.naming.CommunicationException: Can't find SerialContextProvider
    The weblogic documentation at:
    http://e-docs.bea.com/wls/docs61///rmi_iiop/API_rmi_iiop.html
    refers to using jndi.properties and says to look at:
    http://edocs.bea.com/wls/docs61/jndi/jndi.html
    But at this page there is no mention of the jndi.properties method.
    I'd be grateful for any suggestions - in particular whether it is possible to use this method of configuring the JNDI setup.
    I'm running wlserver6.1 on a Windows 2000 PC, using JDK 1.3.1
    My jndi.properties file looks as follows:
    java.naming.property.names=java.naming.factory.initial,java.naming.provider.url
    java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001

    It is not WebLogic-specific. See
    http://java.sun.com/j2se/1.3/docs/api/javax/naming/InitialContext.html
    Alison Tunley <[email protected]> wrote:
    Apologies if this is a basic question - I am new to Weblogic.
    I have successfully got a test EJB working with Weblogic 6.1 using a properties object to set up my JNDI InitialContext.
    In the weblogic examples I've downloaded it says you can also use a jndi.properties file to do this. I have set up a jndi.properties file, which is in the classpath for my class calling the EJB. But when I do my jndi .lookup("ejbname") I get the error:
    javax.naming.CommunicationException: Can't find SerialContextProvider
    The weblogic documentation at:
    http://e-docs.bea.com/wls/docs61///rmi_iiop/API_rmi_iiop.html
    refers to using jndi.properties and says to look at:
    http://edocs.bea.com/wls/docs61/jndi/jndi.html
    But at this page there is no mention of the jndi.properties method.
    I'd be grateful for any suggestions - in particular whether it is possible to use this method of configuring the JNDI setup.
    I'm running wlserver6.1 on a Windows 2000 PC, using JDK 1.3.1
    My jndi.properties file looks as follows:
    java.naming.property.names=java.naming.factory.initial,java.naming.provider.url
    java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001--
    Dimitri

Maybe you are looking for