Application vs. Servlet

I have an application that parses an XML file whose URL is received as a parameter.
I have created a servlet that calls this application. I changed the main methods to callable "public void MethodName()". The servlet needs to call one class and then another. It will call the first class, but throws this error when attempting to call the second:
[Servlet Error]-[com/ibm/etools/xmlschema/beans/BaseType]: java.lang.NoClassDefFoundError: com/ibm/etools/xmlschema/beans/BaseType
Why would this class work in an application and not in a servlet??
Application code:
BeFreeRequestSAXParser.java
- this runs and then calls XMLDataParser.java
- XMLDataParser dp = new XMLDataParser();
dp.loadExistingInstance( uri.toString()); (Works great)
Serlvet code:
CustomersAlsoPurchased.java
- this calls BeFreeRequestSAXParser (works fine)
- BeFreeRequestSAXParser tries to call XMLDataParser but does not
work.
Any suggestions?

[Servlet
Error]-[com/ibm/etools/xmlschema/beans/BaseType]:
java.lang.NoClassDefFoundError:
com/ibm/etools/xmlschema/beans/BaseTypeIn general servlet containers use a modified class loader hierachy, you should consult the documentation of your servlet container. This matters, because you have to make sure any extra classes are made available when they are not part of the jdk or the container itself.
With tomcat you either have to place them in the folder shared by all contexts or in the WEB-INF/lib, or figure out another way.
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

