我正在从Tomcat容器调用以下代码并使用JacORB作为ORB提供程序:
NamingContext ctx = NamingContextHelper.narrow(nameServiceObject);
BindingListHolder blh = new BindingListHolder();
BindingIteratorHolder bih = new BindingIteratorHolder();
ctx.list(100, blh, bih);
当我作为独立的 Java 应用程序运行上面的代码时,我得到了输出 但是当我从 Tomcat 容器运行类似的代码时,线程在 list() 函数处陷入死锁
在服务器端 JacORB 日志:
2015-01-22 22:58:11.938 FINE POA NameServer-POA rid: 6 opname: list _invoke: queuing request
2015-01-22 22:58:11.938 FINE rid: 6 opname: list is queued (queue size: 1)
2015-01-22 22:58:11.938 FINE rid: 6 opname: list trying to get a RequestProcessor
2015-01-22 22:58:11.938 FINE rid: 6 opname: list starts with request processing
2015-01-22 22:58:11.938 FINE rid: 6 opname: list invokeOperation on servant (stream based)
2015-01-22 22:58:11.938 FINE wrote 76 bytes to 192.168.73.107:3176
2015-01-22 22:58:11.938 FINE wrote GIOP message of size 76 to ClientGIOPConnection to 192.168.73.107:3176 (af993e)
2015-01-22 22:58:11.938 FINE waiting for queue
2015-01-22 22:58:11.938 FINE read 12 bytes from 192.168.73.107:3176
2015-01-22 22:58:11.953 FINE read 13 bytes from 192.168.73.107:3176
2015-01-22 22:58:11.953 FINE read GIOP message of size 25 from ClientGIOPConnection to 192.168.73.107:3176 (af993e)
2015-01-22 22:58:11.953 FINE wrote 76 bytes to 192.168.73.107:3172
2015-01-22 22:58:11.953 FINE wrote GIOP message of size 76 to ClientGIOPConnection to 192.168.73.107:3172 (2c1e6b)
2015-01-22 22:58:11.953 FINE read 12 bytes from 192.168.73.107:3172
2015-01-22 22:58:11.953 FINE read 13 bytes from 192.168.73.107:3172
2015-01-22 22:58:11.953 FINE read GIOP message of size 25 from ClientGIOPConnection to 192.168.73.107:3172 (2c1e6b)
2015-01-22 22:58:11.953 INFO ClientConnectionManager: created new ClientGIOPConnection to 192.168.102.14:62245 (2200d5)
2015-01-22 22:58:11.953 FINE [0/3] removed idle thread (job scheduled)
2015-01-22 22:58:11.953 FINE ClientGIOPConnection to 192.168.102.14:62245 (2200d5): will wait until connected
2015-01-22 22:58:11.953 FINE findPOA: impl_name mismatch - 6839799491 != StandardNS
2015-01-22 22:58:11.953 FINE No CodeSetComponentInfo in IOR. Will use default CodeSets
2015-01-22 22:58:11.953 FINE ClientGIOPConnection to 192.168.102.14:62245 (2200d5): sendMessage() -- opening transport
2015-01-22 22:58:11.953 FINE Trying to connect to 192.168.102.14:62245 with timeout=90000.
2015-01-22 22:58:11.969 INFO Connected to 192.168.102.14:62245 from local port 3242
2015-01-22 22:58:11.969 FINE wrote 72 bytes to 192.168.102.14:62245
2015-01-22 22:58:11.969 FINE wrote 24 bytes to 192.168.102.14:62245
2015-01-22 22:58:11.969 FINE wrote GIOP message of size 80 to ClientGIOPConnection to 192.168.102.14:62245 (2200d5)
在客户端:
[jacorb.orb.iiop] INFO : Opened new server-side TCP/IP transport to 192.168.73.107:3242
[jacorb.orb.giop.conn] DEBUG : GIOPConnectionManager: created new ServerGIOPConnection to 192.168.73.107:3242 (f7345b)
[jacorb.util.tpool] DEBUG : [0/0] creating new thread
[jacorb.util.tpool] DEBUG : [0/1] removed idle thread (job scheduled)
[jacorb.giop.server.l] DEBUG : Received CodeSetContext. Using ISO8859_1 as TCS and UTF16 as TCSW
[jacorb.poa] DEBUG : POA RootPOA rid: 0 opname: _non_existent _invoke: queuing request
[jacorb.poa.queue] DEBUG : rid: 0 opname: _non_existent is queued (queue size: 1)
我不明白的是为什么列表调用没有结束,因为当我独立运行代码时,服务器端日志结束为这样
2015-01-22 19:56:23.399 INFO Connected to 192.168.102.14:61988 from local port 3031
2015-01-22 19:56:23.399 FINE wrote 72 bytes to 192.168.102.14:61988
2015-01-22 19:56:23.399 FINE wrote 24 bytes to 192.168.102.14:61988
2015-01-22 19:56:23.399 FINE wrote GIOP message of size 80 to ClientGIOPConnection to 192.168.102.14:61988 (1d5a0)
2015-01-22 19:56:23.414 FINE read 12 bytes from 192.168.102.14:61988
2015-01-22 19:56:23.414 FINE read 13 bytes from 192.168.102.14:61988
2015-01-22 19:56:23.414 FINE read GIOP message of size 25 from ClientGIOPConnection to 192.168.102.14:61988 (1d5a0)
2015-01-22 19:56:23.430 FINE ServerRequest: reply to list
使用与tomcat集成的JacORB 2.3.1有任何问题吗?因为我可以从日志中假设ClientGIOPConnection无法写回TCP/IP传输流。
JacORB 2.3.1 相当旧 - 你能试试 3.5 吗?
如果你能提供一个测试用例(在jacorb bugzilla/邮件列表上:http://www.jacorb.org/support.html),那么我可以看看。