2

当我在 smooks 中使用 xml-java 转换时。出现异常是无法检查 JDBC 自动提交模式。我的应用程序与 seam 2.1.2、jap、richfaces、smooks 集成。

当我使用 smooks 检索 clob 列值时显示错误?例外是:

Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not inspect JDBC autocommit mode
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629) [hibernate-entitymanager.jar:4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)]
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73) [hibernate-entitymanager.jar:4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)]
    at com.manam.mobee.telco.impl.TelcoManagerImpl.getTelcoList(TelcoManagerImpl.java:46) [classes:]
    at com.manam.mobee.customer.MobeeCustomerHome.create(MobeeCustomerHome.java:301) [classes:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_11]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_11]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_11]
    at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_11]
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:56) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.util.Work.workInTransaction(Work.java:47) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:163) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) [jboss-seam.jar:2.1.2]
    at com.manam.mobee.customer.MobeeCustomerHome_$$_javassist_seam_10.create(MobeeCustomerHome_$$_javassist_seam_10.java) [classes:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_11]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_11]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_11]
    at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_11]
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.Component.callComponentMethod(Component.java:2249) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.Component.callCreateMethod(Component.java:2172) [jboss-seam.jar:2.1.2]
    at org.jboss.seam.Component.newInstance(Component.java:2132) [jboss-seam.jar:2.1.2]
    ... 84 more
Caused by: org.hibernate.exception.GenericJDBCException: could not inspect JDBC autocommit mode
    at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) [hibernate3.jar:3.2.4.sp1]
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) [hibernate3.jar:3.2.4.sp1]
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) [hibernate3.jar:3.2.4.sp1]
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29) [hibernate3.jar:3.2.4.sp1]
    at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:248) [hibernate3.jar:3.2.4.sp1]
    at org.hibernate.impl.SessionImpl.afterOperation(SessionImpl.java:417) [hibernate3.jar:3.2.4.sp1]
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1126) [hibernate3.jar:3.2.4.sp1]
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) [hibernate3.jar:3.2.4.sp1]
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64) [hibernate-entitymanager.jar:4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)]
    ... 120 more
Caused by: java.sql.SQLException: Transaction cannot proceed STATUS_MARKED_ROLLBACK
    at org.jboss.jca.adapters.jdbc.WrapperDataSource.checkTransactionActive(WrapperDataSource.java:240)
    at org.jboss.jca.adapters.jdbc.WrappedConnection.checkTransactionActive(WrappedConnection.java:1599)
    at org.jboss.jca.adapters.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:1614)
    at org.jboss.jca.adapters.jdbc.WrappedConnection.getAutoCommit(WrappedConnection.java:731)
    at org.hibernate.jdbc.ConnectionManager.isAutoCommit(ConnectionManager.java:189) [hibernate3.jar:3.2.4.sp1]
    at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:239) [hibernate3.jar:3.2.4.sp1]
    ... 124 more

例子 :

 private  DoCustomerChange runSmooks(MobeeCustomerChange mobeeCustomerChange) throws IOException, SAXException, SmooksException {

            // Instantiate Smooks with the config...
            Smooks smooks = new Smooks();

            try {
                smooks.getClassLoader().getResourceAsStream("/WEB-INF/smooksProfileChangeConfig_xmlToJava.xml");
                 // Create an exec context - no profiles....
                ExecutionContext executionContext = smooks.createExecutionContext();
                // The result of this transform is a set of Java objects...

                // Configure the execution context to generate a report...
                executionContext.setEventListener(new HtmlReportGenerator("target/report/report.html"));

                JavaResult result = new JavaResult();
                // Filter the input message to extract, using the execution context...
                smooks.filterSource(executionContext, new StreamSource(new ByteArrayInputStream(readInputMessage(mobeeCustomerChange))), result);
                return (DoCustomerChange) result.getBean("doCustomerChange");
            } finally {
                smooks.close();
            }
        }

        private  byte[] readInputMessage(MobeeCustomerChange mobeeCustomerChange) {
                try {                       
                    //return DatabaseUtils.getMessageString(getInstance().getProfile()).getBytes();
                    //  StreamUtils.readStream(is);
                    //StreamUtils.readStream(dEn.decrypt(DatabaseUtils.covertClobtoByte(profileAudit.getProfileChanges())));
                return   StreamUtils.readStream(mobeeCustomerChange.getProfileChanges().getAsciiStream());
                } catch (Exception e) {
                    e.printStackTrace();
                    return "<no-message/>".getBytes();
                }
           }
4

0 回答 0