IBM WSAD 4.0.3 - getting the DataSource object

Hi guys , i had posted a DataSource question before...but i was able to figure that out. My new problem is that i cant get the DataSource object in my java program and the following error is thrown.
java.lang.NoClassDefFoundError: com/ibm/ejs/ras/TraceElement
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Class.java:212)
     at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:656)
     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
     at javax.naming.InitialContext.init(InitialContext.java:223)
     at javax.naming.InitialContext.<init>(InitialContext.java:199)
     at DataSourceCheck.main(DataSourceCheck.java:27)
Exception in thread "main"
Here is my Java program :
import java.sql.*;
import javax.naming.*;
import java.util.*;
class DataSourceCheck
     public static void main(String[] args)
          javax.sql.DataSource myDataSource= null;
          try
               String initialContextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
               String providerURL = "iiop://localhost:8081";
               java.util.Properties props = new java.util.Properties();
               props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
               props.put(Context.PROVIDER_URL, providerURL);
               Context myContext = new InitialContext(props);
               Connection myConnection = myDataSource.getConnection();     
          catch (Exception e)
               e.printStackTrace();
               System.out.println();
I start a Server instance from IBM WSAD and it runs on 8081.
Please suggest what to do .

sorry..i forgot to delete that line...its a typing eror.
Here is the code again....
I fail to get the context.
import java.sql.*;
import javax.naming.*;
import java.util.*;
class DataSourceCheck
     public static void main(String[] args)
          javax.sql.DataSource myDataSource= null;
          try
               String initialContextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
               String providerURL = "iiop://localhost:900";
               java.util.Properties props = new java.util.Properties();
               props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
               props.put(Context.PROVIDER_URL, providerURL);
               Context myContext = new InitialContext(props);
               //myDataSource = (javax.sql.DataSource)myContext.lookup("jdbc/oracle/OracleDataSource");
               //Connection myConnection = myDataSource.getConnection();     
          catch (Exception e)
               e.printStackTrace();
               System.out.println();

