Calling ApplicationModule from a servlet (Standalone WL)

Hi,
I have to use a servlet call into my Oracle Fusion application (ADF Faces 11g)
Into the servlet I have to access the DB so I am calling the ApplicationModule as following:
String amDef = "hod.tasdeeq.workspace.service.TasdeeqServiceAM";
String config = "TasdeeqServiceAMLocal";
ApplicationModule am = Configuration.createRootApplicationModule(amDef,config);
ViewObject vo = am.findViewObject("CertifiedDocPDFVO");
It is working well using the embedded WL (Debug and Run).
After deploying the application to the standalone WL I have an exception when calling the servlet.
Seems a connection pool exception...
Any idea?
Thank you
Jamil
oracle.jbo.DMLException: JBO-26061: Error while opening JDBC connection.
     at oracle.jbo.server.ConnectionPool.createConnection(ConnectionPool.java:205)
     at oracle.jbo.server.ConnectionPool.instantiateResource(ConnectionPool.java:164)
     at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:589)
     at oracle.jbo.pool.ResourcePool.useResource(ResourcePool.java:322)
     at oracle.jbo.server.ConnectionPool.getConnectionInternal(ConnectionPool.java:100)
     at oracle.jbo.server.ConnectionPool.getConnection(ConnectionPool.java:66)
     at oracle.jbo.server.ConnectionPoolManagerImpl.getConnection(ConnectionPoolManagerImpl.java:52)
     at oracle.jbo.server.URLConnectionHelper.getConnection(URLConnectionHelper.java:129)
     at oracle.jbo.server.DBTransactionImpl.establishNewConnection(DBTransactionImpl.java:935)
     at oracle.jbo.server.DBTransactionImpl.initTransaction(DBTransactionImpl.java:1103)
     at oracle.jbo.server.DBTransactionImpl.initTxn(DBTransactionImpl.java:6275)
     at oracle.jbo.server.DBTransactionImpl2.connect(DBTransactionImpl2.java:131)
     at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:213)
     at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:561)
     at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:417)
     at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8470)
     at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4389)
     at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2385)
     at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2201)
     at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3085)
     at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:460)
     at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:431)
     at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:426)
     at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1398)
     at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1366)
     at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1338)
     at hod.tasdeeq.servlet.pdfServlet.doGet(pdfServlet.java:37) <---------------------------------------------------Servlet Call

Solution:
TasdeeqServiceAMLocal is not defined on the WLS
Need to use the Datasource application module defined on the server
String amDef = "hod.tasdeeq.workspace.service.TasdeeqServiceAM";
String config = "JNDI";<----------------------------
ApplicationModule am = Configuration.createRootApplicationModule(amDef,config);
ViewObject vo = am.findViewObject("CertifiedDocPDFVO");
Jamil

