Redeploy Tomcat from JSP

Is there a way to get hooks into the Tomcat server and redeploy your app directly from your own JSP? Obviously the admin package provided by Tomcat allows for it so I assume it is possible. Thanks.

I dont know if thats possible, but I would not suggest doing it. I believe its better to always let your Sys Admin redeploy updates to your production applications. If you redeploy on-the-fly via a JSP page, anyone who is logged on would lose their data in the middle of their work. The Sys Admin would normally redeploy after hours. Developers should throughly test their applications and only ask the Sys Admin to redeploy after a significant number of changes have been created and QA tested, not after every minor change.

Similar Messages

  • Restart tomcat from JSP----recall for jsp guru's

    hi thr
    I have buid a web based portal which give administrator power to do changes but to make these changes i need to restart tomcat server but my users are not It guys they found it very difficult to it.Is there anyway that i can restart server programatically.from JSP page using Java beans.Any idea will be helpful.
    Thanks in advance

    thanks guys i will go through that link but is there any code sample or a logic which can give idea how this works.
    Just like is we go to JRUN admin. we can start or restart server from front end in jsp.

  • Restart Tomcat from JSP

    Hi,
    I have the following requirement. I need to restart the server after I do some report generation.
    If I click some button on my web page. It should shutdown the server and restart it.
    I can stop the server by coding <% System.exit(1) %>. But after I close I need to restart it. Can we execute batch script to execute shutdown.bat and startup.bat of tomcat in that sequence to do this?
    Thanks

    sounds like you're letting memory clutter up with unused object references.
    Garbage collection won't pick them up because there are still references to it.
    Manually trying to force garbage collection is another Very Bad Thing (tm), almost as bad as restarting the server to hide the fact that you have a shoddy application running on it.
    Almost certainly you're storing something (probably the entire data for the report) in some global variable which you then forget about but don't actually let go out of scope.
    Another near certainty are database connections and other database resources being opened but never closed.
    Both are extremely common mistakes made by inexperienced programmers.

  • Calling a servlet (in Tomcat) from a JSP Page (in Apache)

    I have a web form in my JSP Page, which upon submits, will send the params to a servlet. The servlet will then process the request and send the results back to the calling JSP Page.
    with that above senario, is there any way for me to reference a servlet (resides in Tomcat) from a JSP Page (resides in Apache HTTP Server)?
    Thanks!

    Apache HTTP server isn't a servlet/JSP engine.
    Your JSP runs on Tomcat, right where the servlet does. Apache just forwards the request.
    %

  • Can we run external mail program from JSP / Servlet deployed on tomcat

    Hi folks,
    Had a tough time getting JavaMail API to work, finally when things seem to be working
    there were some issues with the vendor's server, so finally gave up the idea.
    On the server Apache and Tomcat are integrated via mod_jk and currently I redirect to a php page
    which acts as a helper to send mail, however for the given business needs and server's limitations
    there are potential security holes.
    So I was wondering if I could directly execute the linux sendmail program from JSP/Servlet
    as we would in a standalone java program or do we need special settings on Tomcat to execute external
    programs.
    Please let me know your views / ideas / comments on this
    Thanks in advance
    Abishek

    Hi
    It's not designed for you to be able to do this, it needs to run through 10gAS or 11gWeblogic.
    Tony

  • [Tomcat bug?] Calling response.sendError(404) from JSP

    Calling "response.sendError(404);" from JSP context causes Tomcat to mangle all non-latin characters.
    Any ideas why?
    How to recreate bug:
    http://www.kitoy.ru/int/bug1.zip
    There are 3 files in bug1.zip.
    index..jsp:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@page pageEncoding="utf-8"%>
    <%@page contentType="text/html; charset=utf-8"%>
    <%
        response.sendError(404);
    %>
    <html>
    </html>404.jsp:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@page pageEncoding="utf-8"%>
    <%@page contentType="text/html; charset=utf-8"%>
    <html>
    <h1>Hello in Russian: &#1055;&#1088;&#1080;&#1074;&#1077;&#1090;!</h1>
    </html>and WEB-INF\web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">
        <display-name>bug1</display-name>
        <description>bug1</description>
        <distributable/>
        <error-page>
            <error-code>404</error-code>
            <location>/404.jsp</location>
        </error-page>
    </web-app>Calling of index.jsp should cause 404 error with custom error page. The error page is utf-8 encoded and contains russian characters. That's by design.
    In fact, Tomcat shows ?????? instead Russian variant of "Hello".
    Tomcat/5.5.17 or Tomcat/5.0.28.- it does not matter.
    Is it Tomcat bug or I should not call response.sendError(404) from JSP?

    it's not a tomcat bug, it's rather a problem with
    your code.
    change index.jsp like the following then test
    it !
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
    Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@page pageEncoding="utf-8"%>
    <%@page contentType="text/html; charset=utf-8"%>
    <%
    esponse.sendRedirect("blablablablablabla.html");
    %>
    <html>
    </html>
    Thanks for the insight. But the issue here is with the response.sendError() method.

  • How to call Servlet from jsp page and how to run this app using tomcat..?

    Hi ,
    I wanted to call servlet from jsp action i.e. on submit button of JSP call LoginServlet.Java file.
    Please tell me how to do this into jsp page..?
    Also i wanted to execute this application using tomcat.
    Please tell me how to do this...? what setting are required for this...? what will be url ..??
    Thanks.

    well....my problem is as follows:
    whenever i type...... http://localhost:8080/appName/
    i am getting 404 error.....it is not calling to login.jsp (default jsp)
    but when i type......http://localhost:8080/appName/login.do........it executes servlet properly.
    Basically this 'login.do' is form action (form action='/login.do').....and i wanted to execute this from login jsp only.(from submit button)
    In short can anyone please tell me how to diaplay jsp page using tomcat 5.5
    plz help me.

  • Values from JSP to Struts Action Class

    Dear All,
    Am working on a small struts project, i want to get values from JSP in the Action class, i tried with sending variables using request through URL, it works fine, any other way is there to send the values from JSP to action class. Am not having any input fields in the JSP.I have links.
    Thanks,
    vyrav.

    I have a dispatch action for that am calling the action like this viewfiles.do?parameter=edit, and i have to send a variable ID from the same page, so am doing like this through java script, viewfiles.do?parameter=edit&id=10. Am able to get the id in the dispatch action edit, but when i start tomcat with security manager its not calling the action itself and its giving accesscontrol exception, but when i directly type viewfiles.do in URL its calling the action.
    I dont know wats the problem, tomcat security manager not allowing this. Please help me.
    Thanks,
    vyrav.

  • Crystal report from JSP using the JRC

    Hi, I am trying to call crystal report from JSP using the JRC.
    But i am getting the Error as 'Logon Failed'. my web.xml entry is
    <env-entry>
    <env-entry-name>jdbc/Test</env-entry-name>
    <env-entry-value>!oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:{userid}/{password}@//10.0.0.1:1521/TestDB</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
    i am setting the userid and password in the code. Please see the below code for your reference. Please help me to solve the issue.
    <%@ page language="java" contentType="text/html;charset=UTF-8"%>
    <%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSource" %>
    <%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSource" %>
    <html>
    <head>
    <title>Crystal Report with Database Logon information</title> </head>
    <body bgcolor="#ffffff">
    <%
    try
    String report = "/TEMPLATE.rpt";
    IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
    JPEReportSource reportSource = (JPEReportSource) rptSrcFactory.createReportSource(report, request.getLocale());
    CrystalReportViewer viewer = new CrystalReportViewer();
    viewer.setReportSource(reportSource);
    viewer.setHasRefreshButton(true);
    IConnectionInfo newConnInfo = new ConnectionInfo();
    newConnInfo.setUserName("TEST");
    newConnInfo.setPassword("TEST");
    ConnectionInfos newConnInfos = new ConnectionInfos();
    newConnInfos.add(newConnInfo);
    viewer.setDatabaseLogonInfos(newConnInfos);
    viewer.setEnableLogonPrompt(false);
    viewer.setOwnPage(true);
    viewer.setOwnForm(true);
    out.println("Connection Information: "+viewer.getDatabaseLogonInfos().getConnectionInfo(0).getAttributes().toString());
    viewer.processHttpRequest(request, response, getServletConfig().getServletContext(),null);
    viewer.dispose();
    catch(Exception e)
    throw new JspException( e);
    %>
    </body>
    </html>

    I never really had much luck with this approach.
    Mind you I was using Crystal Reports 10, and as far as I recall it didn't allow setting/changing of database at this level.
    Things to check
    - can you create a database connection on your page with this URL/username/password?
    - what server are you using? Tomcat? WebLogic?
    I found this in your other post:
    Connection Information: {Server Name=ee6rpt, Connection String=DSN=s(ee6rpt);User ID=s(ee62test);Password=;UseDSNProperties=b(false), Database Name=, Database DLL=crdb_odbc.dll}That would indicate it is using odbc to connect to the database (crdb_odbc.dll). ODBC is a bad idea with java.
    The way I have got it to work for me (after much trial and error) was to in Crystal Reports to connect using the Oracle Driver, and specifying a tnsname - eg define REPORT_DS in tnsnames.ora.
    When running through the JRC, it looked for a JNDI datasource under that same name "REPORT_DS".
    Don't know if that will help you or not.
    Good luck,
    evnafets

  • Need to Send Mail from JSP...

    Dear Team,
    I Need to Send Mail from JSP, have Designed user Interface to enter
    to, from, subject, and message text .
    Have Downloaded mail.jar and activate.jar file..... and placed in tomcat lib directory and WEBAPPS/WEB-INF/lib Directory too
    How do i send a mail to user ?
    do I require something else apart from things that i have mentioned?
    do i have to Configure SMTP, POP3 or Something like this....
    Now If I Create a object of Type MimeMessage and Set Recipient, from, subject and if i say transport.send(message) will this do My JOB???

    Dear Team,
    I Need to Send Mail from JSP, have Designed user
    Interface to enter
    to, from, subject, and message text .
    Have Downloaded mail.jar and activate.jar file.....
    and placed in tomcat lib directory and
    d WEBAPPS/WEB-INF/lib Directory too
    How do i send a mail to user ?
    do I require something else apart from things that i
    have mentioned?
    do i have to Configure SMTP, POP3 or Something like
    this....
    Now If I Create a object of Type MimeMessage and Set
    Recipient, from, subject and if i say
    transport.send(message) will this do My JOB???Yup! in addition to all the above i need to know my mail box outgoing mail server. and that's enough...... i am able to do that.
    Regards,
    Jagadeesh HS.

  • Stepping into Java Beans from JSP

    I am trying to figure out how to step into the Java Source code for my beans that are used in my JSP pages. I need to be able to debug them by stepping into them, using break points, etc.
    I have Nitro installed and a sample JSP page with the import to my test Java Bean class. What I did was create two projects in my work space. One as a Web project application and one as a Java project. I referenced and opened both projects. Everything compiles fine and the syntax is correct.
    The problem is I can not make the link for importing the class.
    I get this error: Class com.BrianTest.MyBean not found in import com.BrianTest.MyBean
    Anyone got a clue or a good example? I did try and add the class path and I tried to put it in a Jar file and attach the source to the Jar, but same problem.
    Thanks :?

    Stepping into jsp:useBean is not possible, but you can step-into jsp getter & setter tag.
    Since you are using java bean from a dependent project you need to configure your server with DevLoader.
    And currently only Tomcat server can be configured with Sysdeo Devloader to handle this situation
    Download Sysdeo DevLoader for Tomcat from http://www.sysdeo.com/eclipse/tomcatPlugin.html
    NOTE: If the project is self sufficient and not dependent on other projects/locations for classess/libraries then NitroX picks up all the libraries & classes present within default WEB-INF/lib & WEB-INF/classes respectively. And in this case you need not modify server configuration.
    Sysdeo DevLoader is to allow your web project to use libraries/classes from dependent projects. All you need to do is extract DevLoader.zip present within tomcatPluginV3.zip inside your Tomcat/server/classes folder.
    For more information about DevLoader please refer to http://www.sysdeo.com/eclipse/readmeDevLoader.html
    This will solve your problem and you should be able to run/debug your application. And most important make sure you have the correct NitroX build that supports Sysdeo DevLoader, refer http://www.m7.com/whatsnew.htm document against your build id (Help > About NitroX > NitroX Icon)

  • Problem in connecting to times ten from jsp

    Hi sir,
    I am trying to connect with timesten from jsp. But am getting following Exception.
    SQLException: Problems with loading native library/missing methods: no ttJdbcCS70 in java.library.path
    I am using myeclipse 8.6 ide. I have diployed my project in myeclipse tomcat server.
    Please help me in resolving this problem.
    Follosing is my code.
    display.jsp:
    <%@page import="com.tbss.RealTimeDAO,com.tbss.RealTimeCallReport,java.util.*"%>
    <%
    RealTimeDAO rdao=new RealTimeDAO();
    List<RealTimeCallReport> list=rdao.getRecords();
    pageContext.setAttribute("list",list);
    out.print("list"+list+"\n");
    Iterator<RealTimeCallReport> i=list.iterator();
    while(i.hasNext()){
    RealTimeCallReport rp=i.next();
    out.println(rp.getCompaignID()+"\t"+rp.getConnectedPhone()+"\t"+rp.getRecordID()+"\t"+rp.getSessionDuration()+"<br/>");
    %>
    RealTimeDAO.java
    public class RealTimeDAO {
    public List<RealTimeCallReport> getRecords(){
    List<RealTimeCallReport> list=new ArrayList<RealTimeCallReport>();
    try {
    // create the TimesTen data source and set the connection URL
    TimesTenDataSource ttds = new TimesTenDataSource();
    ttds.setUrl("jdbc:timesten:client:dsn=ttc1;UID=ttsa;PWD=abc123");
    // connect to the TimesTen database
    TimesTenConnection ttcon = (TimesTenConnection) ttds.getConnection();
    // create and execute the statement
    Statement stmt = ttcon.createStatement();
    ResultSet rset = stmt.executeQuery("select * from REAL_TIME_CALL_REPORT");
    // process the result set
    while(rset.next()) {
    RealTimeCallReport rp=new RealTimeCallReport();
    rp.setCompaignID(rset.getLong("CAMPAIGN_ID"));
    rp.setConnectedPhone(rset.getLong("CONNECTEDPHONE"));
    rp.setRecordID(rset.getLong("RECORD_ID"));
    rp.setSessionDuration(rset.getString("SESSION_DURATION"));
    rp.setSessionID(rset.getString("SESSION_ID"));
    list.add(rp);
    return list;
    } catch(SQLException e) {
    e.printStackTrace();
    return null;
    }

    The driver requires a shared library (nothing to do with java itself.)
    The shared library is not in the shared library path. The error suggests that the OS is Windows which means that the PATH (env variable) of the executable must have the directory of the shared library in it.

  • Calling Beans from JSP page

    hi,
    I tried to my best to call java beans from JSP page but it generate error that "unable to load class....", please help me that in which directory jsp file and bean *.class file reside, currently my setting are as follows.
    Note: I am using tomcat server and my jsp and servlet files are running seccessfuly, there is any special change in classpath for java beans? if any please tell
    My jsp file is in tomcat-->webapps-->jsp--><my file>
    My bean (*.class) file-->webapps-->Root-->web-inf-->classes--><my file>
    Pleae help me for the above problem.
    Mubashar ([email protected])

    According to J2EE standards:
    The web appl directory structure should be:
    WebAppRootDirectory
    |
    |---html, jsp, images etc
    |
    |---WEB-INF---
    |---classes--
    |---lib
    |
    |
    1) Make sure WEB-INF is in capital letters
    2) Place all ur beans in classes dir or sub-directory in
    classes
    3) In Tomcat place WebAppRootDirectory in webapps
    directory
    [email protected]

  • How to connect oracle database using DSN  from jsp

    hello, can any know how can i connect to[b] oracle database using DSN name from jsp .I am using oracle 9i and Tomcat 5
    Using odbc tool i have created the dsn name but ithe connection does not make .here is the code that i have tried
    Connection connection = null;
         try
              Class.forName("oracle.jdbc.driver.OracleDriver");
         catch(ClassNotFoundException Exception)
              out.println("error occoured during loading the driver ");
         try
              out.println("getting the connection");
              connection = DriverManager.getConnection("jdbc:oracle:deepak","scott","tiger");
              out.println("connection getted");
         catch(Exception exception1)
              out.println("error occoured ");
    pls help as soon as possible
    Sorry, for my english

    you are actually using JDBC so the DSN entry does not matter.
    2 things.
    Make sure that your oracle database driver is in your classpath on your tomcat server.
    I.E. copy the file classes12.jar into your common/lib folder of tomcat, or into your WEB-INF/lib folder of your application. and RESTART your server. classes12.jar can be found on the internet or more easily somewhere within your oracle installation. just search for it.
    Make sure your jdbc url is correct. I believe it goes like this.... fill in the blacks
    connection conn = DriverManager.getConnection("jdbc:oracle:thin:scott/tiger@MyOracleHost:1521:MyDB");Note how the username are passed in the first string there fore there is no need to pass additional parameters. This method may be depriciated, but if so, just take out the user and pass from the string and continue to pass them as 3 seperate strings.
    connection conn = DriverManager.getConnection("jdbc:oracle:thin:MyOracleHost:1521:MyDB","scott","tiger");That should get your connection. if not, post your errors.

  • Sending binary data from JSP (1.1)

    Hi all:
    I am using Tomcat 3.2.1 and Apache under Linux Mandrake OS.
    I have a JSP (1.1) sending binary data (GIF, PDF, DOC ..) using response.getOutputStream().write(data)
    method.
    The problem is the precompiler automatically creates the JspWriter and puts some out.write("\r\n") lines
    before I use getOutputStream method. The JVM throws an IllegalStateException because I am using both
    methods (this is from Servlet 2.2 specification).
    Must I change my code to forwarding to a servlet that make this work or is there a simple solution to
    avoid this?
    Thanks in advance.
    J.
    null

    Hi Shreeharsha
    Please refer to below docs for sending data from JSP page to RFC. In which you need to use sap connectors for connecting to SAP backend system.
    http://help.sap.com/saphelp_nw04/helpdata/en/b6/55e3952a902447847066a0df27b0d6/content.htm
    Hope it helps
    Regards
    Arun

Maybe you are looking for