Access Datasource from Servlet Engine (Tomcat)

Hi,
I'm using datasource connections in my beans and event in servlets.. It works fine in JRun 3.1 environment.
But when I port to J2EE1.3 its throwing this exception...
I just want to understand whether it is a limitation in J2EE1.3 & Tomcat environment or it is a security problem or do I have to change any configuration file so that I can make the datasource connection available outside the J2EE environment.
java.lang.IllegalArgumentException: Unknown component type      at com.sun.enterprise.naming.NamingManagerImpl.getComponentType(NamingManagerImpl.java:670)      at com.sun.enterprise.naming.NamingManagerImpl.getMangledIdName(NamingManagerImpl.java:708)      at com.sun.enterprise.naming.NamingManagerImpl.getComponentIdInternal(NamingManagerImpl.java:680)      at com.sun.enterprise.naming.NamingManagerImpl.getComponentId(NamingManagerImpl.java:313)      at com.sun.enterprise.naming.java.javaURLContext.getComponentContext(javaURLContext.java:397)      at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:51)      at javax.naming.InitialContext.lookup(InitialContext.java:350)      at com.camilion.env.ejb.EjbEnvironment.getJDBCConnection(EjbEnvironment.java:105)      at com.camilion.report.servlet.ReportServlet.service(ReportServlet.java:49)      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)      at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:428)      at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)      at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:197)      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)      at java.security.AccessController.doPrivileged(Native Method)      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2314)      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)      at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)      at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:995)      at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1088)      at java.lang.Thread.run(Thread.java:484)

I'm getting the same problem trying to lookup a datasource from a JSP with J2EE 1.3 reference implementation.