Similar Messages

  • Calling XSQL from java servlet

    I'm able to call XSQL, process the page, and display it. But, how do I set the stylesheet from within my java servlet.
    I tried params.put( "xml-stylesheet", "[path to sheet]" ), and then passing that to process(), but it just ignores it. I want to be able to set the stylesheet dynamicaly like when you call XSQL from the command line or from the XSQL servlet.
    XSQLRequest req = new XSQLRequest( xsql );
    Hashtable params = new Hashtable(2);
    params.put( "mths", "6");
    params.put( "run_id", "30");
    params.put( "grade", "A" );
    params.put( "xml-stylesheet", xsl ); <-- just seems to ignore this.
    ByteArrayOutputStream ostr = new ByteArrayOutputStream(2048);
    req.process( params, ostr, new PrintWriter(System.err) );

    Thanks for the help Steve (and thanks for a really nice book by the way.)
    To answer your first question, I have implemented a report caching servlet. In the application we're writing, reports are generated in HTML or PDF (using XSQL) on demand. However, the data really only changes once a day at most so I wanted to have a way to store the reports once they were generated. So this servlet basically gets the request for a report, checks to see if the report has already been generated and, if not, generates the report using XSQLRequest. Finally it returns the report to the user.
    One benefit to doing this is that it masks the generation process from the user (ie, they can just hit a link like http://somehost/path/to/report.pdf and they get a pdf report.) Of course the other benefit is that reports only need to be generated once, reducing server load.
    I will definitely try your suggestion and just redirect to the XSQL servlet. I guess I was thinking about it too hard, this is a simple solution which will probably address the problem with a minimum of fuss. ;o) Using XSQLRequest directly works, it's just that I want to be able to reference external images using relative paths... it's funny that relative references to XSL pages works though.
    Thanks again,
    Van
    null

  • Problem Calling JNI from a servlet

    Hi guys,
    How can I trace a C program called from a servlet using JNI ? The problem is a cant see the standard output of the C program because I call it from an applet, not from the console. I would preffer not to generate an error output from the C program, only see the text output this program outputs to the console.
    Thanks.

    Have you tried adding a pipe to the calling command?
    For example:
    Process p = Runtime.getRuntime().exec("myutil.exe > output.txt");
    p.waitFor();
    Once the program has finished, the output from the myutil.exe can be found in the file output.txt.
    HTH

  • Calling application from a servlet

    Hi,
    I am having trouble sending automated email messages from a servlet. Someone else in this office has had luck with getting an application to send email. I was wondering if my servlet could call the application .class file? It is possible for a servlet to call an application and if so how do I do it?
    Thanks

    // you need activation.jar in you class path
    // also note that your SMTP host may have to allow relaying from your
    / ip address
    import java.io.*;
    import java.net.InetAddress;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    * @author Scott Shaver
    * @version
    public class EMailMessage {
    private static String mailHost = null;
    private static String to = null;
    private static String subject = null;
    private static String from = null;
    private static String text = null;
    private static String cc = null;
    private static String bcc = null;
    private Vector attachments = new Vector(2);
    private boolean bodyIsHTML = false;
    /** Creates new Message */
    public EMailMessage() {
    /** Creates new Message */
    public EMailMessage(String to, String from, String subject, String text) {
    setTo(to);
    setFrom(from);
    setSubject(subject);
    setText(text);
    /** Creates new Message */
    public EMailMessage(String to, String from, String subject, String text, String host) {
    setTo(to);
    setFrom(from);
    setSubject(subject);
    setText(text);
    setMailHost(host);
    public void sendNoExceptions() {
    try
    send();
    catch(Exception x)
    public void send() throws AddressException, MessagingException {
    try
    Properties props = System.getProperties();
    props.put("mail.smtp.host", mailHost);
    MimeBodyPart msgTextBP = null;
    Multipart content = new MimeMultipart();
    Session session = Session.getInstance(props, null);
    javax.mail.Message msg = new javax.mail.internet.MimeMessage(session);
    if(from!=null)
    msg.setFrom(new InternetAddress(from));
    if(to!=null)
    msg.setRecipients(javax.mail.Message.RecipientType.TO,InternetAddress.parse(to, false));
    if(cc!=null)
    msg.setRecipients(javax.mail.Message.RecipientType.CC,InternetAddress.parse(cc, false));
    if(bcc!=null)
    msg.setRecipients(javax.mail.Message.RecipientType.BCC,InternetAddress.parse(bcc, false));
    if(subject!=null)
    msg.setSubject(subject);
    if(text!=null)
    msgTextBP = new MimeBodyPart();
    if(bodyIsHTML)
    msgTextBP.setContent(text, "text/html");
    else
    msgTextBP.setText(text);
    content.addBodyPart(msgTextBP);
    //msg.setText(text);
    msg.setHeader("X-Mailer", "EMailMessage");
    msg.setSentDate(new Date());
    int fac = attachments.size();
    for(int loop=0;loop<fac;loop++)
    File file = (File)attachments.elementAt(loop);
    DataSource source = new FileDataSource(file);
    MimeBodyPart bp = new MimeBodyPart();
    bp.setDataHandler(new DataHandler(source));
    bp.setFileName(file.getName());
    content.addBodyPart(bp);
    msg.setContent(content);
    Transport.send(msg);
    catch(AddressException ax)
    System.out.println("EMailMessage.send() AddressException");
    System.out.println(ax);
    ax.printStackTrace();
    catch(MessagingException mx)
    System.out.println("EMailMessage.send() MessagingException");
    System.out.println(mx);
    mx.printStackTrace();
    public void addAttachment(File a) {
    attachments.addElement(a);
    public void setMailHost(String host) {
    mailHost = host;
    public String getMailHost() {
    return mailHost;
    public void setTo(String to) {
    this.to = to;
    public String getTo() {
    return to;
    public void setSubject(String subject) {
    this.subject = subject;
    public String getSubject() {
    return subject;
    public void setFrom(String from) {
    this.from = from;
    public String getFrom() {
    return from;
    public void setBodyIsHTML() {
    bodyIsHTML = true;
    public void setText(String text) {
    this.text = text;
    public String getText() {
    return text;
    public void setCC(String cc) {
    this.cc = cc;
    public String getCC() {
    return cc;
    public void setBCC(String bcc) {
    this.bcc = bcc;
    public String getBCC() {
    return bcc;
    public static void main(String[] args) {
    /*EMailMessage m = new EMailMessage(
    "[email protected]",
    "[email protected]",
    "This is the subject of a test message.",
    "This is the text of the message.\nThis is another line.",
    "mail");
    try{
    m.send();
    catch(Exception x)
    x.printStackTrace();

  • How can I call EJB from JSP/Servlets in iWS?

    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

    Park,
    Why Are you running your JSP/Servlets in iWS instead of iAS? For whatever
    reason,
    look at the Converter sample from iAS. You will be doing RMI/IIOP in this
    case and the sample explains in detail what to do.
    hth,
    -robert
    "SungHyun, Park" <[email protected]> wrote in message
    news:9jpfmt$[email protected]..
    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

  • Calling JNI from my servlet

    Hai,
    I am using a servlet and I am calling the JNI method, but it is throwing an error like
    "java.lang.UnsatisfiedLinkError: check_file". (check_file is my JNI method.)
    I have checked the included header file name and function name, they are proper and correct. Can any one tell me some solution forthis problem. Thanks in advance.
    Bala

    Hai ,
    I found the solution for this query from jguru forum. I thought it will be helpful for persons like me, so i am posting it here. Consider the flg. example.
    All programs are under package "com.myprogram"
    MyServlet.java (My servlet program)
    GetInfo.java (My Java link program)
    GetInfofromCLib.c(My JNI interface program)
    MyServlet.java ---> Servlet that calls the get_info() native method of GetInfo.java
    ******GetInfo.java*****
    public class GetInfo
    public native void get_info();
    static{
    System.load("/usr/home/com/myprogram/mylib.so");
    so now if u create "javah -jni GetInfo"
    it will create the function name like
    Java_get_1info(JNIEnv*, jobject);
    but we need to rewrite this function name, so that it is representing the total path as
    Java_com_myprogram_get_1nfo(....);
    And also in the GetInfofromCLib.c we need to refer this way. Hope this will help others......
    Thanks,
    Bala....

  • Calling Oracle Reports from a servlet

    Hi
    I want use Oracle Reports to build reports
    and then call them from a servlet via a URL.
    How can i do this?
    Thanks
    Alexandre Baptista

    You can write a Java Stored Procedure that executes a Java
    Runtime object. This allows you to call an OS command. It's
    quite straightforward to do and you can find examples on this
    forum and on the AskTom site (among other places).
    With this Java built you ought (I haven't tried it myself) to be
    able to call run_product (or whatever the Reports runtime is
    these days) - providing it's on the same server as the
    database. I'm not sure whether you can use this java workaround
    to call OS commans on remote servers, although in principle I
    don't see why not.
    Try it and let the forum know how it works.
    HTH, APC

  • Calling JBean from Servlet

    Have a java bea located at \web-inf\classes\mybeans called UserData.java
    And would like to call it from my servlet to pass data located at \web-inf\classesHow would I do that?

    If your using webLogic server, then the below link may help you.
    http://edocs.bea.com/workshop/docs81/doc/en/core/index.html

  • How to invoke a OSB Proxy Service from a Servlet??

    Hi!!
    I'm a begginer in OSB, and right now I have a OSB configuration in production mode. So, using the console test it's very easy to test (doh) my configuration. But now, I have to make a stress test and after read a lot of documentation I did'nt found the way to do that. So I'm trying to do it by using a Servlet, a doPost method in especific, but after a lot of time I can't invoke the proxy service.
    What is the right way to use a proxy service in production mode??
    How can I call it from my servlet??
    How can I send an xml (or any other object, file, text...) as a Request??
    Help please, thank you...
    Edited by: user12116998 on 18-mar-2010 12:40

    If you have your proxy service published as http/soap, then I recommend you to use SoapUI to test it. It can help you with stress test too.

  • Calling an EJB 3 SessionBean from a servlet in a Standalone oc4j instance.

    I think that this should be simple, but for some reason can't get it to work.
    Latest version of jDev and oc4j, running on Linux Fedora 5.
    In a jdev application I have ejb and web projects. **EJB 3.0**
    The ejb project is deployed first, then the web project -with the ejb project as its parent-.
    In the ejb project I have a FacadeBean (SLSB) that implements both remote and local as well as Serializable interfaces. (Do I need to implement Serializable?)
    Question:
    How do I get the handle on the FacadeBean from the servlet?
    I tried:
    ic = new InitialContext();
    facade = (Facade)ic.lookup("java:comp/env/ejb/Facade");
    as well as numerous other variations including remote/local stubs, long and short ejb names, facade.getClass().getName, but they all fail!
    This should be simple (if not genned automatically by jDev!) !
    Please advise.
    Thank you.
    nat

    One way of getting the code to do this is to right click on your session bean in JDeveloper and choose "New sample Java Client", then "Connect to a remote OC4J" etc...
    This will create a piece of code that you can then use in your servlet to locate the EJB and invoke it.
    Here is a sample Servlet code:
    public class Servlet1 extends HttpServlet {
        private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
        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();
            out.println("<html>");
            out.println("<head><title>Servlet1</title></head>");
            out.println("<body>");
            out.println("<p>The servlet has received a GET. This is the reply.</p>");
            try {
                final Context context = getInitialContext();
                SessionEJB sessionEJB = (SessionEJB)context.lookup("java:comp/env/ejb/SessionEJB");
                // No Remote methods found
            String a = sessionEJB.sayHi("joe");
            out.println(a);
            } catch (Exception ex) {
                ex.printStackTrace();
            out.println("</body></html>");
            out.close();
        private static Context getInitialContext() throws NamingException {
            Hashtable env = new Hashtable();
            //  Standalone OC4J connection details
            env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.naming.ApplicationClientInitialContextFactory" );
            env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
            env.put( Context.SECURITY_CREDENTIALS, "welcome" );
            env.put(Context.PROVIDER_URL, "ormi://localhost:23791/ejb1");
            return new InitialContext( env );
    }

  • How can I deploy a simple stateless ssion EJB and call it from a standalone client

    Hi,
    I'm creating s simple staless session EJB that has a method that takes a name and prints "Hello" + name. This EJB is in a package called "com.demos.mydemo.ejbs.hello"
    How can I deploy this to OC4J?
    How can I call it from a standalone client(no JSP, no servlets)?
    In Sun's J2EE is very easy to deploy and I don't have to know any XML stuff.
    can I use the .ear file created by the Sun's "deploytool" to deploy my EJB to OC4J?
    This is the code at I'm using and it works on Sun's j2sdkee1.2.1:
    ///////// Remote /////////
    package com.demos.mydemo.ejbs.hello;
    import java.rmi.RemoteException;
    import javax.ejb.EJBObject;
    public interface Hello extends EJBObject {
    public String sayHello(String name) throws RemoteException;
    ///////// Home //////////
    package com.demos.mydemo.ejbs.hello;
    import java.rmi.RemoteException;
    import javax.ejb.EJBHome;
    import javax.ejb.CreateException;
    public interface HelloHome extends EJBHome {
    public Hello create() throws CreateException, RemoteException;
    /////////// Bean class ///////////
    package com.demos.mydemo.ejbs.hello;
    import java.rmi.RemoteException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import javax.ejb.CreateException;
    import javax.ejb.EJBException;
    import java.sql.Connection;
    import java.sql.SQLException;
    //import java.sql.PreparedStatement;
    import javax.sql.DataSource;
    import javax.naming.NamingException;
    import javax.naming.InitialContext;
    public class HelloEJB implements SessionBean {
    private SessionContext context;
    private Connection con;
    private String dbName =
    "java:comp/env/jdbc/Oracle";
    public HelloEJB() {}
    public void setSessionContext (SessionContext context) {
    this.context = context;
    public void ejbCreate() throws CreateException {
    try {
    makeConnection();
    catch (Exception e) {
    System.err.println("HelloEJB: exception in ejbCreate:" + e.getMessage());
    e.printStackTrace();
    throw new CreateException(e.getMessage());
    public void ejbActivate() {
    public void ejbPassivate() {
    public void ejbRemove() {
    try {
    con.close();
    catch (SQLException ex) {
    throw new EJBException("HelloEJB: exception in ejbRemove: " + ex.getMessage());
    public String sayHello(String name) {
    return "Hello " + name;;
    private void makeConnection() throws NamingException, SQLException {
    try {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup(dbName);
    con = ds.getConnection();
    catch (Exception e) {
    System.err.println("HelloEJB: exception in makeConnection:" + e.getMessage() );
    e.printStackTrace();
    //////////// EJB client that uses a stateless session bean
    package com.demos.mydemo.ejbs.hello;
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    public class HelloClient {
    public static void main(String[] args) {
    try {
    Context initial = new InitialContext();
    Object objref = initial.lookup("HelloSession");
    HelloHome home = (HelloHome)PortableRemoteObject.narrow(objref,HelloHome.class);
    Hello h = home.create();
    String msg = h.sayHello("John Doe");
    System.out.println(msg);
    //h.remove();
    } catch (Exception ex) {
    System.err.println("Caught an exception." );
    ex.printStackTrace();
    Thanks
    Nabil
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Nabil Khalil ([email protected]):
    I deployed and .ear file created by Sun's J2EE deployment tool on the OC4J. It looks that it was deployed fine -- did not get a deployment error.
    When I run the client I'm getting the following error: Caught an exception.
    javax.naming.CommunicationException: Can't find SerialContextProvider
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:60)
    at com.sun.enterprise.naming.SerialContext.<init>(SerialContext.java:79)
    at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:54)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
    at javax.naming.InitialContext.init(InitialContext.java:222)
    at javax.naming.InitialContext.<init>(InitialContext.java:178)
    at com.equifax.fms.ejbs.hello.HelloClient.main(HelloClient.java:18)
    This makes me think that the client can't see the deployed EJB on the OC4J.
    How can I fix this problem?
    Thanks
    Nabil
    <HR></BLOCKQUOTE>
    Nabil -
    Your standalone client needs to obtain certain server-dependent properties. You can provide them in your code or grab them via a properties file.
    For Orion - you need essentially the following setup, filling in your own information...
    Define your standalone client class with "main" etc (this is orion specific - should work for 9i AS as well - perhaps there are some differences)
    public class SomeClass {
    try {
    Properties p = new Properties();
    p.setProperty("java.naming.factory.initial",
    "com.evermind.server.ApplicationClientInitialContextFactory");
    p.setProperty("java.naming.security.principal","server_admin_name");
    p.setProperty("java.naming.security.credentials","server_password");
    // THEN you can get your intitial context reference
    InitialContext initial = new InitialContext (p);...........
    Then go about your business.....
    A good book to get is called "Professional Java Server Programming J2EE Edition" - there happens to be a reasonable amount of Orion/OCJ4 centric information since one of the authors is Karl Avedal - one of the principals behind Orion. Go out to java.sun.com and look at some of the J2EE tutorials - unfortunately a lot of it is hidden behind the J2EE Deployer, but you will get a good sense of what goes into outside-the-container standalone clients.
    null

  • Calling class from servlet gives 500

    I have a servlet that works fine by itself, and another class that works fine by itself. However, when I try to create a new instance of the class using the servlet and access a method in the class such as:
    Servlet code
    Object a = new Object()
    a.method
    the server returns 500.
    Is there some security aspect to calling classes from servlets that may be causing this?

    Thanks for the replies which have tracked the problem down.
    The Server log says:
    NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
    This class is needed by the class being called by the servlet.
    The missing class is in a jar file which is put on the classpath when running the class in a standalone environment. I don't know if it's possible to put this jar on the classpath in the Server environment.
    However a solution is to explode the jar file and put the exploded classes in the WEB-INF/classes of the Server. The only disadvantage is that they get wiped out every time I re-deploy the application war file.

  • How to call a specific method in a servlet from another servlet

    Hi peeps, this post is kinda linked to my other thread but more direct !!
    I need to call a method from another servlet and retrieve info/objects from that method and manipulate them in the originating servlet .... how can I do it ?
    Assume the originating servlet is called Control and the servlet/method I want to access is DAO/login.
    I can create an object of the DAO class, say newDAO, and access the login method by newDAO.login(username, password). Then how do I get the returned info from the DAO ??
    Can I use the RequestDispatcher to INCLUDE the call to the DAO class method "login" ???
    Cheers
    Kevin

    Thanks for the reply.
    So if I have a method in my DAO class called login() and I want to call it from my control servlet, what would the syntax be ?
    getrequestdispatcher.include(newDAO.login())
    where newDAO is an instance of the class DAO, would that be correct ?? I'd simply pass the request object as a parameter in the login method and to retrieve the results of login() the requestdispatcher.include method will return whatever I set as an attribute to the request object, do I have that right ?!!!!
    Kevin

  • How to call a servlet from another servlet

    hi everybody,
    i have a problem, i have to call one servlet from another one.
    Everything works on my pc, but when i install the application on the customer's server i got an error about an Uknown URL followed by the name of the machine.
    Wjat i do is the folloqing :
    String urlString = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+servletName;
    URL url = new URL(urlString);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    the variable servletName is the name of the servlet i have to call.
    Is there another way to call the servlet ?
    All the servlet are installed in the same server.
    Any suggestion ?
    Cheers.
    Stefano

    Sweep is correct about requestDispatcher being another approach for inter-servlet delegation; the only issue that i recall with this approach is that it defaults the method of the destination servlet to the one it was called from...for example, calling servlet2 from within servlet1.post() resulted in the dispatcher attempting to utilize servlet2.post() - i believe that i searched for a parameterize solution to no avail :( (ended up handling the request by placing a "fake" doPost() in servlet2 that simply called servlet2.doGet())
    however, if your application is functioning correctly on your pc/webserver then the problem may be external to servlet communication (e.g. client webserver's ports not configured or blocked, missing runtime classes, etc.)
    my suggestion would be to set aside the programmatic concerns for the moment - what is the response if you open a browser on a client's machine and access the URL in question (i.e. http://clientserver:port/stefanoServlet)? If it will not respond to access in this manner then it certainly won't when your application calls for it.
    It's possible that there is a coding error but, given the info supplied, i'd start examining the environment, first. Let us know if you have any luck with the test i recommended or not (please provide abundant detail). Or, if you've found the solution then you may want to post back with a quick blub so the next person knows how to escape the trap.
    D

  • How can I call an ".asp" from a Servlet?

    I want to make a call to an asp page from my servlet. If i use the conventional way of doing it as follows:
    RequestDispatcher rd = getServletContext().getRequestDispatcher("http://localhost:8080/abc.asp");
    rd.forward(request, response)
    It gives me IllegalArgumentException saying that the "Path must be absolute". And if i give the relative path like
    RequestDispatcher rd = getServletContext().getRequestDispatcher("/abc.asp");
    rd.forward(request, response)
    In this case it takes me to the asp page, but gives some ClassNotFoundException - images.
    I do not understand what class it is looking for and where to get that?
    So Why am i not able to call an ASP from Servlet, Any clue??

    What are you trying to accomplish? A redirect is one of the only ways to successfully go from a Servlet to an ASP. For example:response.sendRedirect("http://server:9090/abc.asp?name=value");This is mainly because when you forward, your actually sending the request and response objects under the current servlet context to be processed by another JSP/servlet in the same (sometimes cross) context.
    When interacting with ASP's your actually communicating between web containers (one which is Java based the other VB based).
    When you use:RequestDispatcher rd = getServletContext().getRequestDispatcher("http://localhost:8080/abc.asp");
    rd.forward(request, response) Your telling the servlet to send it's contents outside the web container where they cannot exist as such (even though you are pointing to your own JSP server, it's the "http://" that makes it assume your trying to get out).
    Using: RequestDispatcher rd = getServletContext().getRequestDispatcher("/abc.asp");
    rd.forward(request, response) is fine but what is processing your asp in your Java Web Server?
    The best way to mix JSP/Servlets with ASP (in my opinion others may debate it if they please) is using messaging like XML. Trying to share sessions between ASP and Java is quite messy and to much effort for a 1 to 1 communication option.
    Back to an earlier question, what is processing your asp files in the Java web server? If you have something processing them (like ChilliSoft) then check the docs to see if it supports session sharing between JSP/Servlet - ASP.
    Anthony

Maybe you are looking for

  • Partitioned IOT of Object Type - mapping table not allowed for bitmap index

    Hi, looks like a feature available for standard Partitioned IOTs is not supported for object based tables, namely the MAPPING TABLE construct to support secondary local bitmap indexes. Can you confirm behaviour is as expected/documented? If so, is a

  • HT1386 Sync does not transfer data to Outlook

    When I sync my iPhone with Outlook updates already on Outlook are transferred to the iPhone but updates on the iPhone are never transferred to Outlook.  Why please?

  • XToolKit excessive logging

    Hello, I am on a RedHawk 4.1.5 box using Java 1.5.0_10. We are using the Java logger with a logging level set to FINEST. In the log created we see user specified log messages but we also see: sun.awt.X11.XToolKit callTimeoutTasks FINER: XToolkit.call

  • Discounting line inventory items in Web Customer

    I have implemented field sales on line for opportunity management and contacts. I am using Web Customer to generate quotes which are then pushed through to OE. Web Customer does not allow discounting of line items. Has anyone figured out how to disco

  • Clustered role 'Cluster Group' has exceeded its failover threshold.

    Hello. I’m hoping to get some help with a cluster issue I’m having using Windows Storage Server 2012. When the cluster is created my Cluster Core Resources are all happy and online. I can more the Cluster Name using “move Core Cluster Resources” betw