javaoracle-databasehibernatemavenverifyerror

Exception maven - Verify


When I start mvn test all tests are correct. I know that verify started integration tests.

But when I run tests in my IDE I get this exception. What reason?

My exception stack-

javax.persistence.PersistenceException:  org.hibernate.exception.GenericJDBCException: could not extract ResultSet  
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert  (AbstractEntityManagerImpl.java:1692)  
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert  (AbstractEntityManagerImpl.java:1602)  
    at org.hibernate.jpa.internal.QueryImpl.getSingleResult  (QueryImpl.java:560)  
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
    at java.lang.reflect.Method.invoke(Method.java:498)  
    at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:372)  
    at com.sun.proxy.$Proxy99.getSingleResult(Unknown Source)  
    at com.datas_tech.ingo.core.repository.jpa.implementation.AisRepositoryImpl.getAisId(AisRepositoryImpl.java:34)  
    at com.datas_tech.ingo.core.repository.jpa.AisRepositoryITest.testGetAisId(AisRepositoryITest.java:37)  
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
    at java.lang.reflect.Method.invoke(Method.java:498)  
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)  
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)  
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)  
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)  
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)  
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)  
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)  
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)  
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)  
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)  

The caused by stack:

Caused by: org.hibernate.exception.GenericJDBCException: could not extract ResultSet  
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)  
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)  
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)  
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:79)  
    at org.hibernate.loader.Loader.getResultSet(Loader.java:2117)  
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1900)  
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1876)  
    at org.hibernate.loader.Loader.doQuery(Loader.java:919)  
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)  
    at org.hibernate.loader.Loader.doList(Loader.java:2617)  
    at org.hibernate.loader.Loader.doList(Loader.java:2600)  
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2429)  
    at org.hibernate.loader.Loader.list(Loader.java:2424)  
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:336)  
    at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1967)  
    at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:322)  
    at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:125)  
    at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)  
    at org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:529)  
    ... 39 more  
Caused by: java.sql.SQLException: ORA-20001: �� ��������� �������� � ����� �������!  
ORA-06512: at "INSURADM.PACK_PORTAL_PROC", line 574  

Code:

@Override
public Long getAisId(String aisAgeementNumber, String phoneNumber, Integer portalId) {
    String query = "SELECT insuradm.PACK_PORTAL_PROC.FindFromTel(:p_ag_num, :p_tel, :p_portal_sub_id) FROM DUAL";
    try {
        Long aisId = (Long) entityManager
                .createNativeQuery(query)
                .setParameter("p_ag_num", aisAgeementNumber)
                .setParameter("p_tel", phoneNumber)
                .setParameter("p_portal_sub_id", portalId)
                .getSingleResult();
        return aisId;
    } catch (Exception e) {
        e.printStackTrace();
        return null; // TODO определиться что лучше, Exception или null
    }
}

Solution

  • Right at the bottom of the stack is this:

    java.sql.SQLException: ORA-20001: �� ��������� �������� � ����� �������! ORA-06512: at "INSURADM.PACK_PORTAL_PROC", line 574

    So your package INSURADM.PACK_PORTAL_PROC is hurling a user-defined exception (ORA-20001 is in the range Oracle has set aside for our own errors). Perhaps you can read the error message? Looks like it's written in Unicode, so we can't see it.

    Either way, you need to drill into INSURADM.PACK_PORTAL_PROC to understand why it's erroring. The stack even tells you the place to start - line 574 - although that may be an exception handler rather than the line which causes the problem. How easy it is to diagnose the problem will depend on the quality of the PL/SQL code, especially how well it is instrumented and how comprehensive the logging is.

    The most likely explanation is that your Maven instance points to a different database than you use when running tests locally. So you may have variations in test data which could cause an exception. You need to locate the exact code which raises the exception and understand the circumstances which trigger it.

    As it's a user-defined exception you need to find the pragma exception_init declaration which associates -20001 with a named Exception variable, than find the RAISE for that Exception; with luck there will be only one place that happens, or at least one obvious place.