我有一个在eclipse上创建并托管在Tomcat (7.0.27) (OS: Windows server 2003)上的web应用程序Infobase.war。应用程序的index.jsp导航到网络上的某个位置以访问文件并将其显示在网页上(请参阅下面的完整index.jsp代码)。
问题是,当通过手动运行Startup.bat以console身份运行Tomcat时,应用程序运行得很好。但是,如果Tomcat作为service运行(通过windows服务),应用程序会运行,但无法访问remote machine上的文件,最终网页会显示错误消息,并在代码中针对这种情况(无法访问)进行放置。
已经通过tomcat7w.exe完成了Tomcat服务设置。堆限制已增加。
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');
               }
}发布于 2014-03-22 17:19:44
当从控制台运行时,该进程以当前登录用户的身份运行,该用户有权访问这些网络位置。当作为服务运行时,该进程以LocalSystem身份运行,该身份无权访问这些网络位置。
要解决此问题,请创建一个具有访问这些网络位置所需的最低权限的域用户,然后将您的服务配置为以该用户身份运行。
https://stackoverflow.com/questions/22557992
复制相似问题