dcsimg
IBM WSAD....DataSource error
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rahul_Kothari
Posted On:   Friday, March 14, 2003 03:40 PM

My 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. (InitialContext.java:199) at DataSourceCheck.main(DataSourceCheck   More>>

My 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. (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 .

   <<Less

Re: IBM WSAD....DataSource error

Posted By:   Ni_zhen  
Posted On:   Thursday, April 10, 2003 01:23 AM

1.the main problem:

confirm that ur wsad environment variables r all right,especially the jdbc driver jar.


2.the port 8081 used sound not a iiop port,the default port of iiop is 2809.u should make clear this first.


3.if u evoke ur connection pool from local app server,u may use "InitialContext ctx = new InitialContext();"

About | Sitemap | Contact