如何从PHP中调用Scala函数?

4

除了使用Thrift服务之外,还有没有其他方法可以从PHP调用Scala函数?最开始我尝试了Thrift服务,但是问题在于它有时候可以工作,有时候却不行。是否有更简便的解决办法?

下面的代码是我的server.scala程序

try {
    val serverTransport: TServerSocket= new TServerSocket(9778)
    val processor = new User_nodeService.Processor(User_node)
    val args1:Args = new Args(serverTransport)
    args1.processor(processor)
    val server:TServer = new TThreadPoolServer(args1)
    println("Started service successfully...")
    server.serve()
}

有时候我会在"args1.processor(processor)"这行代码上遇到错误 "value processor is not a member of org.apache.thrift.server.TThreadPoolServer.Args",但有时候这段代码又能正常运行。

发布你尝试过的代码,让人们来修复它,这样可以更快地解决问题。 - Hermann Stephane Ntsamo
如果您明确声明 processororg.apache.thrift.TProcessor,会发生什么? - Carsten
你得到的错误是编译时错误还是运行时错误? - pedrofurla
@pedrofurla 这是一个编译时错误。 - yAsH
如果它被作为脚本运行,那么你的构建或类路径可能存在问题。 - pedrofurla
1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接