在将Tomcat作为服务运行时,WebApplication无法正常工作

时间:2022-02-13 16:47:13

I have a web application Infobase.war created on eclipse and hosted on Tomcat (7.0.27) (OS: Windows server 2003). The index.jsp of the application navigates to a location on network to access files and display it on a webpage (see the complete index.jsp code below).

我有一个Web应用程序Infobase.war在eclipse上创建并托管在Tomcat(7.0.27)上(操作系统:Windows server 2003)。应用程序的index.jsp导航到网络上的某个位置以访问文件并将其显示在网页上(请参阅下面的完整index.jsp代码)。

The problem is that the application works perfectly fine when Tomcat is run as console by manually running Startup.bat. But if Tomcat is run as a service (through windows services) the application runs but fails to access the files on the remote machine and eventually the webpage gets displayed with the error message put for such cases (non-access)in code.

问题是,当Tomcat通过手动运行Startup.bat作为控制台运行时,应用程序可以正常运行。但是,如果Tomcat作为服务运行(通过Windows服务),则应用程序运行但无法访问远程计算机上的文件,并最终显示网页,并在代码中显示此类情况(非访问)的错误消息。

The Tomcat service settings through tomcat7w.exe have already been done. The heap limit has been increased.

通过tomcat7w.exe进行的Tomcat服务设置已经完成。堆限制已增加。

The code for index.jsp is:

index.jsp的代码是:

<html>
<head>
<title>Infobase </title>

<link rel="stylesheet" type="text/css" href="my.css"></link>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript"> 
$(document).ready(function(){
    //$("div#block").load('https://`inggnh018cfr`:8443/infobase/Navigate.do');
    //ADS
    //String path="\\\\"+getServletContext().getInitParameter("server_ip")+getServletContext().getInitParameter("filepath");
    $("div#block").load('https://132.186.18.155:8443/infobase/Navigate.do?f=\\\\132.186.198.175\\\\gc_sl_pg\\Quota\\EFIE\\Documents\\EFIE_new\\1.%20QUALITY');
    $("div#block1").load('https://132.186.18.155:8443/infobase/Navigate.do?f=\\\\132.186.198.175\\\\gc_sl_pg\\Quota\\EFIE\\Documents\\EFIE_new\\2.%20PROCESS');
    $("div#block2").load('https://132.186.18.155:8443/infobase/Navigate.do?f=\\\\132.186.198.175\\\\gc_sl_pg\\Quota\\EFIE\\Documents\\EFIE_new\\3.%20DOCUMENTS');
    $("div#block3").load('https://132.186.18.155:8443/infobase/Navigate.do?f=\\\\132.186.198.175\\\\gc_sl_pg\\Quota\\EFIE\\Documents\\EFIE_new\\4.%20INFORMATION%20HANDBOOK');

});
function expand(){

    // $(obj).click(function(){
        obj=window.event.srcElement;
        if(obj.value=='true'){
        //alert('http://localhost:8080/infobase/Navigate.do?f='+window.event.srcElement.id);
        //$.ajax({url:'https://inggnh018cfr:8443/infobase/Navigate.do?f='+obj.id ,success:function(result){
        $.ajax({url:'https://132.186.18.155:8443/infobase/Navigate.do?f='+obj.id ,success:function(result){
            //alert(result);
            //$(obj).append("<div class='panel' id='div-"+obj.id+"'>"+result+"</div>");
            $(obj).after(result);
            //$("div#"+window.event.srcElement.id).load(result);

        }});

        obj.value='false';
        //alert('http://inggnh018cfr:8080/infobase/ScreenServ.do?f='+obj.firstChild.nodeValue);
        /*screen change*/

        //$.ajax({url:'https://132.186.18.155:8443/infobase/ScreenServ.do?f='+obj.firstChild.nodeValue ,success:function(result){
        $.ajax({url:'https://132.186.18.155:8443/infobase/ScreenServ.do?f='+obj.id,success:function(result){
            //alert(result);

            if(result!=0)
                //document.getElementById("frame").src="\\\\132.186.18.155\\gc_sl_pg\\Deptt_Quota\\EFIE\\Documents\\EFIE\\Obsolete Documents\\PPTs\\"+result;           
            {
                var ppt="\\\\132.186.198.175\\gc_sl_pg\\Quota\\EFIE\\Documents\\EFIE\\Obsolete Documents\\PPTs\\"+result;
                window.open(ppt);
            }
            //else
                //document.getElementById("frame").src="infobase.pps";
            //$(obj).append("<div class='panel' id='div-"+obj.id+"'>"+result+"</div>");
            //$(obj).after(result);
            //$("div#"+window.event.srcElement.id).load(result);

        }});
        }
        else
            if(obj.value=='false'){
                  // alert(obj.firstChild.nodeValue);
                   obj.value='true';
                  // alert(.nodeName);
                   $(obj.nextSibling).remove();
                   //alert('done');
               }

}

1 个解决方案

#1


0  

When running from the console, the process runs as the currently logged on user who - it appears - has access to those network locations. When running as a service the process runs as LocalSystem which does not have access to those network locations.

从控制台运行时,该进程将以当前登录的用户身份运行,该用户看起来可以访问这些网络位置。作为服务运行时,该进程作为LocalSystem运行,而LocalSystem无权访问这些网络位置。

To fix this, create a domain user with the minimum necessary permissions to access those network locations and then configure your service to run as that user.

要解决此问题,请创建具有访问这些网络位置所需的最低权限的域用户,然后将服务配置为以该用户身份运行。

#1


0  

When running from the console, the process runs as the currently logged on user who - it appears - has access to those network locations. When running as a service the process runs as LocalSystem which does not have access to those network locations.

从控制台运行时,该进程将以当前登录的用户身份运行,该用户看起来可以访问这些网络位置。作为服务运行时,该进程作为LocalSystem运行,而LocalSystem无权访问这些网络位置。

To fix this, create a domain user with the minimum necessary permissions to access those network locations and then configure your service to run as that user.

要解决此问题,请创建具有访问这些网络位置所需的最低权限的域用户,然后将服务配置为以该用户身份运行。