简体   繁体   English

JSONObject类出现问题,未给出错误

[英]Problems with JSONObject class, no error given

I'm building a little API that I will call and receive back JSON data about the directory. 我正在构建一个小的API,该API将调用并接收有关该目录的JSON数据。 Its working perfectly on my dev box running, however when I put it on the server i need it on, it gets part way through the application and just stops. 它可以在我的开发箱上正常运行,但是当我将其放到服务器上时,它会进入应用程序的一部分并停止。

No exceptions are thrown, console outputs dont do anything and I receive no response from my GET request to the server. 没有引发任何异常,控制台输出不执行任何操作,并且我的GET请求对服务器没有收到任何响应。 The plugin just stops. 插件刚刚停止。

This is an HTTPProvider running as a plugin on a Wowza server, but I don't think thats relevant. 这是作为Wowza服务器上的插件运行的HTTPProvider,但我认为这并不重要。 The server doesnt crash, my plugin just doesnt do anything after this point in the code (Each set of comments are places I tested with console output, all worked but the last one): 服务器不会崩溃,我的插件在代码中的这一点之后什么也不做(每组注释都是我用控制台输出测试过的地方,除了最后一个外,所有工作都有效):

File dir = new File(appInst.getStreamStoragePath()+"/"+content_path);
//Correct Path is formed and file object created
if(dir.exists() && dir.isDirectory())
{
    //Directory exists
    File[] files = dir.listFiles(); 

    //Was able to find the 2 files in this directory

    JSONObject output = new JSONObject();
    JSONArray directories = new JSONArray();
    JSONArray videos = new JSONArray();
    boolean access_allowed = true;

    //Nothing happens after these declarations, no errors
    //No thrown exceptions or console output

    for (int i = 0; i < files.length; i++) {
        //Build JSON objects+arrays with files
    }
}

Both dev box and server are the same versions of java and wowza server. dev box和server都是Java和wowza服务器的相同版本。 (1.6) (1.6)

My main question is not so much how to fix it but how do I even go about figuring out whats wrong? 我的主要问题不是如何解决它,而是如何找出错误所在?

The issue I guess was that I did not include the org.json.* package into my application. 我猜的问题是我没有在应用程序中包含org.json。*包。 The reason it worked (And why i thought nothing was wrong since it worked locally) is because of the way Wowza loads plugins. 它起作用的原因(以及为什么我认为没有问题,因为它在本地起作用)是因为Wowza加载插件的方式。 Another plugin already had the JSON package, but the server did not have this same plugin. 另一个插件已经具有JSON包,但是服务器没有相同的插件。

I fixed it by including the JSON package into my plugin's build path. 我通过在插件的构建路径中包含JSON包来解决此问题。

Its still weird to me that there were no errors at all though. 我仍然很奇怪,尽管没有任何错误。

您是否尝试过远程调试?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM