让我先说清楚 - 我对EJB一无所知。
回到这个问题,我们在oracle中有一个函数,我们从应用程序中调用它。
以下是拨打电话的步骤:
- get the EnitityManager
- create a named query.
- set parameters on the query object
- query.executeUpdate()
我正在尝试在查询上设置超时。我尝试了很多可能性:
- hibernateQuery.setTimeout(value);
- jpaQuery.setHint("javax.persistence.query.timeout", value);
- <sql-query .. timeout="30" .. on the hbm file.
- javax.transaction.UserTransaction.setTransactionTimeout(timeout);
所有这些都没有超时但是运行了规定的时间,查询被假设运行并最终抛出ORA-12592:TNS:坏包。
我搜索了ORA-12592,大多数搜索都表明防火墙/操作系统/网络上存在连接问题。我无法理解的是,如果我没有设置超时,为什么它不会抛出ORA-12592。
更重要的是,如何设置超时?你认为这是oracle驱动程序的问题吗?
Persistence Provider Class: org.hibernate.ejb.HibernatePersistence
Driver Class: oracle.jdbc.xa.client.OracleXADataSource
Hibernate 4 [with JPA 2]
EJB 3
编辑:添加堆栈跟踪:
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:273)
at com.abc.star.jpa.service.BasePersistenceService.getResultList(BasePersistenceService.java:118)
at com.abc.star.jpa.service.StarPersistenceService$$EnhancerByGuice$$e3e37c96.CGLIB$getResultList$8(<generated>)
at com.abc.star.jpa.service.StarPersistenceService$$EnhancerByGuice$$e3e37c96$$FastClassByGuice$$f5d274d4.invoke(<generated>)
at com.google.inject.internal.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
at com.abc.star.common.TransactionalHandler.invoke(TransactionalHandler.java:29)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
at com.abc.star.jpa.service.StarPersistenceService$$EnhancerByGuice$$e3e37c96.getResultList(<generated>)
at com.abc.star.jpa.service.StarPersistenceService.getClearance(StarPersistenceService.java:25)
at com.abc.star.jpa.service.StarPersistenceService$$EnhancerByGuice$$e3e37c96.CGLIB$getClearance$0(<generated>)
at com.abc.star.jpa.service.StarPersistenceService$$EnhancerByGuice$$e3e37c96$$FastClassByGuice$$f5d274d4.invoke(<generated>)
at com.google.inject.internal.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at com.google.inject.ProxyFactory$1.intercept(ProxyFactory.java:53)
at com.abc.star.jpa.service.StarPersistenceService$$EnhancerByGuice$$e3e37c96.getClearance(<generated>)
at com.abc.star.service.StarInfo.getCompositeStatus(StarInfo.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:167)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:86)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1350)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1282)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1232)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1222)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:419)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216)
at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141)
at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:63)
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:134)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:134)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.abc.star.common.web.PersistenceInterceptor.doFilter(PersistenceInterceptor.java:79)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.abc.star.common.web.GlobalsInterceptor.doFilter(GlobalsInterceptor.java:53)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.abc.mnm.filter.MnmAuthFilter.doFilter(MnmAuthFilter.java:112)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
at org.hibernate.loader.Loader.doList(Loader.java:2525)
at org.hibernate.loader.Loader.doList(Loader.java:2508)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2338)
at org.hibernate.loader.Loader.list(Loader.java:2333)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:338)
at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1827)
at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:231)
at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:157)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:264)
... 61 more
Caused by: java.sql.SQLException: ORA-12592: TNS:bad packet
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
at oracle.jdbc.driver.T4CStatement.fetch(T4CStatement.java:1072)
at oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:359)
at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:263)
at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.next(Unknown Source)
at org.hibernate.loader.Loader.processResultSet(Loader.java:939)
at org.hibernate.loader.Loader.doQuery(Loader.java:910)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
at org.hibernate.loader.Loader.doList(Loader.java:2522)
答案 0 :(得分:0)
说明,Oracle使用TCP头字段OOB(无界数据),一些基于SSL的VPN(例如OpenVPN和Cisco ANYConnect VPN)会丢弃此TCP标志。结果,Oracle服务器报告了协议违规错误。