Similar Messages

  • How application call servlet via https

    Hi guys
    Does anybody know how application call servlet via https? Is it same as
    http? How can I set up trusted certification? Thanks in advance.
    Regards,
    Mark.

    I meant to give a code example in the last one, sorry.
    URL u = new URL("https://mysecureURL.com");
    javax.net.ssl.HttpsURLConnection conn = (javax.net.ssl.httpsURLConnection) u.openConnection();There is other good info in the JSSE forums.
    Cheers,
    Peter.

  • Terminate web application from servlet

    It will be very helpful to me if any one found me the solution for the following.
    How can i terminate web application from servlet and also i want to close the browser window immediately from servlets?

    How can i terminate web application from servletWhat do you mean by this?
    also i want to close the browser window immediately
    from servlets?The servlet can't close a browser window, but could send back client code that closes it (i.e. JavaScript as part of an HTML page).

  • Urgent:Please Help. Need to deploy web application with servlet:(

    Tomcat 4.0 is already installed.
    Trying to deploy a web application and invoke a servlet through it.
    Here is the command I am using for deploying the application:
    http://localhost:8080/manager/install?path=/NewApplication&war=file:d:\Tomcat4\webapps\NewApplication
    The application get deployed. However, I have a problem. As soon I stop and restart the server, this application is gone.
    1. Please someone help: How should I make it permanent so that the application stays even if I restart the server.
    2. I am not able to access the servlets placed in the /WEB-INF/classes/ sub-directory under NewApplication directory.
    If you need I can cut and paste the web.xml file which will show the deployment descriptor.
    Please help: How do I make this work. I need it urgent.
    Any help will be appreciated.
    Thanks,
    Indrasish.

    The simplest solution would be to put the war file inside the webapps directory and restart the server. You should be able to access the app using the http://servername/app

  • Calling java application from servlet using servletexec servlets

    We are using servletexec 3.0,IIS 5.0, sun Java SDK 1.3.1_12.
    I have a servlet which works fine. This servlet is being called from the submit of the form in a html file.
    It works fine.
    But now i have to use a third party credit card application from my servlet.How can i do that.
    I have added the third party jar files in the classpath of servletexec.
    How can i use their methods.
    Please let me know.

    Something like this ?
    import thirdparty.*;
    import javax.servlet.http.*;
    public class MyServlet extends HttpServlet {
      public void doGet(HttpServletRequest request, HttpServletResponse response) {
        ThirdPartyClass t = new ThirdPartyClass();
        t.someMethod();
    }

  • Calling Java application from servlet

    Hi !
    I'm trying to run a Java application from within a servlet with Tomcat 4. I'm using the Runtime.getRuntime ().exec () method. So the application is run in a different JVM as a subprocess of the servlet. I use ObjectInputStream and ObjectOutputStream and a serializable object to enable communication between the servlet and the application.
    I tested the application and the serializable object with another Java application that works as the caller and it works fine. However, replacing the caller application with the servlet I get a StreamCorruptedException. The structure of the caller application and the servlet is the same.
    My questions are:
    - Is there something I should configure in Tomcat to create a subprocess ?
    - What is the cause of the StreamCorruptedException ? How do I get it with the servlet and not with the application ?
    - Should I use an environment with the call to Runtime.getRuntime ().exec () ? How do I use it ?
    - Is the called application forced to run in my servlet's context ?
    - Is there a better way to do this ?
    Thanks to all

    Here's my code:
    1. The serializable object:
    // Object Obj
    import java.io.*;
    public class Obj implements Serializable
    public int n;
    public Obj ()
    n = 0;
    public Obj (int n)
    this.n = n;
    public String toString ()
    return getClass ().getName () + " -> (n = " + n + ")";
    2. The application Sub (subprogram)
    // Application Sub
    import java.io.*;
    public class Sub
    private static File f;
    private static FileWriter fw;
    public static void main (String [] args)
    throws IOException, InterruptedException, ClassNotFoundException
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj;
    ois = new ObjectInputStream (System.in);
    obj = (Obj) ois.readObject ();
    f = new File ("Sub.txt");
    fw = new FileWriter (f);
    fw.write (obj.toString ());
    fw.close ();
    oos = new ObjectOutputStream (System.out);
    oos.writeObject (obj);
    ois.close ();
    oos.close ();
    3. The application AMain (caller application)
    // Application AMain
    import java.io.*;
    class AMain
    private static File f;
    private static FileWriter fw;
    public static void main (String [] args)
    throws IOException, ClassNotFoundException
    Runtime r;
    Process p;
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj, obj2;
    r = Runtime.getRuntime ();
    p = r.exec ("java Sub");
    oos = new ObjectOutputStream (p.getOutputStream ());
    obj = new Obj (5);
    oos.writeObject (obj);
    oos.flush ();
    B.comunica (obj);
    System.out.println ("AMain sends to Sub: " + obj.toString ());
    try
    p.waitFor ();
    catch (InterruptedException e)
    System.out.println ("Subprogram was interrupted");
    System.out.println (e.toString ());
    ois = new ObjectInputStream (p.getInputStream ());
    System.out.print ("Sub sends to AMain: ");
    obj2 = (Obj) ois.readObject ();
    System.out.println (" " + obj2.toString ());
    oos.close ();
    ois.close ();
    p.destroy ();
    4. The servlet SMain (the calling servlet)
    // Servlet SMain
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class SMain extends HttpServlet
    public void doPost (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    Runtime r;
    Process p;
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj, obj2;
    int state, i;
    res.setContentType ("text/html");
    ServletOutputStream out = res.getOutputStream ();
    out.println ("<html>");
    out.println ("<head><title>Sub</title></head>");
    out.println ("<body>");
    out.println ("Invoking subprogram...");
    out.println ("<br>");
    try
    r = Runtime.getRuntime();
    p = r.exec ("java -cp .;c:\\Programs\\Apache~1.0\\webapps\\SMain\\WEB-INF\\classes Sub");
    out.println ("...invoked<br>");
    oos = new ObjectOutputStream (p.getOutputStream ());
    obj = new Obj (5);
    oos.writeObject (obj);
    oos.flush ();
    out.println ("<br>SMain sends to Sub: " + obj.toString () + "<br>");
    try
    p.waitFor ();
    catch (InterruptedException e)
    out.println ("<br>Subprogram was interrupted<br>");
    out.println ("<br>" + e.toString () + "<br>");
    state = p.exitValue ();
    out.println ("<br>Subprogram state: " + state + "<br>");
    ois = new ObjectInputStream (p.getInputStream ());
    out.print ("<br>Sub sends to SMain: ");
    obj2 = (Obj) ois.readObject ();
    p.destroy ();
    catch (SecurityException e)
    out.println ("<br>SecurityException<br>");
    out.println ("<br>" + e.toString () + "<br>");
    catch (IOException e)
    out.println ("<br>IOException<br>");
    out.println ("<br>" + e.toString () + "<br>");
    catch (Exception e)
    out.println ("<br>Exception<br>");
    out.println ("<br>" + e.toString () + "<br>");
    out.println ("</body>");
    out.println ("</html>");
    So, as you can see, both application AMain and servlet SMain invoke application Sub and pass it the serializable object Obj. Oddly enough, application AMain works fine whereas servlet SMain throws a StreamCorruptedException exception.
    johnpoole said:
    �It's hard to guess what would cause the exception without seeing code, but the interaction between the processes would differ from that between two applications, because the servlet process is started with a different class loader. I'm not sure which one the jvm started by the call would use.�
    How can I enforce that a System classloader be used in the call to Runtime.getRuntime ().exec () ? (I mean by System classloader a classloader equals to the one applications are launched from console).
    johnpoole said
    �Is there a reason why you aren't starting the second process manually and then connecting to it on a port?�
    The idea is providing a Web interface for an application running in the server. The servlet is used to restrict access to this application but once access is granted (passing the servlet) the application should not be constrained.

  • Make some functionality at the time of deploying application(jsp/servlet)

    Hi Experts,
    I want to know that, Suppose when ever I am deploying my application or initlizing jsp/servlet page. That time I want to do some operation take example : "At the time of deploying application I want to delete .temp files".
    So what ane where I want to write some functionality.
    If I have to write in xml then in wich tag..?
    And if in servlet/jsp page then where..?
    Thanks in Advance

    You don't program such things. You could use a tool like ANT to do the deployment for you and at the same time you can configure a cleanup task.

  • Forms6i application as servlet on Ias 9i

    What steps do I have to take to put my Forms6i application (test.fmx) on Ias9i as a Servlet?
    thanks

    Go to otn.oracle.com/products/forms and then click on the link for Internet deployment.
    You can then read the paper on the current 6i patch which tells you how to deploy as the Forms Listener Servelet
    Regards
    Grant Ronald
    Forms Product Management

  • Building a simple email application using servlet

    i'm having problem with my codes. actually,i'm using james(java apache mail enterprise server) as my transport agent. my problem is linking james with my java compiler(Netbean 4.1).my main class is a servlet class.my application is suppose to receive,delete,forward,compose mail messages. if u have a good experience in this,please could u send a sample code to me so as to know where i'm actually wrong. I need this to see a different view 2 my implementation.
    thanks

    Hi there
    I'm having the same problem. I'm using Netbeans 5.0 with the mobility pack. My version of JDK is 1.5.0_02.
    I include the jxme-cdc.jar file to the project but when I try to run the application I get:
    Error preverifying class net.jxta.id.ID
    java/lang/NoClassDefFoundError: java/io/Serializable
    Have you figured out how to resolve this???

  • Using the Survey Application with Servlets

    I installed Survey application which demonstrate the servlet
    architecture.
    The application works well with Jdevelopper 2.0
    The connection with the database server works.
    I installed the Sun Java Web Server 1.1.3 on my PC.
    The Java Web administrator works fine. I registered the 2
    servlets on the administrator but the JDBC connection failed.
    I obtained this resulting error page when try to use the
    SDSessionServlet
    500 Internal Server Error
    The servlet named "oracle.jdbc.driver.OracleDriver", at the
    requested URL
    http://gvawsgcf:8080/servlet/SDSessionServlet
    reported this exception:
    oracle.jdbc.driver.OracleDriver
    The administrator of this web server should resolve this problem.
    What shall I do?
    Thanks in advance
    null

    Hi
    JDeveloper online help system has examples of configuring JavaWeb
    server.
    Goto Help system.
    In the "tutorials" book you will find a subtopic "Servlet
    Tutorial" which has help on configuring java web server.
    The other place is in the "Sample Applications" book you will
    find a sub topic "web application for Oracle 8i" which has help
    on deploying the servlet to java web server.
    You will find these examples useful in configuing your env.
    regards
    Chris tournier (guest) wrote:
    : I installed Survey application which demonstrate the servlet
    : architecture.
    : The application works well with Jdevelopper 2.0
    : The connection with the database server works.
    : I installed the Sun Java Web Server 1.1.3 on my PC.
    : The Java Web administrator works fine. I registered the 2
    : servlets on the administrator but the JDBC connection failed.
    : I obtained this resulting error page when try to use the
    : SDSessionServlet
    : 500 Internal Server Error
    : The servlet named "oracle.jdbc.driver.OracleDriver", at the
    : requested URL
    : http://gvawsgcf:8080/servlet/SDSessionServlet
    : reported this exception:
    : oracle.jdbc.driver.OracleDriver
    : The administrator of this web server should resolve this
    problem.
    : What shall I do?
    : Thanks in advance
    null

  • Invoking an excel application through servlet

    Hello Everyone,
    I need to display the o/p in an excel sheet. I can do that but still i have some questions with me. Can you plz help me in this regard?
    1> I want to open a new excel application itself instead of displaying the o/p in the browser in an excel format.
    2> I want the o/p in a formatted way i.e. increasing the cell width, height, and inserting some break points in the content.
    I will be very greatfull if you send me some URL's related to this.
    Thanks,
    babloo.

    Hello,
    Is every one busy or no one intrested to help me?
    This is my Code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class ExcelOp extends HttpServlet
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
         HttpSession session = request.getSession();
         String Db_Server = (String)session.getAttribute("Db_Server");
         String Ap_Server = (String)session.getAttribute("Ap_Server");
    response.setContentType("application/vnd.ms-excel");     
         PrintWriter out = response.getWriter();
         out.println("SNo.\tServer Name\tServer Configuration");
         out.println("1\tDatabase Server\t"+ Db_Server + " " + "X 1.7 GHz Power 4+ (Silicon On Insulator and copper) ");
    It just prints the O/p in an excel sheet opened in a browser. I can only jump to next cell by using '\t' character. My question is how could I go to below cell or to the desired location and how could I increase the Cell width and height.
    Eagerly waiting for your reply.
    Thanks,
    babloo

  • Updater desktop application via servlet

    Hello
    I am having a desktop application an i want to write an updater to download new versions of application.
    Is it possible to do that with help of o servlet? Because i want the user to send same informantions to certificate to the server and then if it is ok to download the new version of the application or the jars that have change automaticaly.
    Any other suggestion about this?

    Yep, that should work ok, but you will have 2 types of updates to do:
    1-update of your application, not a problem from your updater
    2-updating your updater
    You are going to run into a problem having your updater running and trying to update it, you cannot replace/delete a file that is already open, so here you'll have to go with a shutdown/startup replacement method.

  • Calling Java - Client application Through Servlet/JSP/HTML

    Hi,
    I have a Java Client Application to display presentation(BI Bean) , made thru wizard provided in JDev.
    Now i want to open this application from a link in HTML page.
    I am running the application thru J Developer only.
    please help,
    thanks,
    Vaibhav

    Hi,
    Thanx for ur help..
    My application is a JSP one..
    My J Client application is named :-
    BIApplication1.java.
    When i call it thru JSP..
    BIApplication1 bi=new BIApplication1();
    bi.setSize(800, 620);
    bi.setVisible(true);
    the application opens..
    but when i attempt to open a presentation..
    it give me the following error..
    "no configuration file found"
    but when i open BIApplication independently..it works just fine...
    thanks,
    Vaibhav

  • Manipulating JDBC Datasources from a java application or servlet

    How can i manipulate - add, delete, update - JDBC Datasources from a java applcation or servlet?

    Maybe we can help, if you explain a little more.
    What do you mean with:
    How can i manipulate - add, delete, update - JDBC
    Datasources from a java applcation or servlet?Do you want to
    * create databases
    * change a database's properties
    * create or change tables
    * create or change the rows in tables
    Each of these would be - more or less - possible, but on its own way.
    Or do you maybe want to configure ODBC Datasources (DSNs) for use with the JDBC-ODBC-Bridge?
    Thats all I can guess from what you told us. Tell more!

  • How to create a servlet  in PAR Application

    Hi Experts,
    I want to create a servlet in PAR application. This servlet should be capable of accessing the functions of other java files included in PAR Application. Servlet should be capable of accessing the functions say doContent(req, resp) of any class of PAR application.
    Is it possible to create Servlet in PAR application?
    I created one servlet but unable to declare its information in Deployment Descriptor.
    Because the deployment which is provide ie portalapp.xml doesnt allow us to write tags like <servlet-name>, <servlet-mapping>, <url-pattern> etc. These are necessary for declaration of servlet.
    So how can i write a complete working Servlet under PAR application?
    Please help and replies will be appreciated.

    Hi,
    Depending upon your usecase there are different ways to implement this logic.
    Check this for example (Read my answer in this post):
    https://forums.sdn.sap.com/thread.jspa?threadID=349151
    Also check these senarios:
    http://help.sap.com/saphelp_nw70/helpdata/en/42/9ddf20bb211d72e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/42/9ddcc9bb211d72e10000000a1553f6/frameset.htm
    Also the delegation may be interesting for you:
    http://help.sap.com/saphelp_nw70/helpdata/en/a0/44b742cafec96ae10000000a155106/frameset.htm
    Greetings,
    Praveen Gudapati

  • Connecting to Remote EJB from Servlet in same application

    Please help!
    I was able to connect to SessionBeans and EJB from my sample java client in OCJ4 but when I try to do same thing from my web application using servlets, I get the below NullPointerException error.
    The JNDI lookup works fine using java client but difficult from a servlet.
    I am sure there is something I am missing.
    Thanks
    This is what I do in the servlet:
    public void init() throws ServletException, NamingException, CreateException, RemoteException
    Context jndiContext = getInitialContext();
    SessionCartEJBHome home = (SessionCartEJBHome)jndiContext.lookup("SessionCartEJBBean");
    sessionEJB = null;
    try{
    sessionEJB = (SessionCartEJB) home.create();
    }catch (Exception e)
    e.printStackTrace();
    private static Context getInitialContext() throws NamingException
    Hashtable env = new Hashtable();
    // Standalone OC4J connection details
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "admin");
    env.put(Context.PROVIDER_URL, "ormi://Princeton/ejb1");
    return new InitialContext(env);
    And when I call the following procedure, it blow up at the line sessionEJB.getLineItem(new Long(1304));
    sessionEJB is a class variable.
    void processCatalogPage(HttpServletRequest request,
    HttpServletResponse response,
    ActionMapping mapping,
    HttpSession session
    throws ServletException, IOException , Exception, FinderException{
    try {
    ActionForward actFor = null;
    String itemId = request.getParameter("id");
    if ( itemId != null ) {
    String[] itemIds = new String[1];
    itemIds[0] = itemId;
    sessionEJB.getLineItem(new Long(1304));
    actFor = mapping.findForward("catalog");
    return (mapping.findForward("success"));
    } catch (Exception ex)
    ex.printStackTrace();
    System.err.println(ex.toString());
    throw new EJBException(ex.toString());
    04/12/11 23:45:24 java.lang.NullPointerException
    04/12/11 23:45:24 at com.alashoofi.Cart.processCatalogPage(Cart.java:187)
    04/12/11 23:45:24 at com.alashoofi.Cart.execute(Cart.java:86)
    04/12/11 23:45:24 at org.apache.struts.action.RequestProcessor.processActi
    onPerform(RequestProcessor.java:484)
    04/12/11 23:45:24 at org.apache.struts.action.RequestProcessor.process(Req
    uestProcessor.java:274)
    04/12/11 23:45:24 at org.apache.struts.action.ActionServlet.process(Action
    Servlet.java:1482)
    04/12/11 23:45:24 at org.apache.struts.action.ActionServlet.doGet(ActionSe
    rvlet.java:507)
    04/12/11 23:45:24 at javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:740)
    04/12/11 23:45:24 at javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:853)
    04/12/11 23:45:24 at com.evermind.server.http.ServletRequestDispatcher.inv
    oke(ServletRequestDispatcher.java:765)
    04/12/11 23:45:24 at com.evermind.server.http.ServletRequestDispatcher.for
    wardInternal(ServletRequestDispatcher.java:317)
    04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.processRe
    quest(HttpRequestHandler.java:790)
    04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.run(HttpR
    equestHandler.java:270)
    04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.run(HttpR
    equestHandler.java:112)
    04/12/11 23:45:24 at com.evermind.util.ReleasableResourcePooledExecutor$My
    Worker.run(ReleasableResourcePooledExecutor.java:192)
    04/12/11 23:45:24 at java.lang.Thread.run(Thread.java:534)
    04/12/11 23:45:24 java.lang.NullPointerException
    Dec 11, 2004 11:45:24 PM org.apache.struts.action.RequestProcessor processExcept
    ion
    WARNING: Unhandled Exception thrown: class javax.ejb.EJBException

    Avi,
    Thanks for your response. I am actually returning a new InitialContext in a function call in the servlet. What I have noticed though is that JDeveloper creates two ear files for the application. One for the ejbs called ejb1.ear and another for the web files webapp1.ear. These are located in the applications subdirectory in OC4J directory.
    I know I have two projects in the application, model and viewController. I am just trying to follow the MVC pattern.
    In short, I don't think the web and the ejbs are in same ear file. I made the web project depend on the ejbs though. There is an option to set such. I don't know how to tell JDeveloper to put them all in one ear file.
    I will appreciate any suggestion.
    Thanks
    Matilda

Maybe you are looking for