Transformation to WORD from XSLT with java stored procedure - PROBLEM

Hi all,
I'm building a java function for transformation of xml document through .xslt scheme to WORD. I use xalan.
Now, everything works fine if I run the java function on the client VM
But on the server where the classes needed for the transformation are loaded, it crashes with a strange exception
nulljava.lang.NullPointerException
Now I've located the problem, and it occurs in this line in the java code:
transformer.transform( new StreamSource(xmlFile),  new StreamResult(osIzlez));
(where xmlFile is the source for the transformation, and the transformer is configured with the proper .xslt scheme, osIzlez points to a bytearraystream of a blob in the database where the .doc file is going to be generated and loaded)
I also found out that the NullPointerException occurs because the transformer is actually null on the server (although it's configured with the .xstl scheme and should not be null ! ), but on the client it's never null!
What could be the problem, does anyone have an IDEA?
Edited by: Daniel Kiprijanovski on 17.9.2009 03:07

OK, i found out that there's a reported bug about that exception on the java VM. I found a way arround it however.
Thanks,
Daniel K.

Similar Messages

  • APEX fails with Java stored procedure that creates a JDBC connection

    Hello!
    We are facing a strange problem since we have upgraded from Oracle 10g and Apache to Oracle 11g with Embedded Gateway.
    Here is what we do:
    ** APEXX calls a PL/SQL package function "OPEN_CONNECTION" that wraps a Java stored procedure called "openConnection".*
    FILE_READER_REMOTE_API.openConnection(user, password, host, port, service);
    ** The Java stored procedures "openConnection" opens a JDBC connection to an other database:*
    public class FileReaderRemote {
    private static Connection conn = null;
    private static DefaultContext remoteContext = null;
    public static void openConnection(String user, String password, String host, String port, String service) throws SQLException {
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    java.util.Properties props = new java.util.Properties();
    props.put ("user", user);
    props.put ("password", password);
    //props.put ("database", "//" + host + ":" + port + "/" + service);
    props.put ("database", host + ":" + port + ":" + service);
    props.put("v$session.program", "FileReaderRemote2");
    // Connect to the database
    remoteContext = Oracle.getConnection("jdbc:oracle:thin:", props);
    This procedure used to work fine before the upgrade, but now we see the following:
    * It still works when called directly from TOAD or SQL*Plus, even under the user ANONYMOUS.
    * When called from APEX and the target database is Oracle 11g, it still works.
    * When called from APEX and the target database is Oracle 10g, it takes several minutes and we receive this error:
    *"Socket read timed out"*
    We have tested the following workaround:
    We have created a database link to our own database and called the stored procedure through that database link.
    FILE_READER_REMOTE_API.openConnection*@loopback*(user, password, host, port, service);
    This works, but is not really an option.
    I hope some one of you can explain this strange behaviour to me.
    Best regards,
    Matthias

    You wrote
    "Java stored procedures -- by definition - are stored in the 8i rdbms. !!"
    From the Oracle8i Java Stored Procedures Developer's Guide
    Release 8.1.5
    A64686-01
    "If you create Java class files on the client side, you can use loadjava to upload them into the RDBMS. Alternatively, you can upload Java source files and let the Aurora JVM compile them. In most cases, it is best to compile and debug programs on the client side, then upload the class files for final testing within the RDBMS"
    This means that you can create shared classes that are used on both the client and server side. The source does not need to reside within the server (according to their documentation). Please also note the following from the Oracle8i JDBC Developer's Guide and Reference Release 8.1.5 A64685-01 for using the getConnection() method on the server:
    "If you connect to the database with the DriverManager.getConnection() method, then use the connect string jdbc:oracle:kprb:. For example:
    DriverManager.getConnection("jdbc:oracle:kprb:");
    Note that you could include a user name and password in the string, but because you are connecting from the server, they would be ignored."
    So if you're coding a shared class that is to run on both the client and server side, you might do something like this:
    Connection conn =
    DriverManager.getConnection(
    System.getProperty("oracle.server.version") == null
    ? "jdbc:oracle:thin:@hostname:1521:ORCL"
    : "jdbc:oracle:kprb:"),
    "youruserid","yourpassword");
    As stated earlier, the userid and password are supposedly ignored for server connections retrieved in this manner. I haven't tried this yet, but it is documented by Oracle.
    Regards,
    Steve
    null

  • Performance problem with java stored procedure

    hi,
    i developped a java class, then I stored it in Oracle 8.1.7.
    This class contains several import of other classes stored in the database.
    It works, but the execution perfomances are disappointing. It's very long. I guess, that's because of the great number of classes to load that are necessary for my class execution.
    I tried to increase the size of the java pool (I parameter 70 Mo in the java_pool_size parameter of the init.ora), but the performance is not much better.
    Has anyone an idea to increase the performance of this execution of my class ?
    In particular, is there a way to keep permanently in memory the java objects used by my class ?
    Thanks in advance
    bye
    [email protected]
    null

    before running Java, the database session needs to be Java enabled; this might be the reason why it is taking so long. If this is the case, you should see an improvement in subsequent calls, once a database session is Java enabled, other users can benefit from it.
    Kuassi
    I have some performance issue with java stored procedure. Hope some one will be able to help me out. I'm using java stored procedures in my application and basically these procedures are used to do some validation and form the XML message of the database tables. I have noticed that when I call the PL/SQL wrapper function, it is taking time to load the java class and once the class is loaded the execution is faster. Most of the time is spent for loading the class rather than executing the function. if I reduce the class load time, I can improve the performance drastically. Do any one of you know how to reduce the class load time. The following are the platform and oracle version.
    O/S: IBM AIX
    Oracle: 8.1.7

  • Re   Java Stored Procedure Problem

    Ben
    There appear to be some problem with the forum. It doesn't want to show my response to your post with the subject "Java Stored Procedure Problem". See the answer to this thread for an example of how to do this...
    Is there a SAX parser with PL/SQL??

    Ben
    There appear to be some problem with the forum. It doesn't want to show my response to your post with the subject "Java Stored Procedure Problem". See the answer to this thread for an example of how to do this...
    Is there a SAX parser with PL/SQL??

  • Applying an XSLT against results from XSU in Java Stored Procedure

    Is there an easy way to have a Java Stored Procedure apply an XSLT against the results of an OracleXMLQuery? The only examples I can find are with regular Java code outside the database.
    I'm running 9.2.0.2 on Windows 2000 Server.

    This is what I use:
    (I have table called params where I have stored encodinf, XSL, and stuff like that)
    DOMParser parser;
    XMLDocument xml, xsldoc, outXML;
    URL xslURL;
    URL xmlURL;
    Connection conn = getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rset= stmt.executeQuery("select xsl_varchar2,encoding,version,host,port,host_path,usrnm,passwrd from params");
    rset.next();
    String strXSL=rset.getString(1); //This is XSL transformation
    String strEncoding=rset.getString(2);
    String strVersion=rset.getString(3);
    rset.close();
    stmt.close();
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    StringReader rXSL= new StringReader(strXSL);
    xslURL=createURL("test");
    parser.parse(rXSL);
    xsldoc=parser.getDocument();
    OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from somewhere");
    xml=(XMLDocument) qry.getXMLDOM();
    // instantiate a stylesheet
    XSLStylesheet xsl = new XSLStylesheet(xsldoc, xslURL);
    XSLProcessor processor = new XSLProcessor();
    // display any warnings that may occur
    processor.showWarnings(true);
    processor.setErrorStream(System.err);
    // Process XSL
    DocumentFragment result = processor.processXSL(xsl, xml);
    // create an output document to hold the result
    outXML = new XMLDocument();
    outXML.setVersion(strVersion);
    outXML.setEncoding(strEncoding);
    outXML.appendChild(result);
    outXML is your XML.

  • Deploy package with Java Stored Procedure without JDeveloper

    I have a set of Java Stored Procedures deployed as a package on a Oracle 8i server. Everything works fine in my development environment, and now I would like to deploy the same package in the customers runtime environment. Both environments are running Oracle 8i rel 2 on NT.
    Is there a simple way to use the JDeveloper .prf deployment profile without installing JDeveloper in the customers environment?
    If not, can I the get the .jar files and .sql scripts from JDeveloper to create the call specs and package bodys?
    I guess JDeveloper must have this information, and my idea was then to write a script using loadjava and SQL*Plus.
    Regards,
    Tom Bjerre

    you would not be able to take just the deployment profile and run it outside JDeveloper.
    You would be able to create archive of all java classes in the package using Deployment Wizard in JDeveloper.
    Then you can load the jar file using the utilities in 8i.
    JDeveloper does generate the SQL for CALL specs etc ., at the deployment time and it is printed in MEssage Viewer along with other information.
    Hope that info is useful for you
    raghu

  • Problems with java stored procedure.

    I have a java stored procedure that uses a package called RmiJdbc
    which allows calling remote JDBC data sources from any java capable
    machine.
    I've loaded the RmiJdbc classes into oracle via the loadjava
    command and everything seems to come up valid.
    The stored procedure does a Class.forName() to get the driver
    registered, than attempts to connect to the remote RMI driver.
    The particular line it dies on is this (see the error below):
    c = DriverManager.getConnection("jdbc:rmi:" + rmiHost + "/" + url);
    A mangled version of this (minus the Oracle specific stuff) works
    from the command line correctly. Can somebody point me in a
    direction to figure out what's going on here?
    THanks,
    Eric
    Oracle9i Enterprise Edition Release 9.0.1.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.0.1.3.0 - Production
    ORACLE_HOME = /oracle/v901ee
    System name: HP-UX
    Node name: athena
    Release: B.11.00
    Version: A
    Machine: 9000/889
    Instance name: PASDB2
    Redo thread mounted by this instance: 1
    Oracle process number: 13
    Unix process pid: 7839, image: oracle@athena (TNS V1-V3)
    *** SESSION ID:(8.547) 2002-08-15 15:41:27.221
    java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
    java.lang.NullPointerException
    java.lang.NullPointerException
    at sun.rmi.server.LoaderHandler$LoaderKey.<init>(LoaderHandler.java)
    at sun.rmi.server.LoaderHandler.lookupLoader(LoaderHandler.java)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java)
    at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java)
    at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.inputArray(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java)
    at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.inputObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java)
    at sun.rmi.registry.RegistryImpl_Stub.lookup
    at org.objectweb.rmijdbc.RJConnection.<init>(RJConnection:83)
    at org.objectweb.rmijdbc.Driver.connect(Driver:135)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    at TurnoverInfoPlusInterface.insertInterfaceRecords(TurnoverInfoPlusInterface:53)
    java.sql.SQLException: Error unmarshaling return; nested exception is:
    java.lang.NullPointerException
    at org.objectweb.rmijdbc.Driver.connect(Driver:140)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    at TurnoverInfoPlusInterface.insertInterfaceRecords(TurnoverInfoPlusInterface:53)

    More info...I'm also seeing "ORA-03113: end-of-file on communication channel". I checked the user trace file and didn't get much help...it indicated an "exception signal: 11" and core-dump type stuff that had no meaning to me.

  • Invoking Unix command with java stored procedure

    Hi,
    I have a perfectly working environment and now I am trying to replicate the same in another server. I have a java stored procedure which invokes the Unix command using java Runtime.exec() in my code named "run". I am sure that the code is called and the java class run is resolved in oracle as I could see that in dba_java_resolvers dictionary. But I am not sure whether the function in java is called or whether a exception is thrown. how to identify this? Could there be any thing to do with settings in oracle side? please help me.
    Thanks in advance,
    Marutha

    Hi,
    Do you get any output while running the code?
    I'm testing similar solution and if there are any errors or Oracle can't execute the program due to permissions or other issues the error information will be displayed. Also in the Java class itself you need to catch exceptions and print stack trace to standard output.
    declare
    x number;
    begin
    dbms_output.enable(1000000);
    dbms_java.set_output(1000000);
    x:=system_command.run_command('testconnect.sh');
    dbms_output.put_line('Returned value='||x);
    exception
    when others then dbms_output.put_line('Sql error='||substr(sqlerrm,1,250));
    end;
    <system_command.run_command> - replace with a call to your java stored procedure.

  • Start with java stored procedure in SQLDeveloper

    Hi,
    i'm a newbe in writing PL/SQL stored procedures. Thats the reason to wont to write some java stored procedures for an ORACLE 10g. I'm using the SQLDeveloper. My Problem is: how can i start to write java stored procedures. Where have i to put them?
    Can somebody help me?
    10x
    cu nanostruct

    For Java Stored procedures you'll need to use JDeveloper. For SQL Developer, there is a viewlet and a tutorial on this page:
    http://www.oracle.com/technology/products/database/sql_developer/index.html
    Sue

  • DBMS_JOB on Java Stored Procedure problem

    Hi all,
    (running on Oracle 9i : 9.2.0.7.0 64bit on HP/UX)
    I have a Java Stored procedure that reads a table
    One of the fields in this table is a CLOB containing some more SQL.
    We then executeQuery() that SQL (and e-mail the output).
    (Obviously I also have PL/SQL wrapper around it, which we'll call PROCNAME).
    For certain pieces of SQL, this second executeQuery() fails throwing ORA-00942, but only when run from a DBMS_JOB(!).
    Calling "CALL PROCNAME('argument')" from sqlplus/toad works fine, but setting "PROCNAME('argument')" to run as a DBMS Job fails on some SQL with the above error. (All as the same username).
    java.lang.StackTraceElement doesn't seem to exist in Oracle java, so the only error I have to go on is e.getMessage() from SQLExecption which returns:
    ORA-00942: table or view does not exist
    Any help at this strangeness would be appreciated!
    nic

    Hi Cris:
    May be is a problem of the effective user which is running the procedure.
    Which is the auth_id directive at the PLSQL call spec?
    Look at this example procedure UploadNews for example:
    http://dbprism.cvs.sourceforge.net/dbprism/cms-2.1/db/cmsPlSqlCode.sql?revision=1.21&view=markup
    this procedure calls to the cmsNews.doImport which is implemented as Java Stored Procedure.
    Also check if your loadjava operation is not using -definer flag.
    Best regards, Marcelo.

  • Java stored procedure problem(oracle db)

    HI,
    we have a java stored procedure with the following definition, and that works as we want it to:
    CREATE OR REPLACE FUNCTION processBulletin(in_varchar VARCHAR2) RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'JavaParser.Bufr_Ingest.processBulletin(java.lang.String) return java.lang.String';
    And the Java portion:
    public static String processBulletin(String in_bull)
    ... do something with in_bull
    The problem is that we've recently discovered that the 32767 size restiriction on the input parameter varchar2 is too small. I don't want to rewrite the entire Java procedure. I figured the simplest (or at least temporary)solution would be to have the Java procedure accept a CLOB, convert that clob to a string and continue as it would. I was hoping someone might be able to tell me if the following would be possible:
    CREATE OR REPLACE FUNCTION processBulletin(in_clob CLOB) RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'JavaParser.Bufr_Ingest.processBulletin(oracle.sql.CLOB) return java.lang.String';
    And the Java portion:
    public static String processBulletin(oracle.sql.CLOB in_clob)
    String in_bull = clob_in.getSubString(1, (int)clob_in.length());
    ... do something with in_bull
    Thanks

    I don't know about Java stored procedures, but in JDBC you usually use streams to work with CLOBS. Here's Oracle JDBC Developers Guide, Working with LOBs

  • Using Java Resources with Java Stored Procedures

    Hi folks,
    Hope someone can help out with this one.
    I have a java source file called PdfFormExtractor.sql. In that file I have a definition similar to.
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "PdfFormExtractor" as
    import com.adobe.pdf.FormDataFormat;
    import com.adobe.pdf.FormType;
    import com.adobe.pdf.PDFDocument;
    import com.adobe.pdf.PDFFactory;
    etc, etc.
    };I have loaded a number of Java jar files into the DB with the following command:
       CALL loadjava -v -s -r -u db_user_name/db_password@SID -jarasresource name_of_jar_file.jarMy PdfFormExtractor class compiles with errors as it does not seem to detect the class files located in the jar files which located in the schema.
    I have used the following query and determined that the JAR files are valid and present in the schema.
    SELECT object_name, object_type, status, timestamp
      FROM user_objects
    WHERE (object_name NOT LIKE 'SYS_%'
             AND object_name NOT LIKE 'CREATE$%'
             AND object_name NOT LIKE 'JAVA$%'
             AND object_name NOT LIKE 'LOADLOB%')
       AND object_type LIKE 'JAVA %'
    ORDER BY object_type, object_name;One solution appears to be to omit the "-jarasresource". This appears to cause loadjava to unpack the jar files. Unfortunately this means that you must drop any java objects from the same path as which they were created. Ideally I'd like to just load the java files and leave them as resources.
    My question then is how do I get my source code to recognize that the files are in the schema. I thought this would be picked up when I do @PdfFormExtractor.sql from a sqlplus prompt (assuming the jars have been loaded and unpacked in the schema)
    because I specified RESOLVE in the source definition
    If anyone has any ideas they are most welcome as I've been stuck on this for the past couple of hours.
    Regards
    Kris
    -- http://kristianjones.blogspot.com

    I advise you to post this thread on the Java forum JDeveloper and ADF
    Regards.

  • Perfomance problem with java stored procedure

    hi,
    i developped a java class, then I stored it in Oracle 8.1.7.
    This class contains several import of other classes stored in the database.
    It works, but the execution perfomances are disappointing. It's very long. I guess, that's because of the great number of classes to load that are necessary for my class execution.
    I tried to increase the size of the java pool (I parameter 70 Mo in the java_pool_size parameter of the init.ora), but the performance is not much better.
    Has anyone an idea to increase the performance of this execution of my class ?
    In particular, is there a way to keep permanently in memory the java objects used by my class ?
    Thanks in advance
    bye
    [email protected]
    null

    Hello again,
    I read the documentation of 9i and found some hints about different TCP/IP socket handling of 9i and a standard JVM.
    There are some parts that give hints but I couldn't find a sample code to show how to handle the differences.
    Could anyone tell me how to handle the differences or give some links to sample code?
    Thanks
    Detlev

  • EJB calling Java Stored Procedure / Problem sending mail

    I have a test code very similar to the sample - actually
    copied it from there. When i want to send a mail from my 9iR2 database, i get the following exception:
    javax.mail.NoSuchProviderException: No provider for Address type: rfc822
    at javax.mail.Session.getTransport(Session.java:516)
    at javax.mail.Transport.send0(Transport.java:155)
    at javax.mail.Transport.send(Transport.java:81)
    at cwt.exception.CWTPublicException.sendMail(CWTPublicException.java:97)
    at cwt.sp.Test.testExceptions(Test.java:42)
    When I use the Transport class to explicitly set 'smtp' as transport with
    message.saveChanges();
    Transport transport = session.getTransport("smtp");
    transport.connect(bundle.getString("smtp-host"), bundle.getString("smtp-user"),
    bundle.getString("smtp-pwd"));
    transport.sendMessage(message, message.getAllRecipients());
    transport.close();
    then i also get an exception:
    javax.mail.NoSuchProviderException: No provider for smtp
    at javax.mail.Session.getProvider(Session.java:289)
    at javax.mail.Session.getTransport(Session.java:483)
    at javax.mail.Session.getTransport(Session.java:464)
    at cwt.exception.CWTPublicException.sendMail(CWTPublicException.java:101)
    at cwt.sp.Test.t[i]Long postings are being truncated to ~1 kB at this time.

    Hi,
    This exception usualy occurs when the handlers haven't been imported in your application.
    Please check whether you have imported following in your source code.
    import javax.mail.*;
    import javax.mail.internet.*;
    Also make sure that you have loaded " latest " mail.jar and activation.jar into the database.
    Cheers
    --Venky                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Java Stored Procedure Problem

    Hi all,
    I was able to deploy the Java class into the database (the message says Success). And then I am able to desc MyJavaSproc name in SQL*Plus and see the Pl/SQL parameter and return types. But when I use either call or select from dual, it tells me the the Java class (MyJavaName) is not there. The Oracle error is this: ORA-29540: class MyJavaName does not exist. I am running 10gR2. I did encounter a problem when I first tried to deploy using J2SE 1.5 as source and target and JDev suggested that I change that to an earlier version. I changed that to 1.4 and then deployed successfully.
    Could someone help me with this? Thanks a lot.
    Ben

    Thanks. I created a simple file Java class with JDev (10g 1.3). I have some static methods (according to Oracle docs) in the class. Then by following JDev's help doc, I created a deployment profile for the project using JDec. I then added the Java methods that I wanted to deploy as sprocs. As I said, after I changed the J2SE from 1.5 (the default) to 1.4, the deployment was successful. I can see it using desc in SQL*Plus. I can also see it in the database connection tab in JDev. I can open the class stub created by JDev, and the sprocs and funcs are listed under Functions and Procedures on the database connection tab.
    Thanks.
    Ben

Maybe you are looking for