Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: loadjava: JAR with long package names
"Ralf Jonas" <scraponly_at_hotmail.com> wrote in message news:<bcju26$jut5i$1_at_ID-6634.news.dfncis.de>...
>
> Imagine this sample Java source:
>
> public class Sample
> {
> public static long SampleTest() throws java.lang.ClassNotFoundException
> {
> Class.forName("com.dataimages.processors.access.DataAccessory");
> .
> .
>
> This code results in a java.lang.ClassNotFoundException. Obviously this
> doesn't work because the loaded class names are truncated at 30 characters.
> Classes with names less than 31 characters are loaded correctly.
>
how do you know that it's because of the package name length? i tried it on my (old) 8.1.6 system and it worked.
DataAccessory.java:
// ----
package com.dataimages.processors.access;
public class DataAccessory {
public static String boo() {
return "boo";
}
}
// ----
C:\misc>javac -d . DataAccessory.java
C:\misc>jar cvfM dataacc.jar
com\dataimages\processors\access\DataAccessory.class
adding: com/dataimages/processors/access/DataAccessory.class(in = 306)
(out= 229)(deflated 25%)
C:\misc>loadjava -verbose -user user/pass_at_host:1521:sid -thin -resolve
dataacc.jar
initialization complete
loading : com/dataimages/processors/access/DataAccessory creating : com/dataimages/processors/access/DataAccessory resolver : resolving: com/dataimages/processors/access/DataAccessory
C:\misc>sqlplus user/pass_at_sid
SQL*Plus: Release 8.1.7.0.0 - Production on Mon Jun 16 12:10:39 2003
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected to:
Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production
SQL> create or replace and compile java source named lala as
2 import com.dataimages.processors.access.DataAccessory;
3 public class loo {
4 public static String doit() {
5 try {
6 DataAccessory da;
7 Class c = Class.forName("com.dataimages.processors.access.DataAccessory");
8
9 da = (DataAccessory) c.newInstance();
10 return da.boo();
11 } catch (Exception ex) {
12 ex.printStackTrace();
13 return null;
14 } 15 } 16 };
Java created.
SQL> create or replace function lalatest return varchar2 as language java name 'loo.doit() return java.lang.String'; 2 /
Function created.
SQL> select lalatest from dual;
LALATEST
boo Received on Mon Jun 16 2003 - 11:28:42 CDT