Similar Messages

  • Access EJB from Servlet that in different archive?

    <font class="mediumtxt">package kyro.ejb.session;
    import javax.ejb.*;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless(name="StandAlone")
    @Remote(StandAlone.class)
    public class StandAloneBean
    implements StandAlone, StandAloneLocal
    public StandAloneBean() {
    public String sayHello() {     
    return "sayHello";
    I want to access ejb from servlet that .war and .jar not in single .ear. I want to try that just with annotation not xml descriptor cause is easy to understand for me. I use Glassfish. But i can't lookup that ejb. How can i lookup that ejb with jndi? Can't you give me example of servlet to access that? I not use JNDI.properties, are that caused i can't access my ejb? I just thing .war and.jar in one server, are i have to used JNDI.properties. can you explain how to use JNDI.properties in servlet or separate file?
    </font>

    But i can't lookup that ejb. How are you trying and what exception is occurring?
    How can i lookup that ejb with jndi? [https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html|https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html]
    m

  • How to run a MS Access Query from Servlet

    Is there a way to execute an MS Access query from a servlet. I have a query that is doing an INSERT into the database. I tried to code the servlet to directly do the query itself, but it keeps locking the database and hanging. I would appreciate any help.
    Thanks,
    Justin
    [email protected]

    r u refering to the query saved inthe MSACCESS, if so then it may not be possible, bcoz it is not a pure RDBMS. otherwise the u can do it as inthe above mention thread.

  • Access ApplicationBean from servlet

    My project uses both JSF generated pages as well as servlets. I would like to be able to access an Application Bean from a servlet in the same project. The java files for the servlet are in the same directory as the package that holds the generated java page files. The Application bean should be accessible to both the generated classes as well as the servlets. Can anyone suggest how to set this up?

    Hi Jim,
    I am not sure I understand completely the problem you are facing, but I shall try to answer to the best of my knowledge and from what I have understood.
    Since the JSF generated pages and the servlets are in the same folder all you would require to do is create an instance of the application bean and it should be accessible.
    Hope this is what you were looking for.
    Cheers
    Giri :-)
    Creator Team

  • Problem accessing ejb from servlet

    Hi,
    I'm aving a problem accessing a stateful session bean from a servlet. I'm using a jndi lookup to do it because I need that a client has its own bean reference...
    My code into the service method is:
    InitialContext ctx;
    try {
    ctx = new InitialContext();
    carrelloService = (CarrelloLocal)ctx.lookup("java:comp/env/ejb/Carrello");
    and I have a reference to EJB into web.xml:
    <ejb-local-ref>
    <ejb-ref-name>ejb/Carrello</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home></local-home>
    <local>carrello.model.CarrelloLocal</local>
    </ejb-local-ref>
    If I use @EJB annotation to inject the servlet, it works fine.
    Instead using jndi lookup throws a NamingException because it doesn't find java:comp/env/ejb/Carrello entry.
    Any idea about the problem?

    Here's something simple that I have that works:
    <p> </p>
    SimpleBean
    <p> </p>
    @Stateless(name="SimpleBean")
    public class SimpleBeanBean implements SimpleBeanLocal {
    <p> </p>
    web.xml; -- note I use a whacko ejb-ref-name just to make it obvious where I'm using it.
    <p> </p>
        <ejb-local-ref>
            <ejb-ref-name>ejb_mapping_doodad/SimpleBean</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            <local>sab.otn681398.ejb.SimpleBeanLocal</local>
        </ejb-local-ref><p> </p>
    servlet:
    <p> </p>
    package sab.otn681398.web;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import sab.otn681398.ejb.SimpleBeanLocal;
    public class TestServlet extends HttpServlet  {
        private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
        private static final String SIMPLE_BEAN_JNDI = "ejb_mapping_doodad/ASimpleBean";
        private final boolean USEENC = true;
        private SimpleBeanLocal simple = null;
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
        public void doGet(HttpServletRequest request,
                          HttpServletResponse response) throws ServletException, IOException {
            response.setContentType(CONTENT_TYPE);
            PrintWriter out = response.getWriter();
             try {
                if(simple==null) {
                    simple = createSimple();
            } catch(NamingException ne) {
                throw new ServletException("Error in looking up the EJB", ne);
            out.println("<html>");
            out.println("<head><title>TestServlet</title></head>");
            out.println("<body>");
            out.printf("&lt;p&gt;The %s bean has been hit: %s times&lt;/p&gt;", simple, simple.getHitCount());
            out.println("</body></html>");
            out.close();
        private SimpleBeanLocal createSimple() throws NamingException {
          return (USEENC==true? createSimpleViaENC(): createSimpleViaName());
        private SimpleBeanLocal createSimpleViaENC() throws NamingException {
            InitialContext ic = new InitialContext();
            SimpleBeanLocal simple = (SimpleBeanLocal)ic.lookup("java:comp/env/" + SIMPLE_BEAN_JNDI);
            return simple;
        private SimpleBeanLocal createSimpleViaName() throws NamingException {
            InitialContext ic = new InitialContext();
            SimpleBeanLocal simple = (SimpleBeanLocal)ic.lookup(SIMPLE_BEAN_JNDI);
            return simple;
    }<p> </p>
    -steve-

  • Exceptions arsing while accessing DataSource   from a stand alone java clie

    Dear all responders,
    can any one help in resolving my problem??the problem description is as follows:
    i am using sun one application server 7.0 to deploy a J2EE Apllication
    so i have created a data source using the admin page with the name
    "nodbsession".now i want to access this datasource using a stand alone java client and want to establish a connection to database.i am using the following code snippet to do so
    **code is as follows**
    Hashtable env=new Hashtable();
                   env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
                   env.put(Context.PROVIDER_URL, "iiop://localhost:3700");
                   System.out.println("creating context");
                   Context ctx =new InitialContext(env);
                                  System.out.println("created successfull");
                   DataSource ds =(DataSource)ctx.lookup("nodbsession");
    /* by using like this also it is not working
    DataSource ds =(DataSource)ctx.lookup("java:comp/env/jdbc/nodbsession");
    i am able to obtain the context succussfully but the exception is thrown for the data source look up
    the following exception is thrown
    javax.naming.NameNotFoundException. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
    at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
    at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:402)
    at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
    at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
    at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at Test.<init>(Test.java:27)
    at Test.main(Test.java:47)
    please help me in resolving the above problem
    advance thanx to all those who intend to reply
    please provide me a proper resolution

    I think the appserver uses com.sun.enterprise.naming.SerialInitContextFactory on the server side to register different resources. Anything registered with SerialialInitContextFactory cannot be resolved with a CNCtxFactory.
    Can you try using SerialInitContextFactory on the client side.

  • Access files from servlet

    hi
    how can i access a local text file using a servlet.

    Presumably by "local" you mean a file on the server where the servlet is running? If so, you do what you would normally do in a Java program to access a local file. If by "local" you mean a file on some other system, which would be a bizarre meaning of the word, then the rules are the same as for any other Java program: that other system has to have a server running, and your servlet has to access it via that server.

  • Unable to access EJB from servlet

    Hi,
    I have in service method my servlet code.
    Hashtable env = new Hashtable();
                        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationInitialContextFactory");
                        env.put(Context.PROVIDER_URL, "ormi://localhost/hello");
                        env.put(Context.SECURITY_PRINCIPAL, "admin");
                        env.put(Context.SECURITY_CREDENTIALS, "mypwd");
                        Context ctx = new InitialContext(env);
              Object obj = ctx.lookup("HelloName");
                        HelloHome home = (HelloHome) javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);
                        Hello hello = home.create();
    this is how i have orion-ejb-jar.xml
         <enterprise-beans>
              <session-deployment name="Hello" location="HelloName" >
              </session-deployment>
         </enterprise-beans>
         ejb-jar.xml
              <session>
                   <ejb-name>Hello</ejb-name>
                   <home>examples.HelloHome</home>
                   <remote>examples.Hello</remote>
                   <local-home>examples.HelloLocalHome</local-home>
                   <local>examples.HelloLocal</local>
                   <ejb-class>examples.HelloBean</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
              </session>
    When i access the servlet i get this error.
    javax.naming.NameNotFoundException: HelloName not found
         at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:149)
         at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:217)
         at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:88)
         at javax.naming.InitialContext.lookup(InitialContext.java:345)
         at examples.HelloServlet.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:772)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:782)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:479)
    Is location attribute in orion-ejb-jar.xml used to specify JNDI name? Can i get the JNDI tree showing the name mappings in oc4j? How do i correct this error?
    Ravi

    Ravi --
    The most portable and standards oriented solution is to define an ejb-ref in the web.xml for the servlet, and then look up the name using the formal EJB UNC model.
    web.xml:
    <ejb-ref>
    <ejb-ref-name>ejb/AppSessionFacadeHome</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>faqapp.ejb.AppSessionFacadeHome</home>
    <remote>faqapp.ejb.AppSessionFacade</remote>
    </ejb-ref>
    servlet lookup
    InitialContext ctx = new InitialContext();
    Object homeObject = ctx.lookup("java:comp/env/ejb/AppSessionFacadeHome");
    EJBHome ejbHome = (EJBHome)
    portableRemoteObject.narrow (homeObject, AppSessionFacadeHome.class);
    cheers
    -steve-

  • Accessing db from servlet

    Hi,
    I have a college project and am facing some problems. I have a CONTROLLER CLASS holding all the logic, a SERVLET and a JSP page for showing errors. The prob is that I cant call a certain method from the servlet.. Here is the method I want to call from the servlet. And the problem area in the servlet is marked bold and in italics, except these two things, everything is working fine. PLEASE HELP
    *******************part of participantDAO class*******************
    public boolean updateParticipantTime (String tfNumber, String tfTime) throws Exception
    Connection dbConnection;
    Statement statement;
    ResultSet resultSet;
    String sqlText="";
    boolean update = false;
    Vector <Participant> myVector = new Vector <Participant>();
    Participant participant;
    if (jdbcDriverLoaded == false)
    loadDriver();
    try
    dbConnection = DriverManager.getConnection (connectionString) ;
    statement = dbConnection.createStatement () ;
    int number = Integer.parseInt(tfNumber.trim());
    if(tfTime.equals("") || tfTime == null)
    sqlText = "UPDATE participant SET finishingTime = NULL WHERE number = " + number ;
    System.out.println (sqlText) ;
    statement.executeUpdate (sqlText) ;
    sqlText = "n/a" ;
    statement.close () ;
    dbConnection.close () ;
    update = true;
    else
    sqlText = "UPDATE participant SET finishingTime = " tfTime.trim()"WHERE number = "+ number ;
    System.out.println (sqlText) ;
    statement.executeUpdate(sqlText) ;
    sqlText = "n/a" ;
    statement.close () ;
    dbConnection.close () ;
    update = true;
    catch (SQLException sqle)
    printSQLException (sqle, sqlText) ;
    throw sqle ;
    return(update);
    *********************SERVLET**************************
    import javax.servlet.* ;
    import javax.servlet.http.* ;
    import java.io.* ;
    import Participant_package.*;
    import java.lang.*;
    public class UpdateTimeServlet extends HttpServlet
    public boolean updateTime = false;
    ParticipantDAO participantDAO = new ParticipantDAO();
    int intNum;
    * @param request <code>HttpServletRequest</code>
    * @param response <code>HttpServletResponse</code>
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException
    doPost(request, response);
    * @param request <code>HttpServletRequest</code>
    * @param response <code>HttpServletResponse</code>
    public void doPost (HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException
    try
    HttpSession session = request.getSession(true);
    String number = null;
    String time = null;
    String messageText = "";
    number = request.getParameter("tfNumber");
    time = request.getParameter("tfTime");
    if(number.equals(""))
    messageText="Please give participant number.";
    request.setAttribute("message", messageText);
    RequestDispatcher dispatcher = request.getRequestDispatcher("/jsp/UpdateTime.jsp");
    dispatcher.forward(request, response);
    else
    intNum = Integer.parseInt(number);
    if(participantDAO.existParticipant(number) == false)
    messageText="No such participant was found. Try again!";
    request.setAttribute("message", messageText);
    RequestDispatcher dispatcher = request.getRequestDispatcher("/jsp/UpdateTime.jsp");
    dispatcher.forward(request, response);
    else
    participantDAO.updateParticipantTime(number, time);+
    messageText="Update successful";+
    request.setAttribute("message", messageText);+
    RequestDispatcher dispatcher = request.getRequestDispatcher("/jsp/UpdateTime.jsp");+
    dispatcher.forward(request, response);        }+
    catch (Exception e)+
    +*{*+
    System.out.println ("********* TIME FORMAT ERROR *********") ;*+
    +*System.out.println ("An unexpected exception occurred:" + e) ;*+
    +*System.out.println("Try again once more!");*+
    +*nextPage("/jsp/UpdateTime.jsp", request, response);*+
    +*return; }*+
    * Forwards according to the URI argument
    * @param request <code>HttpServletRequest</code>
    * @param response <code>HttpServletResponse</code>
    * @param nextURL <code>String</code>
    private void nextPage (String nextURI, HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException
    request.getRequestDispatcher(nextURI).forward(request, response) ;
    **********************JSP PAGE***************************
    <%@ page import = "java.util.*" %>
    <?xml version = "1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns = "http://www.w3.org/1999/xhtml">
    <head>
    <link rel ="stylesheet" type="text/css" href="/atk84f/CSS/RaceStyle.css" />
    <title>
    Update participants finishing time
    </title>
    </head>
    <body>
    <img src ="/atk84f/images/running1.jpg" />
    <a href="http://validator.w3.org/check?uri=referer"><img
    src="http://www.w3.org/Icons/valid-xhtml11-blue"
    alt="Valid XHTML 1.1" height="31" width="88" /></a>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <h2>Update finishing time</h2>
    <%
    String number = (String) request.getParameter("tfNumber");
    String time = (String) request.getParameter("tfTime");
    String messageText = (String)request.getAttribute ("message") ;
    if(number == null)
    number = "";
    if(time == null)
    time="";
    if(messageText == null)
    messageText = "";
    %>
    <!-- Show Form -->
    <form action ="/atk84f/servlet/UpdateTimeServlet" method="post">
    <br />
    <table>
    <tr>
    <td class="form">Participant Number: </td>
    <td class="form"><input type="text" name="tfNumber" value="<%=number%>" /></td>
    </tr>
    <tr class=""tr>
    <td class="form">Time (hh:mm:ss): </td>
    <td class="form"><input type="text" name="tfTime" value="<%=time%>" /></td>
    </tr>
    <tr class="tr">
    <td class="form"></td>
    <td class="form"><input type="submit" name="btSubmit" value="Update" /></td>
    </tr>
    </table>
    </form>
    <!-- Show Message -->
    <p><big><%= messageText %></big></p>
    <p><a href ="/atk84f/Race.html">Main page</a></p>
    <p><a href ="/atk84f/jsp/ParticipantList.jsp">List of the participants</a><p>
    </body>
    </html>

    Please do these things:
    - 1 use the [&#99;ode] tags to make your code readable
    - 2 tell use what actually happened, eg. show the error
    - 3 simplify the problem, make an SSCCE
    When that is done, we may be able to help.
    Without that, here's all I can say:
    I can't really tell from the pile of unformatted code what state the response is in, but if you are getting IllegalStateException, its because the response is no longer virgin and forwarding isn't permitted.

  • New Servlet Engine with iAS

    Is it true that in the next version of iAS, a new servlet engine (TOMCAT perhaps) will be proposed to replace JSERV ?
    null

    WebLogic's Servlet engine is less than $1K / CPU I believe.
    Peace,
    Cameron Purdy
    Tangosol Inc.
    Tangosol Coherence: Clustered Coherent Cache for J2EE
    Information at http://www.tangosol.com/
    "Jon" <[email protected]> wrote in message
    news:[email protected]..
    Does anyone have experience using iPlanet 6.0 Servlet engine with
    WebLogic 6.1 EJB engine? The two engines will be located on separate
    physical servers. If so, any information on the implementation would
    be greatly appreciated (lessons learned especially). Would the cost
    difference between using WebLogic's Servlet engine vs. iPlanet's
    Servlet Engine be worth the attempt? I saw in some previous posts
    that there were issues with how older versions of Weblogic RMI (T3)
    Protocol worked and that Weblogic would only have one socket
    connection for the iPlanet Servlet Engine through which all requests
    will be multiplexed. This would be a bottleneck for any application.
    Is this still true with the latest versions of these products?
    Thanks,
    Jon

  • How to connect to MS Access from servlet uploaded in TOMCAT server

    Hi,
    I want to access MS Access from servlet .I use TOMCAT server.I want to know what should i do.How to get drivers and how to set class path for them.
    Please help me in finding the solution
    thanks and Regards

    HI,
    try this
    <Code>
    response.setContentType(CONTENT_TYPE);
         PrintWriter out = response.getWriter();
         java.sql.DatabaseMetaData dm = null;
         java.sql.ResultSet rs = null;
         try
              Class.forName("sun,jdbc.odbc.JdbcOdbcDriver");
              Connection con = java.sql.DriverManager.getConnection("jdbc:odbc:dsnName","","");
              dm = con.getMetaData();
              out.println("<html>");
              out.println("<head><title>Servlet1</title></head>");
              out.println("<body bgcolor=\"lightblue\">");
              if(con!=null){
                   dm = con.getMetaData();
                   out.println("<B><br>Driver Information</B>");
                   out.println("\n\t<br><br>Driver Name: "+ dm.getDriverName());
                   out.println("\n\t<br>Driver Version: "+ dm.getDriverVersion ());
                   out.println("\n\t<br>Database Information ");
                   out.println("\n\t<br>Database Name: "+ dm.getDatabaseProductName());
                   out.println("\n\t<br>Database Version: "+ dm.getDatabaseProductVersion());
                   out.println("\n\t<br><br>Avalilable Catalogs ");
                   rs = dm.getCatalogs();
                   while(rs.next()){
                             out.println("<br>\tcatalog: "+ rs.getString(1));
                   out.println("\n\t<br><br>conURL =" + conURL);
                   out.println("\n\t<br><br>Title = Database");
                   rs.close();
                   rs = null;
                   con.close();
              }else {
                   out.println("Error: No active Connection");
         }catch(ClassNotFoundException e) {
              out.println("Coudn't laod the database driver: " + e.getMessage());
         } catch(SQLException e) {     
              out.println("SQLException caught: " + e.getMessage());
              try {
                   if (con != null)
                        con.close();
                   if (rs != null)
                        rs.close();
              catch (SQLException ignored) {}
              finally {
                   try {
                             if (con != null)
                                  con.close();
                             if (rs != null)
                                  rs.close();
                        catch (SQLException ignored) {}
    </Code>
    Sachin

  • CiscoWorks Tomcat Servlet Engine service does not start

    Hello!
    CiscoWorks  Tomcat Servlet Engine service does not start.
    Events in the Windows Event Viewer:
    The CiscoWorks Tomcat Servlet Engine service terminated unexpectedly. It has done this 1 time(s).
    output pdshow and file stderr.log,  hs_err_pid2128.log attached.
    Do  you have an idea how to resolve this?
    Thanks!

    The only things which I see are wrong are the start types for the IPM NG database engine and HUM database engine services.  They must be set to Manual, not Automatic.  However, that would not account for the Tomcat crash.  The crash points to an error in the code which processes regdaemon.xml, but I see no reason why that should be failing.  As I said before, I think it would be best to open a Service Request.  Remote access would be helpful to dig into this problem in more detail.
    Please support CSC Helps Haiti
    https://supportforums.cisco.com/docs/DOC-8895
    https://supportforums.cisco.com

  • Best way to access JNDI configured DataSource from outside container

    I'm not sure if this is the right forum category, but it seemed like a good place to start.
    I have a DB2 database on an OS/390 mainframe that is configured as a JNDI datasource in WebSphere (WSAD) 5.1.x. I can get connections and do database transactions within my web-application just fine.
    Part of my project needs a cron managed stand-alone application to do some database clean up work. It essentially needs to query one database, and then based on the results stick some data into the DB2 database. Easy enough right?
    The issue here is that our Security department will not under any circumstances give us the passwords and users for either database. They give these only to the server admins who configure WSAD. We also can't use a properties file. The server admins either won't touch any properties file (it is considered "code" and they don't want to be responsible for problems) or they won't have access to the contents of the ears or jars we give them. This basically leaves us with our JNDI datasource as the only datasource we could access (because the admins will have it configured with a username and password). There is also no way to infer a valid username/password from the owner of the web-app since it will live on an NT box and the NT user won't have mainframe rights.
    There is also no possibility of bending these rules no matter how stupid or cumbersome they are.
    So my question is, what is the best method in which to gain access to this JNDI DataSource or a Connection from this DataSource? Can I even get a DataSource from a JNDI lookup? Is JMS/RMI or some other acronymn that I don't know about the only way to acomplish this?
    We're using Struts MVC -> Spring -> Hibernate in the webapp, if that helps.
    Thanks in advance.

    You seem to be asking: "how can a standalone app get a valid DB2 connection by leveraging the live objects in a WSAD application"?
    While this is pretty far from my area of expertise, I don't think you can. While both JMS and RMI (and other technologies) can export some types of Java objects, they have to be objects that implement the java.io.Serializable interface. Connections cannot be serialized because these objects (normally) encapsulate a live TCP/IP connection. I don't see any fundamental reason a DataSource object couldn't be serialized other than security, but that very reason means that no reasonable implementation is going to be serializable; if it were serializable, you could almost certainly extract the value of the username and password from the serialized object. In other words, what you're really trying to do is get around security and Java's security is probably robust enough to prevent it.
    If the DB credentials only live in the WSAD world, that's where the database work has to be done. However, there's no reason the work can't be driven by a servlet or JSP that is in turn invoked from a cron-driven script or application. Personally, I do such "event notifier" scripts in Perl; Java is a bit heavy for "start up, post to URL, shutdown", but if you have more work going on you could certainly use Java. If actually doing the work in the WSAD application is not acceptable, then you're probably stuck.

  • Accessing EJBs from a servlet

    Hi everyone,
    I deployed my EJB component in an Oracle 8.1.7 database and I try to access it from a servlet.
    If I run my servlet from JDeveloper 3.2 (Web-to-Go), it all works fine. If I run my servlet from JRun 3.01 or from Tomcat 3.2.1, I get the following exception:
    javax.naming.NoInitialContextException: Need to specify class name in environmen
    t or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.fillInStackTrace(Compiled Code)
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at javax.naming.NamingException.<init>(NamingException.java:104)
    at javax.naming.NoInitialContextException.<init>(NoInitialContextException.java:58)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:279)
    at javax.naming.InitialContext.lookup(InitialContext.java:349)
    at com.cognicase.framework.base.U0003.AbstractORB.getBean(AbstractORB.java:285)
    at com.cognicase.framework.base.U0003.AbstractORB.getBean(Compiled Code)
    at com.cognicase.demo.U2007BL.U2007WP_Users.lookupBean(U2007WP_Users.java:60)
    at com.cognicase.framework.is.U0103.AbstractBeanWrapper.beforeBeanCall(AbstractBeanWrapper.java:121)
    at com.cognicase.demo.U2007BL.U2007WP_Users.valideUser(U2007WP_Users.java:77)
    at com.cognicase.demo.U2000WB.U2000MW_WorkSpace.CallEjb(Compiled Code)
    at com.cognicase.demo.U2000WB.U2000MW_WorkSpace.doValidateLogin(Compiled Code)
    at com.cognicase.demo.U2000WB.U2000MW_WorkSpace.processService(U2000MW_WorkSpace.java:98)
    at Demo_0100_01.service(Demo_0100_01.java:128)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
    at org.apache.tomcat.core.Handler.service(Compiled Code)
    at org.apache.tomcat.core.ServletWrapper.service(Compiled Code)
    at org.apache.tomcat.core.ContextManager.internalService(Compiled Code)
    at org.apache.tomcat.core.ContextManager.service(Compiled Code)
    at org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConnection(Compiled Code)
    at org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled Code)
    at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code)
    at java.lang.Thread.run(Compiled Code)
    If I add my servlet classes, aurora_client.jar, mts.jar, vbjapp.jar and vbjorb.jar files to the CLASSPATH, it works fine.
    The behavior is the same in JRun and Tomcat.
    I don't like this solution since I have to make the CLASSPATH point to my application classes at the web server level instead of at the application context level.
    Has anyone been able to solve this problem?
    Thanks for your help.
    null

    Yes, I did. Actually, if I run my servlet in JDeveloper (Web-to-Go), it all works fine. I also extracted the code that calls the EJB from the servlet and I tested it in a small Java application, and it also works fine.
    Things stop to work when I deploy my servlet in JRun or in Tomcat.
    It appears that my code is correct, but the environment I try to run it is not, and I can't figure out what's wrong.
    Can anyone help me?
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Sandeep Desai ([email protected]):
    Have you provided the environmental settings in the servlet.
    It should be :
    import oracle.aurora.jndi.sess_iiop.ServiceCtx;
    env.put(Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
    env.put(Context.SECURITY_PRINCIPAL, username);
    env.put(Context.SECURITY_CREDENTIALS, password);
    env.put(Context.SECURITY_AUTHENTICATION, ServiceCtx.NON_SSL_LOGIN);
    InitialContext ctx = new InitialContext(env);
    Object obj = ctx.lookup("test/EJBHome");
    HomeObject home = PortableRemoteObject.narrow(
    obj,"HomeObject.class");
    RemoteObject remote = home.create();
    This should make it work!!
    <HR></BLOCKQUOTE>
    null

  • Frame access from servlet not working

    Dear all,
    I am running my servlets on Tomcat 5.5 and using JDK 1.6. I have a small program that uses codecs to access frames from a video file. PreAccessCodec implements Codec interface and PostAccessCodec extends PreAccessCodec. I set the two codecs into the processor's codec chain. The program is implemented as a thread and once started grabs frames and stores the images in a certain interval. The problem is this: whenever I start the thread from a main program, everything runs without a glitch. However, when I put the code in init() method of the servlet, I get the following error message:
    The input format is not compatible with the given codec plugin: com.mapper.utils.PostAccessCodec@69d02b
    Failed to realize: com.sun.media.ProcessEngine@1478a43
      Cannot build a flow graph with the customized options:
        Unable to add customed codecs:
          com.mapper.utils.PreAccessCodec@15356d5
          com.mapper.utils.PostAccessCodec@69d02b
    Error: Unable to realize com.sun.media.ProcessEngine@1478a43 I am using netbeans 5.5.1 to deploy my servlets. I doubt that the problem is with classpaths because the servlet doesn't complain when I am using JMF's classes like Processor.
    I would really appreciate any help.
    Thank you.
    Message was edited by:
    calculemus

    The GE.iH() method should return false for
    a ..head-full ..en-headed, not headless
    environment, and I expect (from what you
    reported above) that will return false for both
    your servlet and application, and is apparently
    not the problem.It returned false when I tried GE, and it was not the problem as you suggested. However, I now noticed in the logs:
    java.awt.HeadlessException
    I use Netbeans for the development, and I tried using -Dheadless=true and -Dheadless=false, it did not change anything...
    I think it is time to check that assumption
    more carefully.
    My impression is that PreAccessCodec and
    it's 'Post' equivalent are mentioned a lot in JMF
    example code, but are custom classes,
    built to suit the use at the time. Did you write the
    Pre/PostAccessCodecs for this app.?Yes I customized them from the JMF sample codes. They are in the classpaths and are correctly read by the servlet. I did some logging and I actually saw that the code inside Pre/PostAccess was logging when my servlet was run.
    >
    So, what I am thinking, is that while the JMF
    based Processor class may well be on the
    server's
    classpath, perhaps Pre/PostAccessCodec classes
    are not.
    oes a jar appear in the WEB-INF/lib directory,
    that contains the Pre/PostAccessCodec.class?
    Failing that, are the classes themselves in
    WEB-INF/classes/(sub-dir according to package name)/ ?Nevertheless, just to double check I checked WEB-INF directory and the classes appear correctly in their appropriate 'package-folders'.
    I figured out where exactly the thread was not running. In my PostAccessCodec class, I had overloaded getSupportedInputFormats() function to return RGB format.
    public Format [] getSupportedInputFormats() {
    Format [] fomats = {new RGBFormat()};
    return fomrats;
    When I changed it to return {VideoFormat()}, the codec initializes, but I get nothing when I want to access the frame.
    I guess I will have to start another thread.
    @moderators, please move the post if it is inappropriate to put it in this thread, my apologies.
    The problem is still there and I am not able to get the frame access not working from the servlet. :(
    Message was edited by:
    calculemus
    Message was edited by:
    calculemus

Maybe you are looking for

  • Can I get mor memory on my iPod Touch

    I am not sure

  • Do I need a .tdf if I have an iSeries .prtf defined?

    Hello I have created an overlay (.mdf) that simply has boxes and lines on it, no fields specified.   I have an iSeries print file that has been used to merge data onto this form in an old version of JetForms Server.   In JetForms, the JFMERGE slaps t

  • Oracle defaultNChar=true SLOW on NCHAR/NVARCHAR2

    Hi all, I am using a JDBC Prepared Statement with a bunch of parameters using setString(pos, value). The underlying columns on the tables are all NCHAR and NVARCHAR2. I have set the Oracle JDBC driver's "defaultNChar=true" so that Oracle DB would alw

  • Icloud app does not load when I open outlook

    I installed control panel & set it up for outlook. when I open outlook I have to manually start Icloud add in.  shows add in as inactive in "file"/ "options"/. I have uninstalled/re-installed icloud which hasn't made a difference.

  • Samsung CLP315 won't print after OS system update

    Hi, My CLP315 stopped working after an update to the prining system that was automatically applied. I have updated the firmware on the printer, tried replacement drivers, all to no avail. Deleted and re-added the printer a bunch of tmes, reset the pr