Similar Messages

  • IBM WSAD 4.0.3 - creating a DataSource

    I am using Oracle9i. Please suggest how to create a DataSource.
    Please tell all the steps.

    Hi guys , i had posted a DataSource question before...but i was able to figure that out. My new problem is that i cant get the DataSource object in my java program and the following error is thrown.
    java.lang.NoClassDefFoundError: com/ibm/ejs/ras/TraceElement
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:212)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:656)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:199)
         at DataSourceCheck.main(DataSourceCheck.java:27)
    Exception in thread "main"
    Here is my Java program :
    import java.sql.*;
    import javax.naming.*;
    import java.util.*;
    class DataSourceCheck
         public static void main(String[] args)
              javax.sql.DataSource myDataSource= null;
              try
                   String initialContextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
                   String providerURL = "iiop://localhost:8081";
                   java.util.Properties props = new java.util.Properties();
                   props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
                   props.put(Context.PROVIDER_URL, providerURL);
                   Context myContext = new InitialContext(props);
                   Connection myConnection = myDataSource.getConnection();     
              catch (Exception e)
                   e.printStackTrace();
                   System.out.println();
    I start a Server instance from IBM WSAD and it runs on 8081.
    Please suggest what to do .

  • How can I get the "pageContext" object in jsp page?

    Hi everyone:
    I want to get struts's DataSource object in jsp page.So I should get the PageContext object in jsp page.My code is:
    ///////////////////datatest.jsp///////////////////////////////////
         DataSource ds=(DataSource)pageContext.getAttribute(Action.DATA_SOURCE_KEY);
         conn=ds.getConnection();
              stm=conn.createStatement();
              rs=stm.executeQuery(insertsql);
    Is right?But I get the "NullPointerException" error in Tomcat.The connection pool in struts-config.xml is:
    <data-sources>
    <data-source key="mydatasource">
    <set-property property="autoCommit"
    value="false"/>
    <set-property property="description"
    value="MyWebSite Data Source Configuration"/>
    <set-property property="driverClass"
    value="org.gjt.mm.mysql.Driver"/>
    <set-property property="maxCount"
    value="4"/>
    <set-property property="minCount"
    value="2"/>
    <set-property property="password"
    value="qijiashe"/>
    <set-property property="url"
    value="jdbc:mysql://localhost:3306/myweb"/>
    <set-property property="user"
    value="lyo"/>
    </data-source>
    </data-sources>
    I can query the database in servlet.
    I think the method that I get the context is not right.Had someone get the pagecontext in jsp page?help :(

    Sorry I forgot that I had change the code:
    DataSource ds=(DataSource)pageContext.getAttribute(Action.DATA_SOURCE_KEY);
         conn=ds.getConnection();
              stm=conn.createStatement();
              rs=stm.executeQuery(insertsql);
    to the code:
    DataSource ds=(DataSource)pageContext.getAttribute("mydatasource");
         conn=ds.getConnection();
              stm=conn.createStatement();
              rs=stm.executeQuery(insertsql);
    mydatasource is the struts datasource in "struts-config.xml". I couldn't work

  • How can I get the underlying object from the ObjectReference

    Dear friends,
    I think this question has been asked a couple of times. But, I am still wondering if anybody has found an answer to it. Maybe this is some common need ...
    I would like to get the underlying object for which the ObjectReference is
    a mirror For example, I have a class Customer in my application, and I can get an ObjectReference through JDI during runtime. But how can I get the target VM's object which is a real instance of Customer, by which I can invoke methods defined in Customer?
    Thank you so much for any input!
    SunnyDay

    I'll preface this response by admitting this far from an elegant solution, but I did write a function addressing this question, mostly as an exercise.
    If passed an object with an InTextFrame property (Pgf, AFrame, Cell, Fn) that resides in an open document, the function will return the Doc object. Otherwise, it returns undefined.
    function getParentDoc(testObj) {
        //Get object for current page
        try { var curPage = testObj.InTextFrame.FrameParent.PageFramePage; }
        catch(er) {return;}
        //Step backwards to first page in document
        var prevPage = curPage.PagePrev;
        while (prevPage.ObjectValid())
            curPage = prevPage;
            prevPage = prevPage.PagePrev;
        //Compare with first pages of open documents
        var testDoc = app.FirstOpenDoc;
        while (testDoc.ObjectValid())
            if (curPage.id==testDoc.FirstBodyPageInDoc.id) return testDoc;
            testDoc = testDoc.NextOpenDocInSession;    
        return;
    To your PPS: Rather than seeing the native framework grow bloated to address additional features, I would love to see Adobe and other developers publish libraries of useful functions and class extensions.

  • How to get the UserTransaction object in  stateless session bean

    Hi, I am using jboss server and jdk5 version and using EJB.
    My Application flow :
    JSP à Action(Struts) à Service Locator à Session bean à Entity Bean(cmp) à DB.
    I tried to get the UserTransaction object in my Action. Its my code.
    InitialContext ctx = new InitialContext();
    UserTransaction uTrans = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    After used uTrans.begin(),uTrans.commit() and uTrans. rollback () also.
    Its working fine .
    But, I used the the same code inside in my session bean its not working.
    Stateless Session Manager Bean code :
    public class SampleManagerBean implements SessionBean {
    public void ejbCreate() throws CreateException {  }
    public void ejbRemove() {  }
    public void ejbActivate() {   }
    public void ejbPassivate() {   }
    public void setSessionContext(SessionContext sessionContext) {
    this.sessionContext = sessionContext;
         public void createSample() throws EJBException
         try{
                   InitialContext ctx = new InitialContext();
                   UserTransaction ut = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
              }catch(Exception e) {
              System.out.println(“ Exception === > “+e)
    Its throws the error ie: javax.naming.NameNotFoundException: UserTransaction not bound
    How to get the UserTransaction object in my session bean. Kindly give solution the above errors.
    - Thendral

    first of all, you could just use sessionContext.getUserTransaction(). however, that would only work if your bean is using bean-managed transactions. the default is container-managed transaction, in which case you cannot get a UserTransaction object. if you want to manage transactions, you need to add the TransactionManagementType.BEAN annotation to your ejb.

  • Is there inbuild Handler in weblogic using which i can get the MessageContext object

    HI,
    I need MessageContext object in my application but i dont want to use the Handler,As
    there is AxisEngine in axis soap engine,is there any similar implementation in
    weblogic.
    AxisEngine.getCurrentMessageContext() we can get the MessageContext what about
    in weblogic..any body any idea???
    Regards,
    Akhil Nagpal

    HI,
    yeah i had to make use of Handler to get the MessageContext object and play with
    that.
    Thanks & Regards
    Akhil Nagpal
    "manoj cheenath" <[email protected]> wrote:
    You can get to MessageContext from a handler. Check out an example of
    handler
    to see how you can get Message out of MessageContext.
    -manoj
    "Akhil Nagpal" <[email protected]> wrote in message
    news:[email protected]..
    HI manoj,
    Thanks for your reply.otherwise i thought that i wont get any morehelp
    on this
    forum :-) ...
    anyway its good that we will have such thing in next version,duringthe
    development
    i feel that more functioanlity should be in build in appserver. Likeone
    more
    thing i could not find out is how we can get the "message" object inweblogic
    like we can in axis using its MessageContext class's static method.if it
    is there
    can you please let me knwo about that.
    The other problem i had to make use of handler and my appl is workingas of
    now :-)
    Regards
    Akhil Nagpal
    "manoj cheenath" <[email protected]> wrote:
    You can not do this in WLS 7.0. The next major release (WLS 8.1) will
    fix
    this problem.
    -manoj
    "Akhil Nagpal" <[email protected]> wrote in message
    news:[email protected]..
    HI,
    I need MessageContext object in my application but i dont want
    to
    use
    the Handler,As
    there is AxisEngine in axis soap engine,is there any similarimplementation in
    weblogic.
    AxisEngine.getCurrentMessageContext() we can get the MessageContextwhat
    about
    in weblogic..any body any idea???
    Regards,
    Akhil Nagpal

  • How to get the view Object in UserDefined Action

    Hi  All,
       Any body tell me how to get the view object , like the view object avilable in the wdDoModifyView() method as parameter.
    I have requirement like, i want to change the , no of rows displaying in the table should be changed at the runtime based onthe no of rows  selected in the dropdown box.
    The action which i created will be assigned to that dropdown box, on select of the available option, i will get the view object and change the properties of the "maxrows" of the table .
    so for getting the view object in the  the Action methods tell me what is the procedure for getting the current view object.

    Hello Vishal,
    Simply create a value attribute (say rowCount) of type 'integer' and bind it to the 'visibleRowCount' property of your table. Then, in the actionHandler get the value from the UI element (in your case, I guess it is drop down) and set it to the attribute 'rowCount' like this.
    wdContext.currentContextElement.setRowCount(
        wdContext.current<nodeElement>.set<AttributeBound toDropDown>);
    Bala

  • Unable to get the admin object for the CsContainerAdmin service

    Hi,
    On AIX, we deployed XIR2 SP2 --> XIR2 SP3 --> SP3 Productivity Pack.
    The Conection server does show up on the server list in the CMC, but on trying to access this server, it throws an error" Unable to get the admin object for the CsContainerAdmin service"
    Tried to manually create another Connection server, same result.
    Is this an issue that is addressed by a later FP?
    Thanks in advance
    Rajesh Jayakumar

    Hi Rajesh,
    Were you able to resolve this issue? I am facing the same issue with almost every BOE 11.5 SP3 server on Windows.
    For example, the Input file server says this -
    "Unable to get the admin object for the FileServerAdmin service for server Input.BOCMSMSGT1.fileserver".
    Getting the same error on WebI Report Server as well -
    There was an error while retrieving data from the server: Unable to get the admin object for the WebiServerAdmin service for server BOPROCENG1.Web_IntelligenceReportServer.webiserver
    Thanks,
    Sarang
    Edited by: Sarang Deshpande on Sep 26, 2008 3:08 PM

  • How to  get the profile object in simple java class  (Property accessor)

    Hi All,
    Please guide me how to get the profile object in simple java class (Property accessor) which is extending the RepositoryPropertyDescriptor.
    I have one requirement where i need the profile object i.e i have store id which is tied to profile .so i need the profile object in the property accessor of the SKU item descriptor property, which is extending RepositoryPropertyDescriptor.
    a.I dont have request object also to do request.resolvename.
    b.It is not a component to create setter and getter.It is simple java class which is extending the RepositoryPropertyDescriptor.
    Advance Thanks.

    Iam afraid you might run into synchronization issues with it. You are trying to get/set value of property of a sku repository item that is shared across various profiles.
    Say one profile A called setPropertyValue("propertyName", value).Now another profile B accesses
    getPropertyValue() {
    super.getPropertyValue() // Chance of getting value set by Profile A.
    // Perform logic
    There is a chance that profile B getting the value set by Profile A and hence inconsistency.
    How about doing this way??
    Create PropertyDescriptor in Profile (i.e user item descriptor), pass the attribute CustomCatalogTools in userProfile.xml to that property.
    <attribute name="catalogTools" value="atg.commerce.catalog.CustomCatalogTools"/>
    getPropertyValue()
    //You have Profile item descriptor and also storeId property value.
    // Use CustomCatalogTools.findSku();
    // Use storeId, profile repository item, sku repository item to perform the logic
    Here user itemdescriptor getPropertyValue/setPropertyValue is always called by same profile and there is consistency.
    -karthik

  • Getting the Request Object in the EJB published as a Web Service

    Hi experts,
    I have a Portal Service that call a BAPI in a back-end system with the Connector Framework. I have a Portal Component that calls the Portal Service, passing the Locale (request.getLocale()) and the User (request.getUser()) object. It's work fine!
    I need to call the Portal Service by an EJB that is published as a Web Service. The connection between the EJB and Portal Service is ok, but I don't know how to get the Locale and the User object in the EJB to pass to the Portal Service.
    Is possible to get the request object from the HTTP SOAP Request?
    Thanks,
    Gustavo

    Hey Alice!
    The Feature Hashing module is actually a wrapper around
    Vowpal Wabbit's implementation of the murmurhash. Thus, it takes text in, and produces 2^N new features based on the text, where N is the bitsize specified in the module. These features (and not the original text!) should be used during model training.
    The Learner will then keep track of these features behind the scenes.
    When you publish your web service and these features are recomputed for new input text (same N), they are used as the features for scoring.
    Does that make sense?
    Regards,
    AK

  • Can I get the HttpServletRequest object in my custom auth providers?

    Hello -
    If I write a custom authentication or identity assertion provider, is there a way to get the HttpServletRequest object of the user's request?
    Thanks,
    -- Scott

    You can do it from your identity asserter in the following way!
    public CallbackHandler assertIdentity(String type, Object token, ContextHandler context) throws IdentityAssertionException
    Object requestValue = context.getValue("com.bea.contextelement.servlet.HttpServletRequest");
    HttpServletRequest request = (HttpServletRequest) requestValue;
    -Faisal
    http://www.weblogic-wonders.com

  • Getting the connection object in graph

    As part of Denormalizer component's Denormalize property where we have the logic of collapsing/denormalising the records we want to execute a sql query using PreparedStatement which requires Connection object.how do I get the connection object and execute a query.Can some one please share the java doc of the classes I can use.
    Do I get any class under org.jetel package which can be useful to get the Connection object.

    As part of Denormalizer component's Denormalize property where we have the logic of collapsing/denormalising the records we want to execute a sql query using PreparedStatement which requires Connection object.how do I get the connection object and execute a query.Can some one please share the java doc of the classes I can use.
    Do I get any class under org.jetel package which can be useful to get the Connection object.

  • InteraceNotSupportedException when getting the native object in portal

    Hi,
    When i am trying to get the native object i get the following error
    com.sapportals.connector.connection.InterfaceNotSupportedException: Interface com.sap.mdm.net.ConnectionAccessor is not supported
    Please help me.
    Thanks,
    Padmaja

    Hi Sree,
    Ruben has told you an option using a Notification Wait with interruption, but.... that option has some drawbacks.
    1- Interrupting a previously interrupted instance may not achieve the desire effect.
    2- The engine does not guarantee that the notifications are received in the same order than they were sent. (it usually does, but...)
    3- A notification will not be successful if the instance is locked (by an user running a screenflow). The notification will be retried, etc... (this will degrade your engine performance)
    There are more.
    Let me tell you a completely different approach.
    Why don't you store your object in a separate storage (like a database). You can store it (in xml) and read it. (BPM provides the ability to serialize and deserialize an business object to/from an xml).
    So, you will need an identifier that will be stored in an instance variable. (and the subprocess should have the same id)
    So, when you need the information, you search it in the database (by using the ID)
    Advantages:
    1- The information is shared between the main process and the subprocess
    2- The instance Blob size will be reduced
    3- You only read the object when it is necessary
    Disadvantages:
    1- you have to code a bit more
    2- If you need the object in almost all the activities, an extra select+update will be required.
    (if you use the PK, those queries should run very fast)
    As I told you before, this is a completely different approach.
    Hope this helps,
    Ariel

  • Which view I can query to get the granted objects privilege to a user?

    Hi all,
    which view I can query to get the granted objects privilege to a user?
    for example:
    grant execute on accounting.get_name to scott;
    Which view has above object granted information?
    Thanks

    SQL> select * FROM all_tab_privs where grantor = upper('accounting');
    no rows selected

  • Problem getting the collection objects in Toplinks using JDeveloper11g

    Hi All
    I am working the Toplinks in JDeveloper11g. I am using the Java Objects From Tables to create the Toplink map .
    The problem is I am unable to work with the collection objects. I am getting the collection objects like addtocollection and removefromcollection. when I am dragging the collection object into the form and running the application it is giving errors.
    Can any one help me out how to work with this collection objects.
    Thanks in advance
    Madhavi.

    look at the java.util.SortedMap interface, and the classes that implement it. or, re-think your design. why do you want the entries sorted? do you really want that, or do you assume you do? is a Map the right collection here? I'm not saying it isn't, I'm just saying that the sorting requirement sounds like an assumption you need to challenge. generally, we get data out of a Map by explicitly asking for it by key

Maybe you are looking for