要查看问题:
在 Oracle 中创建一个表:
create table ut_table_ut_service_pj ( PATH VARCHAR(80), BINARY BLOB );
将以下管道粘贴到 XPL 沙箱中,您可以访问
http://localhost:8080/orbeon/sandbox-transformations/xpl/
,根据您的系统替换数据库 URI、用户名和密码:<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:odt="http://orbeon.org/oxf/xml/datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exist="http://exist.sourceforge.net/NS/exist"> <p:processor name="oxf:url-generator"> <p:input name="config"> <config> <url>test.pdf</url> <mode>binary</mode> </config> </p:input> <p:output name="data" id="document"/> </p:processor> <p:processor name="oxf:sql"> <p:input name="datasource"> <datasource> <driver-class-name>oracle.jdbc.OracleDriver</driver-class-name> <uri>jdbc:oracle:thin:@//localhost:1522/globaldb</uri> <username>orbeon</username> <password>password</password> </datasource> </p:input> <p:input name="data" href="#document"/> <p:input name="config"> <sql:config> <sql:connection> <sql:execute> <sql:update debug="write"> insert into ut_table_ut_service_pj values('test.pdf', <sql:param select="/*" type="xs:base64Binary" sql-type="blob"/> ) </sql:update> </sql:execute> </sql:connection> </sql:config> </p:input> </p:processor> </p:config>
这会导致以下异常:
|----------------------------------------------------------------------------------------------------------------------|
|Exception: java.lang.NullPointerException |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.oxf.processor.sql.interpreters.ValueOfCo|<init> |ValueOfCopyOfInterpreter.java | 48|
|org.orbeon.oxf.processor.sql.SQLProcessor$Interpret|addAllDefaultElementHandlers |SQLProcessor.java | 476|
|org.orbeon.oxf.processor.sql.interpreters.ConfigInt|start |ConfigInterpreter.java | 32|
|org.orbeon.oxf.processor.sql.SQLProcessor$Interpret|startElement |SQLProcessor.java | 503|
|org.orbeon.oxf.processor.sql.SQLProcessor$RootInter|startElement |SQLProcessor.java | 280|
为什么会这样?