Solved

how get DataSource in jdeveloper if i am not running any server

Posted on 2006-06-21
18
1,224 Views
Last Modified: 2012-06-27
how get DataSource in jdeveloper if i want to look up datasource;first tell me Is it possible to get connection if i write like this?i am not running any server.
 
 InitialContext ictx = new InitialContext();
            DataSource dataSource = (DataSource) ictx.lookup("dbPool");
            return dataSource.getConnection();
0
Comment
Question by:chaitu chaitu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +2
18 Comments
 
LVL 92

Expert Comment

by:objects
ID: 16956889
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16956925
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 16957211
not able to run the jnpserver

C:\jboss\server\default\lib>set classpath=C:\jboss\server\default\li
b\jnpserver.jar;C:\jboss\server\default\lib\log4j.jar

C:\jboss\server\default\lib>java org.jnp.server.Main
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/util/thread
pool/ThreadPool
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 92

Expert Comment

by:objects
ID: 16957226
looks like you also need to add the jboss thread pool classes to your classpath
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16957234
>> C:\jboss\server\default\lib\jnpserver.jar

Does it contain the ThreadPool class? If not, you might have to add some other JARs to classpath as well. Perhaps the others present in the lib folder.
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 16957543
jnpserver is running

i am running below file from jdeveloper to get DataSource from oracle-ds.xml file jboss;in oracle-ds.xml i configured  DBPool;

public static void main(String[] args)
  {
    try
    {
   
   Properties p=new Properties();
    p.load(new FileInputStream("jndi.properties"));
    Context ctx = new InitialContext(p);
   
    DataSource ds = (DataSource) ctx.lookup("DBPool");
    }
    catch(IOException e)
    {
      e.printStackTrace();
    }catch(NamingException e)
    {
      e.printStackTrace();
    }
   
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16957820
Yes the server could be running but are all those JARs in the class-path?
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 16966234
jnp server and jboss server both should be running;if jboss is running then it is meaningless to run jnp server because jboss internally listen jnpport;

now i am doing is i shutdown the jboss and only jnpserver is running;

now i write above program in jdeveloper to get datasource that is configured in  oracle-ds.xml  .i put jnp-client.jar in jdevloper while running above running;any thing need to be done??
0
 
LVL 19

Expert Comment

by:actonwang
ID: 16970154
Once the JNP server is running, you can configure your application to use JNP by including the jnp-client.jar file in its classpath and specifying the java.naming.provider.url and java.naming.factory.initial properties in either the system properties or the jndi.properties file. the following shows an example jndi.properties file:

 java.naming.provider.url=jnphost.mycompany.com:1099
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming
0
 
LVL 19

Expert Comment

by:actonwang
ID: 16970162
refer to this to detailed steps to set up stand alone jnp inside your jdeveloper (or other environment):

http://www.javaworld.com/javaworld/jw-04-2002/jw-0419-jndi-p2.html
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 16974038
acton,

already mayank posted same link;by following that link only i did ;
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 16974120
should i run jboss  ;i am already running jnp server
0
 
LVL 19

Expert Comment

by:actonwang
ID: 16975209
>>already mayank posted same link
    sorry.

     you don't need to run jboss only jnp server is enough. what error you get after you set up everything?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16978158
>> while running above running

Meaning?
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 16981103

mayank ,

typing mistake.

jnp server is running ; i write above program in jdeveloper to get datasource(DBPool) that is configured in  oracle-ds.xml  .i put jnp-client.jar in jdevloper while running the above program ;any thing need to be done??below error is coming.

javax.naming.NameNotFoundException: DBPool not bound

      at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)

      at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)

      at org.jnp.server.NamingServer.getObject(NamingServer.java:505)

      at org.jnp.server.NamingServer.lookup(NamingServer.java:278)

0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 16981131
presently oracle-ds.xml  is in jboss\server\default\deploy directory;
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 17047208
Closed, 500 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
runtime exception 2 67
batch vs regular insert in spring DAO 2 52
DTD and JAVA versions 1 59
Retrieve multiple results between delimiters in a String in Java 13 25
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question