dongyashun2559 2014-09-08 14:06
浏览 68

Tomcat上的PHP无法连接到Java Servlet

I have two Tomcat WebApps. One is the web site written in PHP and second is Java Servlet. I have both in apache-tomcat-7.0.55/webapps folder. Problem is when I want to connect to Servlet from site I'm getting exception]

java.lang.NoSuchMethodExcetion: hello([o:PhpParserString]). Candidates: []

PHP:

define("JAVA_HOSTS", "ip_address");
define("JAVA_SERVLET", "/SearchEngine");
require_once("Java.inc");

if (strlen(qa_get('q'))) {
    $javaresults = java_context()->getServlet()->hello(qa_get('q'));
}

Java:

public String hello(String str) throws SQLException {
    System.out.println(str);
    return str;
}

I can run site or servlet independently without problems on Tomcat but I can't connect Php site to servlet on the same server. When site was deployed in Apache Server and servlet was running on Tomcat through Eclipse everything was working fine, but now it is not.

  • 写回答

1条回答 默认 最新

  • drpkcwwav20524605 2014-09-08 14:23
    关注

    You may need to set up crossContext in your Tomcat server configuration (server.xml)

    Set to true if you want calls within this application to ServletContext.getContext() to successfully return a request dispatcher for other web applications running on this virtual host. Set to false (the default) in security conscious environments, to make getContext() always return null.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题