0
votes

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
I don't know Tomcat, but I think I can tell when something is not a network connection issue. - Flosculus

1 Answers

0
votes

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.