You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@trafodion.apache.org by Gunnar Tapper <ta...@gmail.com> on 2016/04/05 02:22:29 UTC

Mystical SPJ error

Hi,

This error is driving me batty. :)

The SPJ information:

[centos@trafodion trafodion-spjs]$ pwd
/home/centos/trafodion-spjs
[centos@trafodion trafodion-spjs]$ javap Payroll.class
Compiled from "Payroll.java"
public class Payroll {
  public Payroll();
  public static void adjustSalary(java.math.BigDecimal, double,
java.math.BigDecimal[]) throws java.sql.SQLException;
  public static void employeeJob(int, java.lang.Integer[]) throws
java.sql.SQLException;
  public static void projectTeam(int, java.sql.ResultSet[]) throws
java.sql.SQLException;
  public static void topSalesReps(int, java.sql.ResultSet[]) throws
java.sql.SQLException;
}

So, I add the class to Trafodion as a library.

[centos@trafodion trafodion-spjs]$ trafci

Welcome to Apache Trafodion Command Interface
Copyright (c) 2015 Apache Software Foundation

Host Name/IP Address: localhost:23400
User Name: zz

Connected to Trafodion

SQL>create library trafodion.persnl.payroll file
'/home/centos/trafodion-spjs/Payroll.class';

--- SQL operation complete.

SQL>get libraries in schema trafodion.persnl;

PAYROLL

--- SQL operation complete.

Next, I try to create a procedure but Trafodion doesn't seem to see the
Payroll class in the library file.

SQL>CREATE PROCEDURE trafodion.persnl.adjustsalary( IN empnum NUMERIC(4)
                                              , IN percent FLOAT
                                              , OUT newsalary NUMERIC(8,2)
                                              )
   EXTERNAL NAME 'Payroll.adjustSalary'
   LIBRARY trafodion.persnl.payroll
+>+>+>+>+>   LANGUAGE JAVA
   PARAMETER STYLE JAVA
   MODIFIES SQL DATA
   ;
+>+>+>+>
*** ERROR[11205] Java class 'Payroll' was not found in external path
'/home/centos/trafodion-spjs/Payroll.class'. [2016-04-05 00:16:46]
*** ERROR[1231] User-defined routine TRAFODION.PERSNL.ADJUSTSALARY could
not be created. [2016-04-05 00:16:46]

SQL>

What am I missing?

Thanks,

Gunnar
*If you think you can you can, if you think you can't you're right.*

Re: Mystical SPJ error

Posted by Gunnar Tapper <ta...@gmail.com>.
Found it. I defined the library using .class instead of .jar. Oops.

On Mon, Apr 4, 2016 at 6:22 PM, Gunnar Tapper <ta...@gmail.com>
wrote:

> Hi,
>
> This error is driving me batty. :)
>
> The SPJ information:
>
> [centos@trafodion trafodion-spjs]$ pwd
> /home/centos/trafodion-spjs
> [centos@trafodion trafodion-spjs]$ javap Payroll.class
> Compiled from "Payroll.java"
> public class Payroll {
>   public Payroll();
>   public static void adjustSalary(java.math.BigDecimal, double,
> java.math.BigDecimal[]) throws java.sql.SQLException;
>   public static void employeeJob(int, java.lang.Integer[]) throws
> java.sql.SQLException;
>   public static void projectTeam(int, java.sql.ResultSet[]) throws
> java.sql.SQLException;
>   public static void topSalesReps(int, java.sql.ResultSet[]) throws
> java.sql.SQLException;
> }
>
> So, I add the class to Trafodion as a library.
>
> [centos@trafodion trafodion-spjs]$ trafci
>
> Welcome to Apache Trafodion Command Interface
> Copyright (c) 2015 Apache Software Foundation
>
> Host Name/IP Address: localhost:23400
> User Name: zz
>
> Connected to Trafodion
>
> SQL>create library trafodion.persnl.payroll file
> '/home/centos/trafodion-spjs/Payroll.class';
>
> --- SQL operation complete.
>
> SQL>get libraries in schema trafodion.persnl;
>
> PAYROLL
>
> --- SQL operation complete.
>
> Next, I try to create a procedure but Trafodion doesn't seem to see the
> Payroll class in the library file.
>
> SQL>CREATE PROCEDURE trafodion.persnl.adjustsalary( IN empnum NUMERIC(4)
>                                               , IN percent FLOAT
>                                               , OUT newsalary NUMERIC(8,2)
>                                               )
>    EXTERNAL NAME 'Payroll.adjustSalary'
>    LIBRARY trafodion.persnl.payroll
> +>+>+>+>+>   LANGUAGE JAVA
>    PARAMETER STYLE JAVA
>    MODIFIES SQL DATA
>    ;
> +>+>+>+>
> *** ERROR[11205] Java class 'Payroll' was not found in external path
> '/home/centos/trafodion-spjs/Payroll.class'. [2016-04-05 00:16:46]
> *** ERROR[1231] User-defined routine TRAFODION.PERSNL.ADJUSTSALARY could
> not be created. [2016-04-05 00:16:46]
>
> SQL>
>
> What am I missing?
>
> Thanks,
>
> Gunnar
> *If you think you can you can, if you think you can't you're right.*
>



-- 
Thanks,

Gunnar
*If you think you can you can, if you think you can't you're right.*