Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
- creating datasource

- creating datasource

2007-07-16       - By mvbr80

 Back
Hi i am using MyEclipse IDE and using JBOSS 4.0.5ga and i want to create
datasource. my program is

import java.io.IOException Source code of java.io.IOException;
import java.io.PrintWriter Source code of java.io.PrintWriter;

import javax.servlet.ServletException Source code of javax.servlet.ServletException;
import javax.servlet.http.HttpServlet Source code of javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest Source code of javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse Source code of javax.servlet.http.HttpServletResponse;
import javax.sql.*;
import java.sql.*;
import java.io.*;
import javax.sql.DataSource Source code of javax.sql.DataSource;
import javax.naming.*;


public class SrvOne extends HttpServlet {

  /**
  * Constructor of the object.
  */
  private DataSource ds=null;
  public SrvOne() {
    super();
  }

  /**
  * Destruction of the servlet.
  */
  public void destroy() {
    super.destroy(); // Just puts "destroy" string in log
    // Put your code here
    System.out.println("================destroy ---getting datasource");
    ds=null;
  }

 
  public void Service(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    System.out.println("================service ---==================");
 
  try{
    Connection conn=null;
    conn=ds.getConnection();
    System.out.println("================got connection from connection pool======
======");
    Statement stmt=conn.createStatement();
    ResultSet rs=stmt.executeQuery("select * from emp");
    while(rs.next()){
      System.out.println("================"+rs.getString(2));
    }
    conn.close();
    System.out.println("==============got back from connection pool==");
  }catch(Exception e){
    System.out.println("============"+e.getMessage());
   
  }
}

 
 
  public void init() throws ServletException {
    System.out.println("================init ---getting datasource");
    try{
      InitialContext ic=new InitialContext();
      ds=(DataSource)ic.lookup("java:comp/OracleDS");
      System.out.println("========got datasource======"+ds.getClass());
      }catch(Exception e){
        System.out.println("================init ---failed during getting
datasource"+e);
      }
    // Put your code here
  }
 

}


and i copied oracle-ds.xml in the directory...and i m getting error like

[ServiceController] Problem starting service jboss.web.deployment:war
=TestServlet.war,id=-1229853351
org.jboss.deployment.DeploymentException Source code of org.jboss.deployment.DeploymentException: Error during deploy; - nested
throwable: (javax.naming.NamingException Source code of javax.naming.NamingException: resource-ref: OracleDS has no valid
JNDI binding. Check the jboss-web/resource-ref.)
  at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:380)
  at org.jboss.web.WebModule.startModule(WebModule.java:83)
  at org.jboss.web.WebModule.startService(WebModule.java:61)
  at org.jboss.system.ServiceMBeanSupport Source code of org.jboss.system.ServiceMBeanSupport(ServiceMBeanSupport
.java:289)
  at org.jboss.system.ServiceMBeanSupport Source code of org.jboss.system.ServiceMBeanSupport
(ServiceMBeanSupport.java:245)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method Source code of java.lang.reflect.Method(Unknown Source)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher
.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java
:264)
  at org.jboss.mx.server.MBeanServerImpl Source code of org.jboss.mx.server.MBeanServerImpl(MBeanServerImpl.java:659)
  at org.jboss.system.ServiceController Source code of org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController
.java:978)
  at $Proxy0.start(Unknown Source)
  at org.jboss.system.ServiceController Source code of org.jboss.system.ServiceController(ServiceController.java:417)
  at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method Source code of java.lang.reflect.Method(Unknown Source)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher
.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java
:264)
  at org.jboss.mx.server.MBeanServerImpl Source code of org.jboss.mx.server.MBeanServerImpl(MBeanServerImpl.java:659)
  at org.jboss.mx.util.MBeanProxyExt Source code of org.jboss.mx.util.MBeanProxyExt(MBeanProxyExt.java:210)
  at $Proxy38.start(Unknown Source)
  at org.jboss.web.AbstractWebContainer Source code of org.jboss.web.AbstractWebContainer(AbstractWebContainer.java:466)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method Source code of java.lang.reflect.Method(Unknown Source)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher
.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.interceptor.AbstractInterceptor Source code of org.jboss.mx.interceptor.AbstractInterceptor(AbstractInterceptor
.java:133)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke
(ModelMBeanOperationInterceptor.java:142)
  at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java
:97)
  at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext
(InterceptorServiceMBeanSupport.java:238)
  at org.jboss.ws.integration.jboss.DeployerInterceptor.start
(DeployerInterceptor.java:92)
  at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start
(SubDeployerInterceptorSupport.java:188)
  at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor
.java:95)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java
:264)
  at org.jboss.mx.server.MBeanServerImpl Source code of org.jboss.mx.server.MBeanServerImpl(MBeanServerImpl.java:659)
  at org.jboss.mx.util.MBeanProxyExt Source code of org.jboss.mx.util.MBeanProxyExt(MBeanProxyExt.java:210)
  at $Proxy39.start(Unknown Source)
  at org.jboss.deployment.MainDeployer Source code of org.jboss.deployment.MainDeployer(MainDeployer.java:1025)
  at org.jboss.deployment.MainDeployer Source code of org.jboss.deployment.MainDeployer(MainDeployer.java:819)
  at org.jboss.deployment.MainDeployer Source code of org.jboss.deployment.MainDeployer(MainDeployer.java:782)
  at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method Source code of java.lang.reflect.Method(Unknown Source)
  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher
.java:155)
  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  at org.jboss.mx.interceptor.AbstractInterceptor Source code of org.jboss.mx.interceptor.AbstractInterceptor(AbstractInterceptor
.java:133)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke
(ModelMBeanOperationInterceptor.java:142)
  at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java
:264)
  at org.jboss.mx.server.MBeanServerImpl Source code of org.jboss.mx.server.MBeanServerImpl(MBeanServerImpl.java:659)
  at org.jboss.mx.util.MBeanProxyExt Source code of org.jboss.mx.util.MBeanProxyExt(MBeanProxyExt.java:210)
  at $Proxy8.deploy(Unknown Source)
  at org.jboss.deployment.scanner.URLDeploymentScanner Source code of org.jboss.deployment.scanner.URLDeploymentScanner
(URLDeploymentScanner.java:421)
  at org.jboss.deployment.scanner.URLDeploymentScanner Source code of org.jboss.deployment.scanner.URLDeploymentScanner(URLDeploymentScanner
.java:610)
  at org.jboss.deployment.scanner.AbstractDeploymentScanner Source code of org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan
(AbstractDeploymentScanner.java:263)
  at org.jboss.deployment.scanner.AbstractDeploymentScanner Source code of org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop
(AbstractDeploymentScanner.java:274)
  at org.jboss.deployment.scanner.AbstractDeploymentScanner Source code of org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run
(AbstractDeploymentScanner.java:225)
Caused by: javax.naming.NamingException Source code of javax.naming.NamingException: resource-ref: OracleDS has no valid
JNDI binding. Check the jboss-web/resource-ref.
  at org.jboss.web.AbstractWebDeployer.linkResourceRefs(AbstractWebDeployer.java
:610)
  at org.jboss.web.AbstractWebDeployer.parseWebAppDescriptors
(AbstractWebDeployer.java:508)
  at org.jboss.web.AbstractWebDeployer$DescriptorParser.parseWebAppDescriptors
(AbstractWebDeployer.java:865)
  at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal
(TomcatDeployer.java:157)
  at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java
:103)
  at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
  ... 67 more


ny tell me wht i have to do

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic
&p=4064465#4064465

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode
=reply&p=4064465
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user

©2008 junlu.com - Jax Systems, LLC, U.S.A.