JBoss WS 临时文件保存不正确
我的昨天的问题据说已排序。虽然没有解决。
我遇到的 NPE 是由 FileNotFoundException 触发的,该异常一直隐藏,直到我切换到 TRACE 日志记录 (org.jboss.util.xml.JBossEntityResolver)...
所以事情是这样的:
1.) 我正在尝试从部署到 JBoss
下的代码连接到 Web 服务 2.) JBossWs 将 wsdl 保存到 tmp 文件夹,如下所示:
file:/home/xxx/dev/XXXX/jboss-4.2.3.GA/server/yyy/tmp/jbossws/JBossWS_www.company.xx_99_server_soap.php?wsdl=get8489235369016302536.xsd
3.) 然后当它尝试读回 WSDL 时:
TRACE [org.jboss.util.xml.JBossEntityResolver] Failed to obtain URL.InputStream from systemId: file:/home/xxx/dev/xxx-PAN/jboss-4.2.3.GA/server/xxxxxxx/tmp/jbossws/JBossWS_www.comany.xx_99_server_soap.php?wsdl=get8489235369016302536.xsd
java.io.FileNotFoundException: /home/xxx/dev/xxx-PAN/jboss-4.2.3.GA/server/xxxxxxx/tmp/jbossws/JBossWS_www.comany.xx_99_server_soap.php
显然它会被截断,然后无法读回。
我想我能够以某种方式配置它如何将其写入磁盘或如何读回的模式,但我确实找到了解决方案(甚至不是从我提到的 JBoss 类的代码中找到的)。任何想法将不胜感激。
编辑:
我在 Linux 服务器上创建了一个简单的测试应用程序,指向包含以下代码的同一文件:
URL url = new URL("file:/home/abos/xxx/xxxx/jboss-4.2.3.GA/server/xxxxxxx/tmp/jbossws/JBossWS_www.company.xx_99_server_soap.php?wsdl=get8489235369016302536.xsd");
url.openStream();
Exception in thread "main" java.io.FileNotFoundException: /home/xxx/dev/xxxx/jboss-4.2.3.GA/server/anchorage/tmp/jbossws/JBossWS_www.bdmglobal.xx_99_server_soap.php (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at java.io.FileInputStream.<init>(FileInputStream.java:79)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
at java.net.URL.openStream(URL.java:1010)
at Main.main(Main.java:11)
所以这是我的结论:
1.) 实际上是 URL 类截断了名称
2.) 但如果保存得当的话就不会有问题。
所以我仍在寻找一种配置方法。
My problem from yesterday is say sorted. Not solved though.
The NPE I had was triggered by a FileNotFoundException that was hidden until I switched to TRACE logging (org.jboss.util.xml.JBossEntityResolver)...
So here is the thing:
1.) I'm trying to connect to the webservice from code that is deployed to under JBoss
2.) JBossWs saves the wsdl to the tmp folder like this:
file:/home/xxx/dev/XXXX/jboss-4.2.3.GA/server/yyy/tmp/jbossws/JBossWS_www.company.xx_99_server_soap.php?wsdl=get8489235369016302536.xsd
3.) And then when it tries to read back the WSDL:
TRACE [org.jboss.util.xml.JBossEntityResolver] Failed to obtain URL.InputStream from systemId: file:/home/xxx/dev/xxx-PAN/jboss-4.2.3.GA/server/xxxxxxx/tmp/jbossws/JBossWS_www.comany.xx_99_server_soap.php?wsdl=get8489235369016302536.xsd
java.io.FileNotFoundException: /home/xxx/dev/xxx-PAN/jboss-4.2.3.GA/server/xxxxxxx/tmp/jbossws/JBossWS_www.comany.xx_99_server_soap.php
Obviously it truncates and then not able to read back.
I guess I would be able to configure somehow the pattern how it writes it to disk or how it reads it back but I did find the solution (even not from the code of the JBoss class I mentioned). Any ideas would be appreciated.
Edit:
I created a simple test application on the Linux server pointing to the same file containing the following code:
URL url = new URL("file:/home/abos/xxx/xxxx/jboss-4.2.3.GA/server/xxxxxxx/tmp/jbossws/JBossWS_www.company.xx_99_server_soap.php?wsdl=get8489235369016302536.xsd");
url.openStream();
Exception in thread "main" java.io.FileNotFoundException: /home/xxx/dev/xxxx/jboss-4.2.3.GA/server/anchorage/tmp/jbossws/JBossWS_www.bdmglobal.xx_99_server_soap.php (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at java.io.FileInputStream.<init>(FileInputStream.java:79)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
at java.net.URL.openStream(URL.java:1010)
at Main.main(Main.java:11)
So here are my conclusions:
1.) Actually it is the URL class that truncates the name
2.) But if it was saved properly it would not be a problem.
So I'm still looking for a way to configure that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从来没有见过这个问题,所以我的回答可能对你没有多大帮助......
您是否尝试将 jboss.server.temp.dir 属性设置为 /tmp 之类的内容并再次运行测试用例?可能有一些硬编码的长度,尝试缩短路径可能会解决问题......
另一个技巧是设置一个 .sar Jboss 服务,请求您的 wsdl 并通过 JNDI 发布它们,以避免从客户端角度来看路径 f 的所有问题?您只需处理一个流并将其放入 JNDI 树中..不涉及路径
如果您的问题发生在 JBoss 保存文件时,那么不保存它会解决您的问题,不是吗?这就是为什么我建议将 wsdl 作为流(或根据您的喜好使用 Reader 或 InputStream 的文本)获取并将其直接放入您的 JNDI 树中......
华泰
杰罗姆
never saw this problem so my answer may won't help you much....
Have you tried to set the jboss.server.temp.dir property to something like /tmp and run your test case again ? There may be some hardcoded length and trying to shorten the path may solve the problem ...
Another trick would be to setup a .sar Jboss service requesting your wsdl and publishing them through JNDI to avoid all problems with path ffrom the client point of view ? You just have to handle a stream and put it into the JNDI tree ..no path involved
If your problem occurs when JBoss saves the file so not saving it would solve your problem isn't it ? That 's why I suggest to grab the wsdl as a stream (or text using Reader or InputStream as you prefer) and to put it directly into your JNDI tree....
HTH
Jerome