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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Error calling Java Stored Procedure

    hi I am calling java stored procedure from jdbc. i am getting wierd exceptions:
    CallableStatement cstmt = conn.prepareCall("begin SEND_MAIL(?,?,?);end;");
    cstmt.setString(1,"[email protected]");
    cstmt.setString(2,"Mail from Stored Proc");
    cstmt.setString(3,"This is test mail from Oracle8i");
    cstmt.execute();
    i am getting following Exception:
    java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.util.PropertyPermission * read,write) has not been granted by dbms_java.grant_permission to SchemaProtectionDomain(ISTORE_CUST|PolicyTableProxy(ISTORE_CUST))
    ORA-06512: at "ISTORE_CUST.SEND_MAIL", line 0
    ORA-06512: at line 1
    null

    I think u dont've previleges to run
    the procedure.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by arunr12:
    hi I am calling java stored procedure from jdbc. i am getting wierd exceptions:
    CallableStatement cstmt = conn.prepareCall("begin SEND_MAIL(?,?,?);end;");
    cstmt.setString(1,"[email protected]");
    cstmt.setString(2,"Mail from Stored Proc");
    cstmt.setString(3,"This is test mail from Oracle8i");
    cstmt.execute();
    i am getting following Exception:
    java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.util.PropertyPermission * read,write) has not been granted by dbms_java.grant_permission to SchemaProtectionDomain(ISTORE_CUST|PolicyTableProxy(ISTORE_CUST))
    ORA-06512: at "ISTORE_CUST.SEND_MAIL", line 0
    ORA-06512: at line 1
    <HR></BLOCKQUOTE>
    null

  • 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??

  • 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.

  • Calling Java Stored Procedure failed SQLXML

    I tried to upload a simple class to Oracle in which I want to use java.sql.SQLXML class using:
    loadjava -u user/passwd@host:1521:xyz -v -resolve C:\develop\workspaces\Test\src\lbb\apc\test\JavaStoredProcedureTest.java
    loadjava answers with:
    creating : source lbb/apc/test/JavaStoredProcedureTest
    loading  : source lbb/apc/test/JavaStoredProcedureTest
    resolving: source lbb/apc/test/JavaStoredProcedureTest
    errors   : source lbb/apc/test/JavaStoredProcedureTest
        ORA-29535: Quelle erfordert Neukompilierung
        lbb/apc/test/JavaStoredProcedureTest:6: cannot find symbol
        symbol  : class SQLXML
        location: package java.sql
        import java.sql.SQLXML;Then I found that the Oracle JDBC driver does not support the SQLXML type, thus changing my program to use XMLType:
    XMLType sqlXml = (XMLType)rs.getSQLXML(1);but it doesn't help as well as it doesn't help to use
    Clob clob = rs.getClob(1);Finally I tried (and failed) to use
    Object obj = rs.getObject(1);
    results in:
    java.sql.SQLException: ORA-29532:Java call terminated by uncaught Java exception:What can I do to solve this problem?

    I wrote it for an example. sorry i should be clear.
    Here is the code i am running check WORKING & NOT WORKING lines. What am i missing
    PL SQL package
    CREATE OR REPLACE PACKAGE BODY APPS.hypr_Reference_designator as
    function hypr_xsl ( dbInstance IN VARCHAR2, Parent_ItemNum IN VARCHAR2)
    return varchar2
    as language java name 'hypr_ref_designator_xsl.hypr_xsl(java.lang.String,java.lang.String) return java.lang.String';
    procedure hypr_xsl(dbInstance IN VARCHAR2, Parent_ItemNum IN VARCHAR2)
       is
       itemNum VARCHAR2(30);
       db Varchar2(30);
       print_string varchar2(200);
       begin
          db:=dbInstance;
            itemNum:=Parent_ItemNum;
          print_string := hypr_xsl(db,itemNum);  --NOT WORKING
                print_string := hypr_xsl('DEV','123'); --WORKING
          commit;
          DBMS_OUTPUT.PUT_LINE(print_string || db || itemNum);
       end hypr_xsl;
    END hypr_Reference_designator;Java Stored Procedure
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED APPS.HYPR_REF_DESIGNATOR_XSL as import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import jxl.*;
    import oracle.jdbc.driver.*;
    import java.sql.*;
    import java.util.Properties;
    public class hypr_ref_designator_xsl {
        public hypr_ref_designator_xsl() {
        public static void main(String[] args) {
    public static String hypr_xsl(String  dbinstance, String parent_itemNum) {
    System.out.print(dbinstance);
    System.out.print(parent_itemNum);
    return "";
    //does some process here
    }

  • 21700 while calling java stored procedure in 9i

    I create a java stored procedure that takes a varray of a rowtype. When I call that procedure, I get an ora-21700. If I remove the varray from the parameter list, I can call the procedure okay. My goal is to create a generic java procedure that can take a rowtype from any table and create XML. Once I get the oracle.sql.ARRAY into my code, I am okay. I just can't seem to pass it in. I have pasted my code below:
    Java:
    import oracle.sql.*;
    public class test {
    public static String sayHello() {
    return("Hello, World!");
    public static void genXML(oracle.sql.ARRAY a, oracle.sql.CLOB c) throws Exce
    ption {
    c.putString(1,"<test>This is a test!</test>");
    PL/SQL:
    create or replace package mike is
    type dummy_record is varray (1) of dummy%rowtype;
    PROCEDURE GENERATE_XML(i dummy_record, c CLOB);
    FUNCTION SAYHELLO RETURN varchar2;
    end mike;
    show errors
    create or replace package body mike is
    PROCEDURE GENERATE_XML(i dummy_record,c CLOB)
    AS LANGUAGE JAVA
    NAME 'test.genXML(oracle.sql.ARRAY,oracle.sql.CLOB)';
    FUNCTION SAYHELLO RETURN varchar2
    AS LANGUAGE JAVA
    NAME 'test.sayHello() return java.lang.String';
    end mike;
    show errors
    DDL:
    SQL> describe dummy
    Name Null? Type
    USERNAME VARCHAR2(20)
    ID NUMBER
    Test Script:
    declare
    m Mike.dummy_record := Mike.DUMMY_RECORD();
    c CLOB;
    begin
    m.extend;
    select xml into c from t_clob;
    for rec in (select * from dummy)
    LOOP
    m(1) :=rec;
    mike.generate_xml(m,c);
    end loop;
    end;
    And finally, the output:
    declare
    ERROR at line 1:
    ORA-21700: object does not exist or is marked for delete
    ORA-06512: at "MMANGINO.MIKE", line 0
    ORA-06512: at line 10
    Sorry this post is so long, but I wanted it to be complete!
    Mike

    The first solution is to not do that in java in the first place.
    DDL should be in script files which are applied to oracle outside of java.
    Other than I believe there are some existing stored procedures in Oracle that take DDL strings and process them. Your user has to have permission of course. You can track them down via the documentation.

  • 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

  • No method found error when calling java stored procedured

    hi:
    i am rather confused about this. i have written several
    java stored procedures and all of them work fine. but when i tried another one , the error message 'no method found 'occurs
    when i call the procedure from sqlplus.
    it' s a simple procedure . but it's very strange and happens
    from time to time
    my compile shell as following
    javac -classpath $ORACLE_HOME/jdbc/lib/classes12.zip GenFiles.java
    $ORACLE_HOME/bin/loadjava -u zw/zw@aixtest GenFiles.class
    and
    my definition as following
    create or replace procedure files(chargeCyckeID varchar2, cycleStart varchar2,cycleEnd varchar2,
    loginName varchar2, filePath varchar2, start1 number, end1 number, step number)
    AS LANGUAGE JAVA
    NAME 'GenFiles.genFile(String , String , String , String , String , int , int , int )';
    and my java code is here :
    import java.sql.*;
    import java.io.*;
    import oracle.jdbc.driver.*;
    public class GenFiles{
         public static void main(String[] args){
              04UU<F7QV\FZ#,V\FZ?*J<#,V\FZ=aJx#,5GB<C{#, ND<~B7>6#,Pr:E?*J<#,Pr:E=aJx#,2=3$#(Iz3IND<~5D<GB<J}#)
         public static void genFile(String chargeCycleID, String cycleStart, String cycleEnd, String loginName, String filePath, int start, int end, int step){
         try{
              String sqllist = "select customer_id,contract_code,     usercode,ani,ord,"
                        + " agent_code,linkman, customer_name , postcode,paymethod_category_id ,"
                        + " ltrim(to_char(cost,'999999990.99')) cost,call_duration,from listani_file where ord> ? and ord<? order by contract_code";
              String sqlcalls1 = "select a.ani || ',' || a.PASS || ',' || to_char(a.START_TIME,'yyyy-mm-dd hh24:mi:ss') stime || ',' || trunc(a.CALL_DURATION/60)||':'||ltrim(to_char(mod(a.CALL_DURATION,60),'09')) CALL_DURATION || ',' || ltrim(to_char((CALL_AMOUNT/ceil(CALL_DURATION/60)),'999999990.99')) RATE || ',' || ltrim(to_char(a.CALL_AMOUNT,'999999990.99')) CALL_AMOUNT"
                        +" from call_fact_mind a "
                        +" where a.usercode=?"
                        + " and a.ani=? "
                        + " and a.period_key<='" + end + "'"
                        + " and a.period_key>='" + start + "'"
                        + " and a.charge_flag='Y' "
                        + " and a.CALL_DURATION>6"
                        + " and a.CALL_AMOUNT>0"
                        +" order by a.period_key";                    
              String sqlcalls2 = "select a.ani || ',' || a.PASS || ',' || to_char(a.START_TIME,'yyyy-mm-dd hh24:mi:ss') stime || ',' || trunc(a.CALL_DURATION/60)||':'||ltrim(to_char(mod(a.CALL_DURATION,60),'09')) CALL_DURATION || ',' || ltrim(to_char((CALL_AMOUNT/ceil(CALL_DURATION/60)),'999999990.99')) RATE || ',' || ltrim(to_char(a.CALL_AMOUNT,'999999990.99')) CALL_AMOUNT "
                        + " from call_fact_mind a "
                        + " where a.usercode=?"
                        + " and a.period_key<='" + end + "'"
                        + " and a.period_key>='" + start + "'"
                        + " and a.charge_flag='Y' "
                        + " and a.CALL_DURATION>6"
                        + " and a.CALL_AMOUNT>0"
                        +" order by a.period_key";                    
              Connection con = new OracleDriver().defaultConnection();
              try{
                   int i = start;
                   //8y>]2=3$Q-;7
                   while( true){
                        if( i>=end ) break;
                        genFile(con, i , i+step, chargeCycleID, loginName, filePath, sqllist, sqlcalls1, sqlcalls2);
                        i += step;
              }catch(Exception ex){
              }finally{
                   if( con != null) con.close();
         }catch(Exception exx){}
              8y>]2=3$Iz3IND<~
         private static void genFile(Connection con, int start, int end, String chargeCycleID, String loginName, String filePath, String sqllist, String sqlcalls1, String sqlcalls2) throws Exception{
              PreparedStatement ps1 = null;
              PreparedStatement ps2 = null;
              PreparedStatement ps3 = null;
              ResultSet rs1 = null;
              ResultSet rs2 = null;
              String fileName = filePath + System.getProperty("file.separator") + start + "_" + end + ".txt";
              BufferedWriter writer = null;
              try{
                   writer = new BufferedWriter(new FileWriter(fileName));
                   ps1 = con.prepareStatement(sqllist);
                   ps2 = con.prepareStatement(sqlcalls1);
                   ps3 = con.prepareStatement(sqlcalls2);
                   ps1.setInt(1, start);
                   ps1.setInt(2, end);
                   rs1 = ps1.executeQuery();
                   //Iz3Ibuffer,V;SPR;6(<GB<J12EP4HkND<~
                   StringBuffer strBuffer = new StringBuffer();
                   int i =0;
                   //Q-;7:OM,=a9{</
                   String preContractCode = "";
                   String currentContractCode = "";
                   while( rs1.next()){
                        currentContractCode = rs1.getString("contract_code");
                        if( rs1.getString("ani") == null){
                             ps2.setString( 1, rs1.getString("usercode"));
                             rs2 = ps2.executeQuery();
                        }else{
                             ps1.setString(1, rs1.getString("usercode"));
                             ps1.setString(2, rs1.getString("ani"));
                             rs2 = ps1.executeQuery();
                        //Hg9{3vOVPB5D:OM,:E#,<SHk:OM,OnM7,contract_costJG:OM,On7QSC
                        if( ! preContractCode.equals(currentContractCode)){                     
                             //TZG0Cf<SHk?UPP
                             strBuffer.append("\r\n");
                             String contractHead = "\"1\"" + ",\"" + rs1.getString("linkman") + "\",\"" + rs1.getString("customer_name")
                                            + "\",\"" + rs1.getString("contract_code") + "\",\"" + rs1.getString("agent_code")
                                            + "\",\"" + chargeCycleID + "\",\"" + rs1.getString("contract_cost") + "\"";
                             strBuffer.append(contractHead);
                        while( rs2.next()){
                             if( i<1000){
                                  i++;
                                  strBuffer.append("\"2\"" + rs2.getString(1));
                             }else{
                                  String str = strBuffer.toString();
                                  writer.write(str, 0, str.length());
                                  strBuffer = new StringBuffer();
                                  strBuffer.append(rs2.getString(1));
                                  i = 1;
                        //<SHk7QSC:O<F
                        if( rs1.getString("ani") == null){
                             String trail = "\"2\"" + ",\"" + "ani: " + "\",\"" + rs1.getString("ani") + "\",\"" + "Total Amount: " + "\",\"" + rs1.getString("cost") + "\"\r\n";
                             strBuffer.append(trail);
                        }else{
                             String trail = "\"2\"" + ",\"" + "usercode: " + "\",\"" + rs1.getString("usercode") + "\",\"" + "Total Amount: " + "\",\"" + rs1.getString("cost") + "\"\r\n";
                             strBuffer.append(trail);
                        preContractCode = currentContractCode;     
                        writer.close();
                        rs2.close();
              }catch(Exception ex){
              }finally{
                   if( rs1 != null) rs1.close();
                   if( rs2 != null) rs2.close();
                   if( ps1 != null) ps1.close();
                   if( ps2 != null) ps2.close();
    i need your help!
    regards
    daniel wang

    Hi again, Daniel,
    I'm only guessing here, but unless you've made lots of mistakes when
    you copied your code to your post to the forum, your method signatures
    don't match. The definition of "genFile" in your java class is quite
    different to what you wrote in your PL/SQL wrapper.
    Also, you have defined "genFile" to be a private method -- I think it
    needs to be public.
    Also, I think the "main" method doesn't need to be in the "GenFiles"
    class -- perhaps you should remove it.
    Also, I think in your PL/SQL wrapper you need to use fully qualified
    names, so use "java.lang.String" and not just "String".
    Lastly, I think you should use the "-force" and "-resolve" flags
    with the "loadjava" command.
    Good Luck,
    Avi.

  • How to call java stored procedure using RMI?

    Is it possible to make a call to java stored procedure using RMI. ?
    How can I run the RMI registry on the Oracle Server ?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Thomas Grounds ([email protected]):
    Is it possible to make a call to java stored procedure using RMI. ?
    In principle it is possible. See the Java-Doc.s of Oracle 8.1.6.
    I have successful granted the java.net.SocketPermissions in my USER_JAVA_POLICY view (see Doc.) Now I was able to use the RMI-Sockets, but following
    failure try to connect to RMI-Object via RMIregistry an Oracle Error occurs
    ORA-03113: end-of-file on communication channel
    and after that my Oracle Connection is closed.
    How can I run the RMI registry on the Oracle Server ?<HR></BLOCKQUOTE>
    I think you do not need the RMI registry on Oracle Server. It should be possible to start the RMI registry wherever you want in your network and access it via the right registry string.
    Ciao
    Margit
    null

  • Procedure or Java Stored procedure to send message/xml/data to MQ Series Qu

    Hi
    Using a simple Oracle Procedure or Oracle's Java stored procedure, I would like to send data to MQ Queue. It would be great if someone can help me with a piece of sample code.
    Thanks in Advance
    -GV

    Hi Prabhu, Vlad
    This is the same question which i asked few days back.
    Our Backend system, only understands ISO8583 message format. And since I work in a financial environment, I can only send and receive data using "socket" protocol (tcp/ip).
    So, This is where I have stuck forever...
    I create a BS. select "any xml" . Then, I select "socket" as protocol. and click on finish.
    Then, I create a Proxy Service based on my BS.
    But, where/how do I convert the input xml packet into an ISO8583 format and send it over to my backend system ???
    salil

  • Calling EJB from Java Stored Procedures

    Hi,
    I am trying to call an Enterprise Java Bean from stored procedure. This stored procedure calls a java program. As long as it is a simple java program it works fine and loadjava.exe does not give any problem (neither compile-time nor run-time).
    It is not working when I am trying to call EJB from it. It is giving compile-time error.
    If anybody has implemented the same please suggest how to go forward.
    thanks in advance,
    Shashank Agarwal

    I tried the same thing without any luck. I assume you are using OC4J for your EJB ...
    The compiling issue may be because you don't have the classes in your EJB client jar loaded into the database. Once those classes are loaded, you should loadjava without any problem.
    However, you won't be able to call the EJB server because the EJB client (your Java code in the DB) will need the OC4J environment (oc4j.jar). I have tried to load oc4j.jar into the DB as well, and that was a big mess and nothing worked. My DB is 8.1.7, maybe the new 9i have OC4J libs bundled?!?
    I looked around and only found 2 alternatives:
    1. Write a JSP page that acts like an EJB client, then use URLConnection in your DB java code to send params to the JSP for it to invlode the EJB
    2. Replace the JSP with RMI code, and use RMI instead of URLConnection in your DB code to invloke the EJB client.
    If you find any other solution, please share it here.
    Good luck!
    Hi,
    I am trying to call an Enterprise Java Bean from stored procedure. This stored procedure calls a java program. As long as it is a simple java program it works fine and loadjava.exe does not give any problem (neither compile-time nor run-time).
    It is not working when I am trying to call EJB from it. It is giving compile-time error.
    If anybody has implemented the same please suggest how to go forward.
    thanks in advance,
    Shashank Agarwal

  • 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

  • Loading jar files and calling java stored procedure

    I am trying to load jai_core.jar, jai_codec.jar, mlibwrapper.jar and another class I created into my project schema. I am having problems with resolving all of the class using the "loadjava -resolve" command as well as using the "alter java class" command. The single class I authored is not in a valid state as well as the PL/SQL wrapper for the function I am calling.
    My questions are:
    1) Does the single class need to be in a valid state before the PL/SQL wrapper will compile and be in a valid state itself?
    2) Are there any special tricks to this becuase the code I am using below doesn't seem to be working correctly?
    3. Should I worry about "resolving/validating" all of the class from the jar file? I have read conflicting views on this topic.
    SQL> CREATE OR REPLACE FUNCTION get_image (p_fileName in varchar2, p_offset in number )
    2 RETURN blob AS LANGUAGE Java
    3 NAME 'gov.irs.rtr.image.ImageUtilityFunction.getImage (java.lang.String, int) RETURN oracle.sql.BLOB';
    4 /
    Warning: Function created with compilation errors.
    SQL> show err
    Errors for FUNCTION GET_IMAGE:
    LINE/COL ERROR
    0/0 PL/SQL: Compilation unit analysis terminated
    3/1 PLS-00311: the declaration of
    "gov.irs.rtr.image.ImageUtilityFunction.getImage
    (java.lang.String, int) RETURN oracle.sql.BLOB" is incomplete or
    malformed
    Any help would be greatly appreciated.
    Regards,
    Joey

    We are using Oracle 9.2.0.8 and I have written the single class in 1.3.1.
    The first loadjava commands I tried were:
    loadjava -user username/password -resolve -resolver '((* RTRPROD)(* PUBLIC))' jai_core.jar jai_codec.jar mlibwrapper_jai.jar
    loadjava loadjava -user username/password -resolve -resolver '((* RTRPROD)(* PUBLIC) (* -))' ImageUtility.class
    Then I tried:
    loadjava -user username/password -resolve -resolver '((* RTRPROD)(* PUBLIC) (* -))' jai_core.jar jai_codec.jar mlibwrapper_jai.jar
    errors : class javax/media/jai/operator/EncodeDescriptor
    ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
    errors : class javax/media/jai/operator/FileStoreDescriptor
    ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
    errors : class com/sun/media/jai/opimage/BMPRIF
    ORA-29534: referenced object RTRPROD.com/sun/media/jai/opimage/CodecRIFUtil could not be resolved
    errors : class com/sun/media/jai/opimage/CodecRIFUtil
    ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
    errors : class com/sun/media/jai/opimage/EncodeRIF
    ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
    errors : class com/sun/media/jai/opimage/FPXRIF
    ORA-29534: referenced object RTRPROD.com/sun/media/jai/opimage/CodecRIFUtil could not be resolved
    errors : class com/sun/media/jai/opimage/GIFRIF
    ORA-29534: referenced object RTRPROD.com/sun/media/jai/opimage/CodecRIFUtil could not be resolved
    errors : class com/sun/media/jai/opimage/IIPCRIF
    ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
    This error messages goes on and on for 44 files.
    I have found out that JAI is part of the Oracle 9 Release 2 but is part of the InterMedia package that is not installed. I would imagine that the JAI libraries mentioned above would be included in InterMedai. However, there are several dependencies on packages distributed in the Sun JDK but not the Oracle Runtime.
    Regards,
    Joey

  • 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.

  • Issue with sending mail through java stored procedure in Oracle

    Hello
    I am using Oracle 9i DB. I created a java stored procedure to send mail using the code given below. The java class works fine standalone. When its run from Java, mail is sent as desired. But when the java stored procedure is called from pl/sql "Must issue a STARTTLS command first" error is thrown. Please let me know if am missing something. Tried the same code in 11.2.0.2 DB and got the same error
    Error:
    javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. va6sm31201010igc.6
    Code for creating java stored procedure: (T1 is the table created for debugging)
    ==================================================
    create or replace and compile java source named "MailUtil1" AS
    import java.util.Enumeration;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class MailUtil1 {
    public static void sendMailwithSTARTTLS(String host, //smtp.projectp.com
    String from, //sender mail id
    String fromPwd,//sender mail pwd
    String port,//587
    String to,//recepient email ids
    String cc,
    String subject,
    String messageBody) {
    try{
    Properties props = System.getProperties();
    props.put("mail.smtp.starttls.enable", "True"); // added this line
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.user", from);
    props.put("mail.smtp.password", fromPwd);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.auth", "true");
    #sql { insert into t1 (c1) values ('1'||:host)};
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    #sql { insert into t1 (c1) values ('2')};
    InternetAddress[] toAddress = new InternetAddress[1];
    // To get the array of addresses
    for( int i=0; i < toAddress.length; i++ ) { // changed from a while loop
    toAddress[i] = new InternetAddress(to);
    //System.out.println(Message.RecipientType.TO);
    for( int i=0; i < toAddress.length; i++) { // changed from a while loop
    message.addRecipient(Message.RecipientType.TO, toAddress);
    if (cc!=null) {
    InternetAddress [] ccAddress = new InternetAddress[1];
    for(int j=0;j<ccAddress.length;j++){
    ccAddress[j] = new InternetAddress(cc);
    for (int j=0;j<ccAddress.length;j++){
    message.addRecipient(Message.RecipientType.CC, ccAddress[j]);
    message.setSubject(subject);
    message.setText(messageBody);
    message.saveChanges();
    #sql { insert into t1 (c1) values ('3')};
    Enumeration en = message.getAllHeaderLines();
    String token;
    while(en.hasMoreElements()){
    token ="E:"+en.nextElement().toString();
    #sql { insert into t1 (c1) values (:token)};
    token ="ConTyp:"+message.getContentType();
    #sql { insert into t1 (c1) values (:token)};
    token = "Encod:"+message.getEncoding();
    #sql { insert into t1 (c1) values (:token)};
    token = "Con:"+message.getContent();
    #sql { insert into t1 (c1) values (:token)};
    Transport transport = session.getTransport("smtp");
    #sql { insert into t1 (c1) values ('3.1')};
    transport.connect(host, from, fromPwd);
    #sql { insert into t1 (c1) values ('3.2')};
    transport.sendMessage(message, message.getAllRecipients());
    #sql { insert into t1 (c1) values ('3.3')};
    transport.close();
    #sql { insert into t1 (c1) values ('4')};
    catch(Exception e){
    e.printStackTrace();
    String ex= e.toString();
    try{
    #sql { insert into t1 (c1) values (:ex)};
    catch(Exception e1)
    Edited by: user12050615 on Jan 16, 2012 12:18 AM

    Hello,
    Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
    So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
    Thanks
    Srikanth
    Edited by: user12050615 on Jan 16, 2012 12:17 AM

Maybe you are looking for

  • How to turn off continuous play of podcasts?

    I know this should be a simple answer, but I can't find it anywhere. Thanks in advance for an answer. I want my podcasts to stop playing in between each episode, but they don't. I don't have the shuffle or repeat icons selected. The same thing happen

  • Writing a binary file

    Hi, I have trouble when writing a binary file. Here is what I do: I have some VI's collecting various data for a fixed period of time. I put all the data into 1D arrays at a fixed frequency (they all have the same size). Once it is done I merge all t

  • Graphics in Language Translation

    Platform: WinXP 64-bit / Adobe CS5 Design Premium Hi, Is there a preferred method for handling graphics (and leaders/callouts) in InDesign for language translation? And while I'm at it, ditto for content reuse. I realize that translation & single-sou

  • Where from to download older OSX version (10.9)?

    Hi. I just bought a new Mac. Thrilling... It comes with Yosemite, however my studio driver (UAD) support still older version only (10.9), so I need to downgrade my OSX version. What is the recommended download link for older OSX version (latest 10.9)

  • Safari 6 woes

    Since upgrading to Safari 6 then running the Mountain Lion upgrade I have been enjoying(!) the following opportunities for Apple to do some debugging:- 1) Occasionally (typically after the browser has got confused), either partial or no part of the w