我正在开发一个使用JTOpen ProgramCall类(com.ibm.as400.access.ProgramCall)在IBM i(AS / 400)上调用程序的Web应用程序(在Tomcat上运行)。我的问题是程序调用需要超过30秒才能响应,这会触发Sub Document_Standards()
'
' Document_Standards Macro
'
'
ActiveWindow.View = xlPageLayoutView
Selection.Font.Size = 12
Selection.Font.Size = 14
Selection.Font.Bold = True
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&""-,Bold""&14&F"
.RightHeader = ""
.LeftFooter = "Created by Chris"
.CenterFooter = "CONFIDENTIAL"
.RightFooter = "Printed on Date ()"
.LeftMargin = Application.InchesToPoints(0.7)
.RightMargin = Application.InchesToPoints(0.7)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
ActiveSheet.Shapes.Range(Array("Picture 1")).Select
End Sub
。
此类有一个java.net.SocketTimeoutException: Read timed out exception
方法,但它似乎对套接字超时没有影响。我还检查了我的Tomcat配置,但没有看到任何会导致此行为的内容。
有没有人知道改变这种实现的超时的方法?
代码:
setTimeout()
答案 0 :(得分:1)
好吧,经过几个小时后,我找到了解决方案。显然,原始开发人员在JDBC连接字符串中添加了一个socket timeout
参数 - 只需删除参数即可,默认值为0
,或无限超时。
在:
String connectionStr = "jdbc:as400://" + systemInfo.getIPAddress() + ":1527" + ";naming=system;socket timeout=30000;thread used=false;errors=full;prompt=false;date format=iso;block size=128;transaction isolation=none;user=" + systemInfo.getUserName() + ";password=" + systemInfo.getPassword();
后:
String connectionStr = "jdbc:as400://" + systemInfo.getIPAddress() + ":1527" + ";naming=system;thread used=false;errors=full;prompt=false;date format=iso;block size=128;transaction isolation=none;user=" + systemInfo.getUserName() + ";password=" + systemInfo.getPassword();
:\