Application Class Loader problem calling virtual function

Hello everyone
I have run in to very strange behavior of JVM
I have created a class loader which allows my to load classes from
jar file, regardless that URLClassLoader supplies this functionality.
I am using this class loader to load some classes and call their virtual functions. The class diagram looks like that:
public interface I {
   public void init();
public class AAA implements
   public void init(){
public class BBB extends AAA{
   public void init(){
      //here comes implementation
}Interface I and class AAA are loaded with System Class loader and Class BBB is loaded using my class loader from jar file.
ByteStreamClassLoader  classLoader =  new ByteStreamClassLoader  ();
Class cl = classLoader. loadClass(�com.product.BBB�,true);
I myInterface = cl.newInstance();
myInterface.init();The problem is that from some unknown reason java class AAA.init() instead of BBB.init().
Can somebody help me what am I doing wrong?
Class Loader code attached below
  public class ByteStreamClassLoader   extends ClassLoader {
    protected HashMap m_cache = new HashMap();
    public void clearCashe() {
      m_cache = new HashMap();
    private String definePackage(String className) {
      StringBuilder strB = new StringBuilder();
      //Class name must be removed from the URI in order to define a package
      String[] packageArray = className.split("\\.");
      for (int i = 0; i < packageArray.length - 1; i++) {
        strB.append(packageArray).append(".");
String packageName = strB.toString();
packageName = packageName.substring(0, packageName.length() - 1);
if (getPackage(packageName) == null) {
m_logger.log(Level.FINEST, "Defining package '" + packageName + "'");
definePackage(packageName, null, null, null, null, null, null, null);
return packageName;
public synchronized Class loadClass(String name, boolean resolve) throws
ClassNotFoundException {
name = name.replaceAll("/", ".").replaceAll(".class", "");
//Try to locate the Class in cashe
Class c = (Class) m_cache.get(name);
//Try to locate the Class in the System Class Loader
if (c == null) {
try {
c = ClassLoader.getSystemClassLoader().loadClass(name);
catch (Exception ex) {}
else {
m_logger.log(Level.FINEST, "Class '" + name + "' found in cache");
//Load the class from byte array
if (c == null) {
String resourceName = name;
if (!resourceName.endsWith(".class")) {
resourceName = resourceName.concat(".class");
//Retrieve class byte representation
if (resourceName.indexOf(".") != -1) {
resourceName =
resourceName.replaceAll("\\.", "/").replaceAll("/class", ".class");
//Use the ByteStreamClassLoader to load the class from byte array
byte[] classByteArray = null;
try {
classByteArray = getResourceBytes(resourceName);
catch (IOException ex1) {
throw new ClassNotFoundException(
"Could not load class data." + ex1.getMessage());
m_logger.log(
Level.FINEST, "Loading class '" +
name + "' Byte Length: " + classByteArray.length);
String p = definePackage(name);
c = defineClass(
name,
classByteArray,
0,
classByteArray.length,
ByteStreamClassLoader.class.getProtectionDomain());
m_cache.put(name, c);
if (resolve) {
resolveClass(c);
return c;

Hello everyone
I have run in to very strange behavior of JVM
I have created a class loader which allows my to load classes from
jar file, regardless that URLClassLoader supplies this functionality.
I am using this class loader to load some classes and call their virtual functions. The class diagram looks like that:
public interface I {
   public void init();
public class AAA implements
   public void init(){
public class BBB extends AAA{
   public void init(){
      //here comes implementation
}Interface I and class AAA are loaded with System Class loader and Class BBB is loaded using my class loader from jar file.
ByteStreamClassLoader  classLoader =  new ByteStreamClassLoader  ();
Class cl = classLoader. loadClass(�com.product.BBB�,true);
I myInterface = cl.newInstance();
myInterface.init();The problem is that from some unknown reason java class AAA.init() instead of BBB.init().
Can somebody help me what am I doing wrong?
Class Loader code attached below
  public class ByteStreamClassLoader   extends ClassLoader {
    protected HashMap m_cache = new HashMap();
    public void clearCashe() {
      m_cache = new HashMap();
    private String definePackage(String className) {
      StringBuilder strB = new StringBuilder();
      //Class name must be removed from the URI in order to define a package
      String[] packageArray = className.split("\\.");
      for (int i = 0; i < packageArray.length - 1; i++) {
        strB.append(packageArray).append(".");
String packageName = strB.toString();
packageName = packageName.substring(0, packageName.length() - 1);
if (getPackage(packageName) == null) {
m_logger.log(Level.FINEST, "Defining package '" + packageName + "'");
definePackage(packageName, null, null, null, null, null, null, null);
return packageName;
public synchronized Class loadClass(String name, boolean resolve) throws
ClassNotFoundException {
name = name.replaceAll("/", ".").replaceAll(".class", "");
//Try to locate the Class in cashe
Class c = (Class) m_cache.get(name);
//Try to locate the Class in the System Class Loader
if (c == null) {
try {
c = ClassLoader.getSystemClassLoader().loadClass(name);
catch (Exception ex) {}
else {
m_logger.log(Level.FINEST, "Class '" + name + "' found in cache");
//Load the class from byte array
if (c == null) {
String resourceName = name;
if (!resourceName.endsWith(".class")) {
resourceName = resourceName.concat(".class");
//Retrieve class byte representation
if (resourceName.indexOf(".") != -1) {
resourceName =
resourceName.replaceAll("\\.", "/").replaceAll("/class", ".class");
//Use the ByteStreamClassLoader to load the class from byte array
byte[] classByteArray = null;
try {
classByteArray = getResourceBytes(resourceName);
catch (IOException ex1) {
throw new ClassNotFoundException(
"Could not load class data." + ex1.getMessage());
m_logger.log(
Level.FINEST, "Loading class '" +
name + "' Byte Length: " + classByteArray.length);
String p = definePackage(name);
c = defineClass(
name,
classByteArray,
0,
classByteArray.length,
ByteStreamClassLoader.class.getProtectionDomain());
m_cache.put(name, c);
if (resolve) {
resolveClass(c);
return c;

Similar Messages

  • Problems calling virtual functions

    Hi,
         We have code running in a shared library that appears to be incorrectly changing registers that contain function parameters before the called (virtual) function acceses the registers containing its parameters.
    Has anyone seen a similar problem ? If so does
    anyone knaw what the solution is ?
    Compiler:
    SunAMD:tbucken@win64bld 247>>> CC -V
    CC: Sun C++ 5.7 2005/01/07
    SunAMD:tbucken@win64bld 248>>> uname -a
    SunOS win64bld 5.10 Generic i86pc i386 i86pc
    solaris is running on an HP DL585 (4 cpu's)
    calling function code (We are setting up a vitual function call):
         tempdatabase->CostModel->GetCompareSelectivity
         (_lhs_base, rhsbase, rhsconverted, op, &sel_est,
         &_value_distrib );
    / Line 922
         movq     -144(%rbp), %r8
         movq     352(%r8), %r8
         movq     0(%r8), %r14
         movq     -144(%rbp), %r13
         movq     -8(%rbp), %r12
         movq     -8(%rbp), %r11
         movq     -8(%rbp), %r10
         movq     -8(%rbp), %r8
         movzbl     120(%r8), %eax
         movq     -8(%rbp), %r9
         movq     -8(%rbp), %r8
         leaq     192(%r8), %r8
         movq     %r8, 0(%rsp)
         leaq     40(%r9), %r9
         movl     %eax, %r8d
         movq     168(%r10), %rcx
         movq     152(%r11), %rdx
         movq     144(%r12), %rsi
         movq     352(%r13), %rdi
         movq     48(%r14), %r10
         movl     $0, %eax
         call     *%r10
    the function called:
    p_expr is a pointer:
    a_relation is an unsigned char
    The last 2 arguments are pointers.
    void CostModel::GetCompareSelectivity(
    p_expr                colexpr,
                        p_expr                expr2,
                        p_expr                expr2_converted,
                        a_relation           reln,
                        SelectivityEstimate      *est,
                        IHistogram          **hist )
    My uderstading of register usage during a function call on opteron (from
    http://www.x86-64.org/documentation/abi-0.96.pdf)
    %rdi - first argument - this pointer
    %rsi - second argument - colexpr
    %rdx - third argument - expr2
    %rcx - fourth argument - expr2_converted
    %r8 - fifth argument - reln
    %r9 - sixth argument - est
         %rcx and %r8 are being setup correctly by the calling function but they are changed by the code that is executed by the call psudo-op that
    calculates that virtual function address.
    setting up the function call
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at line 922 in file "dfp_compares.cpp"
    922 tempdatabase->CostModel->GetCompareSelectivity
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcbd
    0xfffffd7ffe85dcbd: ComputeSelectivity+0x038d: movq 0x0000000000000160(%r8),%r8
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcc4
    0xfffffd7ffe85dcc4: ComputeSelectivity+0x0394: movq 0x0000000000000000(%r8),%r14
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcc8
    0xfffffd7ffe85dcc8: ComputeSelectivity+0x0398: movq 0xffffffffffffff70(%rbp),%r13
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dccf
    0xfffffd7ffe85dccf: ComputeSelectivity+0x039f: movq 0xfffffffffffffff8(%rbp),%r12
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcd3
    0xfffffd7ffe85dcd3: ComputeSelectivity+0x03a3: movq 0xfffffffffffffff8(%rbp),%r11
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcd7
    0xfffffd7ffe85dcd7: ComputeSelectivity+0x03a7: movq 0xfffffffffffffff8(%rbp),%r10
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcdb
    0xfffffd7ffe85dcdb: ComputeSelectivity+0x03ab: movq 0xfffffffffffffff8(%rbp),%r8
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcdf
    0xfffffd7ffe85dcdf: ComputeSelectivity+0x03af: movzbl 0x0000000000000078(%r8),%eax
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dce4
    0xfffffd7ffe85dce4: ComputeSelectivity+0x03b4: movq 0xfffffffffffffff8(%rbp),%r9
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dce8
    0xfffffd7ffe85dce8: ComputeSelectivity+0x03b8: movq 0xfffffffffffffff8(%rbp),%r8
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcec
    0xfffffd7ffe85dcec: ComputeSelectivity+0x03bc: leaq 0x00000000000000c0(%r8),%r8
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcf3
    0xfffffd7ffe85dcf3: ComputeSelectivity+0x03c3: movq %r8,0x0000000000000000(%rsp)
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcf8
    0xfffffd7ffe85dcf8: ComputeSelectivity+0x03c8: leaq 0x0000000000000028(%r9),%r9
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcfc
    0xfffffd7ffe85dcfc: ComputeSelectivity+0x03cc: movl %eax,%r8d
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcff
    0xfffffd7ffe85dcff: ComputeSelectivity+0x03cf: movq 0x00000000000000a8(%r10),%rcx
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd06
    0xfffffd7ffe85dd06: ComputeSelectivity+0x03d6: movq 0x0000000000000098(%r11),%rdx
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd0d
    0xfffffd7ffe85dd0d: ComputeSelectivity+0x03dd: movq 0x0000000000000090(%r12),%rsi
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd15
    0xfffffd7ffe85dd15: ComputeSelectivity+0x03e5: movq 0x0000000000000160(%r13),%rdi
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd1c
    0xfffffd7ffe85dd1c: ComputeSelectivity+0x03ec: movq 0x0000000000000030(%r14),%r10
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd20
    0xfffffd7ffe85dd20: ComputeSelectivity+0x03f0: movl $0x0000000000000000,%eax
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd25
    0xfffffd7ffe85dd25: ComputeSelectivity+0x03f5: call *%r10d
    t@7 regs
    current frame: [1]
    r15 0x0000000000000000
    r14 0xfffffd7ffee61d60
    r13 0xfffffd7fed3f3890
    r12 0xfffffd7fed4573c0
    r11 0xfffffd7fed4573c0
    r10 0xfffffd7ffeaa3b20
    r9 0xfffffd7fed4573e8
    r8 0x0000000000000002
    rdi 0xfffffd7fed3ff1a8
    rsi 0x0000000000000000
    rbp 0xfffffd7ffdbfa730
    rbx 0xfffffd7ffdee1400
    rdx 0x0000000000000000
    rcx 0x0000000000000000
    rax 0x0000000000000000
    trapno 0x0000000000000001
    err 0x0000000000000000
    rip 0xfffffd7ffe85dd25:ComputeSelectivity+0x3f5 call *%r10d
    cs 0x000000000000004b
    eflags 0x0000000000000286
    rsp 0xfffffd7ffdbfa600
    ss 0x0000000000000043
    fs 0x00000000000001bb
    gs 0x0000000000000000
    es 0x0000000000000000
    ds 0x0000000000000000
    fsbase 0xfffffd7ffdee1400
    gsbase 0xffffffff80000000
    t@7
    %rcx contains 0 which is the correct value for expr2_converted
    %r8 contains 2 which is the correct value for reln
    step through the code generated by the call psudo-op
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b20
    0xfffffd7ffeaa3b20: __SLIP.THUNK__E : pushq %rbp
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b21
    0xfffffd7ffeaa3b21: __SLIP.THUNK__E+0x0001: movq %rsp,%rbp
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b24
    0xfffffd7ffeaa3b24: __SLIP.THUNK__E+0x0004: subq $0x0000000000000010,%rsp
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b28
    0xfffffd7ffeaa3b28: __SLIP.THUNK__E+0x0008: movq %rdi,0xfffffffffffffff8(%rbp)
    t@7 stepi
    %r8 is changed here:
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b2c
    0xfffffd7ffeaa3b2c: __SLIP.THUNK__E+0x000c: movq 0xfffffffffffffff8(%rbp),%r8
    t@7 p -fx $r8
    dbx: warning: The format '0x%x' is not suitable for type long long, will use 'llx' instead
    $r8 = 0x2
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b30
    0xfffffd7ffeaa3b30: __SLIP.THUNK__E+0x0010: leaq 0xfffffffffffffff8(%r8),%r8
    t@7 p -fx $r8
    dbx: warning: The format '0x%x' is not suitable for type long long, will use 'llx' instead
    $r8 = 0xfffffd7fed3ff1a8
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b34
    0xfffffd7ffeaa3b34: __SLIP.THUNK__E+0x0014: movq %r8,0xfffffffffffffff8(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b38
    0xfffffd7ffeaa3b38: __SLIP.THUNK__E+0x0018: movq 0xfffffffffffffff8(%rbp),%rdi
    t@7 stepi
    %rcx is chaged here:
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b3c
    0xfffffd7ffeaa3b3c: __SLIP.THUNK__E+0x001c: movq 0x000000000035d08d [ 0x35d08d ],%rcx
    t@7 p -fx $rcx
    dbx: warning: The format '0x%x' is not suitable for type long long, will use 'llx' instead
    $rcx = 0x0
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b43
    0xfffffd7ffeaa3b43: __SLIP.THUNK__E+0x0023: leave
    t@7 p -fx $rcx
    dbx: warning: The format '0x%x' is not suitable for type long long, will use 'llx' instead
    $rcx = 0xfffffd7ffeaa8aa0
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b44
    0xfffffd7ffeaa3b44: __SLIP.THUNK__E+0x0024: jmp *%ecx
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8aa0
    0xfffffd7ffeaa8aa0: GetCompareSelectivity : pushq %rbp
    t@7 regs
    current thread: t@7
    current frame: [1]
    r15 0x0000000000000000
    r14 0xfffffd7ffee61d60
    r13 0xfffffd7fed3f3890
    r12 0xfffffd7fed4573c0
    r11 0xfffffd7fed4573c0
    r10 0xfffffd7ffeaa3b20
    r9 0xfffffd7fed4573e8
    r8 0xfffffd7fed3ff1a0
    rdi 0xfffffd7fed3ff1a0
    rsi 0x0000000000000000
    rbp 0xfffffd7ffdbfa730
    rbx 0xfffffd7ffdee1400
    rdx 0x0000000000000000
    rcx 0xfffffd7ffeaa8aa0
    rax 0x0000000000000000
    trapno 0x0000000000000001
    err 0x0000000000000000
    rip 0xfffffd7ffeaa8aa0:GetCompareSelectivity pushq %rbp
    cs 0x000000000000004b
    eflags 0x0000000000000282
    rsp 0xfffffd7ffdbfa5f8
    ss 0x0000000000000043
    fs 0x00000000000001bb
    gs 0x0000000000000000
    es 0x0000000000000000
    ds 0x0000000000000000
    fsbase 0xfffffd7ffdee1400
    gsbase 0xffffffff80000000
    step through the function prolog:
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8aa1
    0xfffffd7ffeaa8aa1: GetCompareSelectivity+0x0001: movq %rsp,%rbp
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8aa4
    0xfffffd7ffeaa8aa4: GetCompareSelectivity+0x0004: subq $0x0000000000000190,%rsp
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8aab
    0xfffffd7ffeaa8aab: GetCompareSelectivity+0x000b: movq %rbx,0xfffffffffffffea8(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ab2
    0xfffffd7ffeaa8ab2: GetCompareSelectivity+0x0012: movq %r12,0xfffffffffffffea0(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ab9
    0xfffffd7ffeaa8ab9: GetCompareSelectivity+0x0019: movq %r13,0xfffffffffffffe98(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ac0
    0xfffffd7ffeaa8ac0: GetCompareSelectivity+0x0020: movq %r14,0xfffffffffffffe90(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ac7
    0xfffffd7ffeaa8ac7: GetCompareSelectivity+0x0027: movq %r15,0xfffffffffffffe88(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ace
    0xfffffd7ffeaa8ace: GetCompareSelectivity+0x002e: movq %rdi,0xfffffffffffffff8(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ad2
    0xfffffd7ffeaa8ad2: GetCompareSelectivity+0x0032: movq %rsi,0xfffffffffffffff0(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ad6
    0xfffffd7ffeaa8ad6: GetCompareSelectivity+0x0036: movq %rdx,0xffffffffffffffe8(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ada
    0xfffffd7ffeaa8ada: GetCompareSelectivity+0x003a: movq %rcx,0xffffffffffffffe0(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ade
    0xfffffd7ffeaa8ade: GetCompareSelectivity+0x003e: movl %r8d,0xffffffffffffffdc(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ae2
    0xfffffd7ffeaa8ae2: GetCompareSelectivity+0x0042: movq %r9,0xffffffffffffffd0(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ae6
    0xfffffd7ffeaa8ae6: GetCompareSelectivity+0x0046: movl $0x0000000000000000,0xfffffffffffffeb0(%rbp)
    check the values of expr2_converted and reln
    t@7 p expr2_converted
    expr2_converted = 0xfffffd7ffeaa8aa0
    t@7 p reln
    reln = ' '
    t@7 p -fx reln
    reln = 0xa0
    and both values are incorrect because the values in registers %rcx and %r8
    have changed.sus
    Tom

    The original release of Sun Studio 10 had problems with saving and restoring registers in some cases on AMD64. Please visit the Sun Studio patch page at
    http://developers.sun.com/prodtech/cc/downloads/patches/index.html
    Download the current patches for
    C++ Compiler
    x86 compiler backend
    C++ shared library patch for your Solaris version.

  • Influencing JAR order for Application Class Loader

              I have seen some questions about this in the past but there has never been a definitive
              reply one way of the other.
              Is it possible to influence the order in which the web application class loader
              looks through the JAR files located in the /WEB-INF/lib directory?
              I have two JAR files - one contains the base release version of some software
              and the other contains some fixes so I need the fixes JAR to be loaded first.
              Thanks
              Gary Johnson
              

    Hi Gary,
              The order jars searched in WEB-INF/lib is not defined.
              You may cosider merging those two jars in one jar.
              Regards,
              Slava Imeshev
              "Gary Johnson" <[email protected]> wrote in message
              news:[email protected]..
              >
              > I have seen some questions about this in the past but there has never been
              a definitive
              > reply one way of the other.
              >
              > Is it possible to influence the order in which the web application class
              loader
              > looks through the JAR files located in the /WEB-INF/lib directory?
              >
              > I have two JAR files - one contains the base release version of some
              software
              > and the other contains some fixes so I need the fixes JAR to be loaded
              first.
              >
              > Thanks
              > Gary Johnson
              

  • Help Needed on a similar but not same class loader problem

    Hi,
    Please help...
    There is a ClassLoader called MyLoader that overrides default findClass() method to decrypt already encrypted class files available in a separate jar file.
    MyClass also contains a public static method launchMe() method that starts off with a call similar to loadClass("ApplicationMainClass");
    The MyLoader class is also encrypted
    I modified the default launcher (c) code to:
    First find the encrypted MyLoader file then decrypt it and create a byte array.
    The byte array, along with the system class loader and other required arguments, is passed to DefineClass native method (defined in jvm.dll)
    Note: The system class loader class has been instantiated using static method ClassLoader.getSystemClassLoader() through Java's invocation API.
    The DefineClass succeeds and I'm able to instantiate MyLoader and later call launchMe() to start application.
    Now i come to the problem:
    I'm not able to use any class other that those in rt.jar (i.e.standard classes) in MyLoader class. I end up with a runtime error ClassDefNotFoundError while trying to load any third party jar.
    The classes i need are present in class path and also in the local jre's ext that i use to launch my app.
    Although i can avoid using third party jar in MyLoader but if there is any way...
    Piyush

    make sure that third party jar resides in your library.....
    or else put rt.jar and external jars under same folder
    this is matter of path.... no else than this.......
    cheers
    Rajesh42

  • Calling virtual function recursively

    Hello,
    I have a virtual function foo() in class A which, under certain conditions, will call itself.
    In a class B, which is derived from A, I am overriding foo() to call super.foo() and then execute come code.
    My question is:
    When the code in class A executes, the recursive call this.foo() will call the function in class B (because I am in a class B object), no?
    If it does, what syntax can I use to make it call the function in the context of class A, although the code is running in an object of class B?
    Thank you.

    Yes, and the obvious solution is to move the implementation in A out to a private recursive method foo_inner() and get A.foo() to just call foo_inner().

  • Plz help me out with class loader problem

    hai forum members,
    I have a code which loads class files from local disk.
    It works fine with some classes ,
    But i get this exception when i am selecting certain other class files
    I am using jdeveloper.
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Filter (wrong name: project1/Filter)
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at com.jutframe.JavaUnitTester.selectClass_actionPerformed(JavaUnitTester.java:449)
         at com.jutframe.JavaUnitTester$7.actionPerformed(JavaUnitTester.java:338)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1766)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
                        JFileChooser jfilechooser=new JFileChooser();
                        Filterclass filter=new Filterclass();
                        //Set selection mode for file chooser
                        jfilechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
                        //set file filter
                        jfilechooser.setFileFilter(filter);
                        int returnVal = jfilechooser.showOpenDialog(this);
                        if(returnVal == JFileChooser.APPROVE_OPTION)
                            try
                                    String str = jfilechooser.getSelectedFile().getName();
                                    String parent=jfilechooser.getSelectedFile().getParent();
                                     // Create a File object on the root of the directory containing the class file
                                     File file = new File(parent);
                                     // Convert File to a URL
                                     URL url = file.toURL();         
                                     URL[] urls = new URL[]{url};
                                     // Create a new class loader with the directory
                                     ClassLoader cl = new URLClassLoader(urls);
                                     StringTokenizer st = new StringTokenizer(str,".");
                                     String s = st.nextToken ();
                                     Class c = cl.loadClass(s);  //ERROR IS SHOWN IN THIS PARTICULAR LINE
                                     Object instance=c.newInstance();
    --------------------------------------------please help me trace my mistake.
    thank you all.

    i think the problem that i have set a particular class path for my class files and my application loads files from that alone.
    So plz tell me if theres any way to access the class path of a particular file dynamically?
    regards

  • Can a loaded SWF call a function that lives in the parent?

    I'm building a pretty simple Flash site in AS3. There is a
    main movie (main.swf) that simply loads different swfs via buttons
    on a main nav bar. The user clicks on a MC in "main.swf" and a
    function is called, loadMyContent("section1.swf"), is called and it
    animates in nicely. Other buttons use the same function, loading
    section2.swf, section3.swf, etc.
    I've defined how "loadMyContent()" works in the the main
    movie's document class file. It's all working fine when I just need
    to load content from a user action from the buttons that live in
    "main.swf". I want to call that same "loadContent" function from
    within "section1.swf" and have "main.swf" run it's "loadContent"
    fuction, but I can't seem to figure out how to make a child call a
    function that lives in the parent.
    Is there any way of having my child do this?
    I have a suspicion I may have to define that "loadContent"
    somewhere else, but I'm a little stumped now. I'm not really
    familiar with design patterns yet, although I want to get an
    understanding of them sometime soon. Can anyone offer some help
    with my immediate need or suggest a route to a solution?
    Thanks.

    kglad,
    Thank you very much! That worked perfectly. My section1 FLA
    is now compiling it's SWF without complaint.
    In case someone else is following this, the exact code I
    ended up using to cast "this.parent.parent" as a MovieClip is:
    MovieClip(this.parent.parent).loadMyContent("section2.swf");
    The discussion I think kglad is referencing is
    this
    discussion. If that's not it, just let me know. Again, kglad,
    thank you!

  • Dynamic class loading problem using unknown JAR archive and directory names

    I read the following article, which enlightened me a lot:
    Ted Neward: Understanding Class.forName().
    However, it took me some while to understand that my problem is the other way around:
    I know the name of the class, I know the name of the method,
    but my program/JVM does not know where to load the classes from.
    Shortly, my problem is that the server engine that I am writing
    uses two different versions of the same library.
    So I am trying out the following solution:
    My program is named TestClassPathMain.java
    Assume the two libraries are named JAR1.jar and JAR2.jar
    and the class/instance method that should
    be exposed to TestClassPathMain.java by them is named
    TestClass1.testMethod().
    As long as I was depending on just one library,
    I put JAR1.jar in the classpath before starting java,
    and I was happy for a while.
    At the moment I got the need to use another version of
    TestClass1.testMethod() packaged in JAR2.jar,
    a call would always access JAR1.jar's
    TestClass1.testMethod().
    I then decided to remove JAR1.jar from the classpath,
    and programmatically define two separate ClassLoaders, one for use
    with JAR1.jar and the other for use with JAR2.jar.
    However, the problem is only partly solved.
    Please refer to the enclosed code for details.
    (The code in the JAR1.jar/JAR2.jar is extremely simple,
    it just tells (by hardcoding) the name of the jar it is packaged in
    and instantiates another class packaged in the same jar using
    the "new" operator and calls a method on it. I don't enclose it.)
    The TestClassPathMain.java/UC1.java/UC2.java code suite was
    successfully compiled with an arbitrary of JAR1 or JAR2 in the classpath,
    however removed from the classpath at runtime.
    (I know that this could have been done (more elegantly...?) by producing an Interface,
    but I think the main problem principle is still untouched by this potential lack of elegancy(?))
    1) This problem should not be unknown to you experts out there,
    how is it generally and/or most elegantly solved?
    The "*** UC2: Variant 2" is the solution I would like best, had it only worked.
    2) And why arent "*** UC2: Variant 2" and
    "*** static UC2: Variant 2" working,
    while "*** Main: Variant 2" is?
    3) And a mal-apropos:
    Why can't I catch the NoClassDefFoundError?
    The output:
    *** Main: Variant 1 JAR 1 ***:
    Entering TestClass1.testMethod() packaged in JAR1.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR1.jar
    *** Main: Variant 1 JAR 2 ***:
    Entering TestClass1.testMethod() packaged in JAR2.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR2.jar
    *** Main: Variant 2 JAR 1 ***:
    Entering TestClass1.testMethod() packaged in JAR1.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR1.jar
    *** Main: Variant 2 JAR 2 ***:
    Entering TestClass1.testMethod() packaged in JAR2.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR2.jar
    *** UC1: Variant 1 JAR 1 ***:
    Entering TestClass1.testMethod() packaged in JAR1.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR1.jar
    *** UC1: Variant 1 JAR 2 ***:
    Entering TestClass1.testMethod() packaged in JAR2.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR2.jar
    *** static UC2: Variant 2 JAR 1 ***:
    Exception in thread "main" java.lang.NoClassDefFoundError: TestClass1
            at UC2.runFromJarVariant2_static(UC2.java:56)
            at TestClassPathMain.main(TestClassPathMain.java:52)
    TestClassPathMain.java
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    public class TestClassPathMain {
        public static void main(final String args[]) throws MalformedURLException, ClassNotFoundException, InstantiationException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
                // Commented out because I cannot catch the NoClassDefFoundError.
                // Why?
                try {
                    final TestClass1 testClass1 = new TestClass1();
                    System.out.println(
                        "\nThe class TestClass1 is of some unexplicable reason available." +
                        "\nFor the purpose of the test, it shouldn't have been!" +
                        "\nExiting");
                    System.exit(1);
                } catch (NoClassDefFoundError e) {
                    System.out.println("\nPositively confirmed that the class TestClass1 is not available:\n" + e);
                    System.out.println("\n\nREADY FOR THE TEST: ...");
                // Works fine
                System.out.println("\n*** Main: Variant 1 JAR 1 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** Main: Variant 1 JAR 2 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Works fine
                System.out.println("\n*** Main: Variant 2 JAR 1 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** Main: Variant 2 JAR 2 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Works fine
                final UC1 uc1 = new UC1();
                System.out.println("\n*** UC1: Variant 1 JAR 1 ***:");
                uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** UC1: Variant 1 JAR 2 ***:");
                uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Crashes
                System.out.println("\n*** static UC2: Variant 2 JAR 1 ***:");
                UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** static UC2: Variant 2 JAR 2 ***:");
                UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Crashes
                final UC2 uc2 = new UC2();
                System.out.println("\n*** UC2: Variant 2 JAR 1 ***:");
                uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** UC2: Variant 2 JAR 2 ***:");
                uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
        private static void runFromJarVariant1(final String jarFileURL)
            throws MalformedURLException,
                   ClassNotFoundException,
                   InstantiationException,
                   IllegalArgumentException,
                   IllegalAccessException,
                   InvocationTargetException,
                   SecurityException,
                   NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final Object testClass1 = clazz.newInstance();
            final Method testMethod1 = clazz.getMethod("testMethod", null);
            testMethod1.invoke(testClass1, null);
        private static void runFromJarVariant2(final String jarFileURL)
            throws MalformedURLException,
                   ClassNotFoundException,
                   InstantiationException,
                   IllegalArgumentException,
                   IllegalAccessException,
                   InvocationTargetException,
                   SecurityException,
                   NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final TestClass1 testClass1 = new TestClass1();
            testClass1.testMethod();
    UC1.java
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    public class UC1 {
        public void runFromJarVariant1(final String jarFileURL)
            throws MalformedURLException,
                   ClassNotFoundException,
                   InstantiationException,
                   IllegalArgumentException,
                   IllegalAccessException,
                   InvocationTargetException,
                   SecurityException,
                   NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final Object testClass1 = clazz.newInstance();
            final Method testMethod1 = clazz.getMethod("testMethod", null);
            testMethod1.invoke(testClass1, null);
    UC2.java
    import java.lang.reflect.InvocationTargetException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    public class UC2 {
        public void runFromJarVariant2(final String jarFileURL)
        throws MalformedURLException,
               ClassNotFoundException,
               InstantiationException,
               IllegalArgumentException,
               IllegalAccessException,
               InvocationTargetException,
               SecurityException,
               NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final TestClass1 testClass1 = new TestClass1();
            testClass1.testMethod();
         * Identic to the "runFromJarVariant2" method,
         * except that it is static
        public static void runFromJarVariant2_static(final String jarFileURL)
        throws MalformedURLException,
               ClassNotFoundException,
               InstantiationException,
               IllegalArgumentException,
               IllegalAccessException,
               InvocationTargetException,
               SecurityException,
               NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final TestClass1 testClass1 = new TestClass1();
            testClass1.testMethod();
    }

    2. i need to load the class to the same JVM (i.e. to
    the same environment) of the current running
    aplication, so that when the loaded class is run, it
    would be able to invoke methods on it!!!
    ClassLoader(s) do this. Try the URLClassLoader.
    (I was talking about relatively esoteric "security"
    issues when I mentioned the stuff about Class objects
    "scope".) You might use the URLClassLoader kind of
    like this.
    Pseudo-code follows:
    // setup the class loader
    URL[] urls = new URL[1];
    urls[0] = new URL("/path/to/dynamic/classes");
    URLClassLoader ucl = new URLClassLoader(urls);
    // load a class & use make an object with the default constructor
    Object tmp = ucl.loadClass("dynamic.class.name").newInstance();
    // Cast the object to a know interface so that you can use it.
    // This may be used to further determine which interface to cast
    // the class to. Or it may simply be the interface to which all
    // dynamic classes have to conform in your program.
    InterfaceImplementedByDynamicClass loadedObj =
        (InterfaceImplementedByDynamicClass)tmp;It's really not as hard as it sounds, just write a little test of
    this and you will see how it works.

  • System class loader vs application class loader

    Hello
    I have a class that uses a third partyjar which I have put in /jre/lit/ext. The class compiles but fails at runtime being unable to read the property files called in the class' constructor. I believe that is b/c the third party jars are loading w/ the system class loader and cannot "see" the property files "floating" at the same level as the class that is calling them.
    So I created a jar, of the property files, with the same directory/package structure as the location of the property files and put that in the /jre/lib/ext and STILL the same problem; cannot read the property files, the constructor fails, fugly. There is an overloaded constructor that includes a parameter for the property files, but I need to get this to work as is first. What am I missing? Please edify me. tia.

    If the 3rd party jar needs a certain properties file to initialize correctly, I doubt it would be looking for it in the class hierarchy. I mean I doubt it does:
    Properties p = new Properties();
    p.load( getClass().getResourceAsStream() );It's more likely to do:
    Properties p = new Properties();
    p.load( new FileInputStream(...) );The reason is that the property file should be easily edited by the user and users know how to move around in the file system, not in the Java jars and classpaths.
    Just a guess...

  • VPD: Problems calling a function on another schema

    Here's the setup:
    I've create a schema called "AllYourBase".  It contains all of my tables, views, functions, procs, etc.
    These tables are protected by a DBMS_RLS policy.  The policy uses a function to define its predicate which looks like this:
    create or replace function tous_filter(schemaName varchar2, tableName varchar2)
    return varchar2 is
    begin
    return  'account = sys_context(''USERENV'', ''CLIENT_IDENTIFIER'')';
    end;
    All of the tables have an account column for this to work.  So far, this is a pretty basic VPD setup.
    I have other db users that login and view data in the "AllYourBase" schema.
    So when "ArbyLong" logs in, I set sys_context('USERENV', 'CLIENT_IDENTIFIER') to "ArbyLong", and when he runs a query, he gets back his rows.
    Now, "AllYourBase" has several functions.  Here's a very contrived, simplified example of one (but it illustrates the issue I'm running into just fine):
    create or replace function getUserID
    return integer is retval integer;
    begin
    select user_id into retval from users;
    return (retval);
    end;
    When "ArbyLong" runs the equivalent query (select user_id from users), he gets back the one row where the account column is equal to "ArbyLong", as expected.
    But this getUserID function lives in the "AllYourBase" schema.  And here's the catch: I've made "AllYourBase" exempt from the policies by running "grant exempt access policy to AllYourBase".
    When "ArbyLong" runs the function getUserID, it runs in the "AllYourBase" schema and pulls ALL of the rows from the users table.
    This particular function simply errors out (since it's only expecting one row), but other functions are returning data that the logged in user shouldn't see.
    So even though there are policies in place, by calling a function on another schema who is exempt from the policies, a user is able to see all returned data and not just the rows they are normally limited to.
    Ultimately my question is this: Is there a way to enforce VPD policies when a user calls a function that lives in another schema?
    Doing my own research, the answers I've come up with are:
    * Don't use "grant exempt policy"!
    * Put the function directly into the users' schemas.  So "ArbyLong" would have his own getUserID function that would look at the "AllYourBase" users table.
    I'd rather not do either of these, so does anyone have any other ideas?  If it turns out these are the only solutions, then I'll go with one of them.
    Thanks!

    Need more info. Are you using a ViewStack or other navigator container, and trying to access a view that has not been displayed yet, due to deferred instantiation?
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex Training and Support Services

  • Problems calling a function from another function

    Hello all.
    I am trying to create a function that will loop a few other function.
    Basically the main function is this
                        private function publish(event:MouseEvent):void
                            if (doPublish.label == 'Publish')
                                // create a new NetStream object for video publishing
                                nsPublish = new NetStream(nc);
                                nsPublish.addEventListener(NetStatusEvent.NET_STATUS, nsPublishOnStatus);
                                // set the buffer time to zero since it is chat
                                nsPublish.bufferTime = 0;
                                // publish the stream by name
                                nsPublish.publish(publishName.text);
                                // add custom metadata to the stream
                                var metaData:Object = new Object();
                                metaData["description"] = "Chat using VideoChat example."
                                nsPublish.send("@setDataFrame", "onMetaData", metaData);
                                // attach the camera and microphone to the server
                                nsPublish.attachCamera(camera);
                                nsPublish.attachAudio(microphone);
                                doPublish.label = 'Stop';
                            else
                                // here we are shutting down the connection to the server
                                nsPublish.attachCamera(null);
                                nsPublish.attachAudio(null);
                                nsPublish.publish("null");
                                nsPublish.close();
                                doPublish.label = 'Publish';
    I am then trying to call that function like this
                protected function startloop():void {
                    publish(event);
    But i get the error Access of undefined property event.
    Any ideas on how i can call this function ?  I need to call it as part of a loop against a timer..
    Thanks in advance

    Need more info. Are you using a ViewStack or other navigator container, and trying to access a view that has not been displayed yet, due to deferred instantiation?
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex Training and Support Services

  • Problem calling Oracle function from Access 2007 / ADO

    Hopefully, I'm posting this in the correct forum. I'm also posting on an Access forum as I'm not entirely sure where the issue lies.
    I'm calling an Oracle function from Access 2007 using an ADO Command object.
    The function takes three input parameters and has a return value and an output parameter. The output parameter is a BLOB, and the return value is varchar2 (either "T" or "N") based on the outcome of the function.
    If I pass correct values to the function, I get the following error message (errs out on the command.execute line):
    Run-time error '-2147467259 (80004005)':
    [Oracle][ODBC][Ora]ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at line 1
    Here's the function:
    FUNCTION GET_ITEMREV_ATTACH(P_ORGANIZATION_ID IN NUMBER,
    P_INVENTORY_ITEM_ID IN NUMBER,
    P_REVISION IN VARCHAR2,
    X_DRAWING OUT BLOB) RETURN VARCHAR2 IS
    RESULT VARCHAR2(1);
    BEGIN
    RESULT := 'T';
    BEGIN
    SELECT L.FILE_DATA
    INTO X_DRAWING
    FROM FND_ATTACHED_DOCUMENTS AD,
    MTL_ITEM_REVISIONS_B IR,
    FND_DOCUMENTS_TL D,
    FND_LOBS L
    WHERE AD.ENTITY_NAME = 'MTL_ITEM_REVISIONS' AND
    AD.PK1_VALUE = IR.ORGANIZATION_ID AND
    AD.PK2_VALUE = IR.INVENTORY_ITEM_ID AND
    AD.PK3_VALUE = IR.REVISION_ID AND
    AD.CATEGORY_ID = 1001216 AND
    D.DOCUMENT_ID = AD.DOCUMENT_ID AND
    D.LANGUAGE = 'US' AND
    L.FILE_ID = D.MEDIA_ID AND
    IR.ORGANIZATION_ID = P_ORGANIZATION_ID AND
    IR.INVENTORY_ITEM_ID = P_INVENTORY_ITEM_ID AND
    IR.REVISION = P_REVISION;
    EXCEPTION
    WHEN OTHERS THEN
    RESULT := 'N';
    END;
    RETURN(RESULT);
    END GET_ITEMREV_ATTACH;
    Here's the VB code I'm using to call the function:
    Private Sub Command8_Click()
    Dim CMD As New ADODB.Command
    Dim conn As ADODB.Connection
    Dim Param1 As ADODB.Parameter
    Dim Param2 As ADODB.Parameter
    Dim Param3 As ADODB.Parameter
    Dim ParamBlob As ADODB.Parameter
    Dim ParamReturn As ADODB.Parameter
    Set conn = New ADODB.Connection
    With conn
    .ConnectionString = "Driver={Oracle in OraHome92};Dbq=OAPLY;UID=***;PWD=*******"
    .CursorLocation = adUseClient
    .Open
    End With
    Set CMD = New ADODB.Command
    Set CMD.ActiveConnection = conn
    CMD.CommandText = "immi_attach_pub.get_itemrev_attach"
    CMD.CommandType = adCmdStoredProc
    Set ParamReturn = CMD.CreateParameter("RESULT", adVarChar, adParamReturnValue, 1)
    CMD.Parameters.Append ParamReturn
    Set Param1 = CMD.CreateParameter("P_ORGANIZATION_ID", adInteger, adParamInput, 1, 6)
    CMD.Parameters.Append Param1
    Set Param2 = CMD.CreateParameter("P_INVENTORY_ITEM_ID", adInteger, adParamInput, 4, 5207)
    CMD.Parameters.Append Param2
    Set Param3 = CMD.CreateParameter("P_REVISION", adVarChar, adParamInput, 2, "04")
    CMD.Parameters.Append Param3
    Set ParamBlob = CMD.CreateParameter("X_DRAWING", adLongVarBinary, adParamOutput, 200000)
    CMD.Parameters.Append ParamBlob
    CMD.Execute , , adExecuteNoRecords *** this is where the error occurs
    conn.Close
    MsgBox CMD.Parameters("RESULT")
    End Sub
    I've tried using different data types for the varchar2 parameters (adVarChar, adBSTR, adChar) with no difference.
    If I pass a bogus value for Param3...."'04'"...the function returns "N" indicating that it actually executed something. But, when I pass the correct value "04", it returns the above mentioned error.
    I can execute the function in PL/SQL just fine, so I'm thinking there's something wrong with the parameters, datatype, or other definitions on the Access side.
    Does anyone have any thoughts? I'm at a dead end with this. Sorry for the long post. Thank you.

    I tried your code with 11107 ODBC/client/database (but with a NULL output blob for convenience sake) and got no errors.
    If you're using 92 ODBC/client, you may want to try upgrading to something more current, or at least getting the latest patch(9208) to see if that helps. Since it works for me I'm guessing it may be a resolved bug in that version.
    Hope it helps,
    Greg

  • WebLog 9 Class loader problem with an Inbound Resource Adapter

    The following code
              MessageEndpoint messageEndPoint = null;
              InboundListener listener = null;
              messageEndPoint = this.messageEndpointFactory.createEndpoint(null);
              listener = (InboundListener) messageEndPoint;
              causes a ClassCastException as the Listener class is packaged both in the ResourceAdapter and in the EAR
              holding the MessageDrivenBean: same class but two
              different class loaders !
              How can I solve this problem ?

    Turning on Debugging, found the problem:
              <[JCABindingManager] activationSpec=null>
              <[JCABindingManager] The activationSpec is null, deActivation is skipped>
              In the application.xml, I had
              1. ejb (mdb) module and then
              2. connector module
              Changed the application.xml to
              1. connector module and then
              2. ejb (mdb) module
              container then called endpointDeactivation on undeployment.

  • Custom Application Class Embed problem aka AMBIGUOUS

    package  
    com.drdynscript.examples{
    import mx.controls.Image; 
    import mx.core.Application; 
    import mx.core.BitmapAsset; 
    import nl.demonsters.debugger.MonsterDebugger; 
    public class FlexTestApp4 extends Application{
    //EXTERNAL IMAGE
    Embed(source="./assets/logo.jpg")][
    Bindable] private var logoClass:Class; 
    //UI COMPONENTS
    Bindable] public var imgLogo:Image;[
    Bindable] public var imgLogo2:Image; 
    public function FlexTestApp4(){
    super(); 
    //INITIALIZE
    init();
    private function init():void
    //MONSERT DEBUGGER
    MonsterDebugger.
    trace(this, "INIT");}
    public function createImage():void{
    var imgObj:BitmapAsset = new logoClass() as BitmapAsset;imgObj.bitmapData.noise(4);
    imgLogo2.source = imgObj;
    MY MXML
    <?xml version="1.0" encoding="utf-8"?><drdynscript:FlexTestApp4  xmlns:mx="
    http://www.adobe.com/2006/mxml" layout="absolute" xmlns:drdynscript="
    com.drdynscript.examples.*">
     <mx:Style>
     Application
     backgroundImage: Embed(source="./assets/District9.png")
    </mx:Style>  
    <mx:Image x="10" y="10" width="493" height="500" id="imgLogo" source="{logoClass}"/> //DOESNT WORK AMBIGUOUS
     <mx:Image id="imgLogo1" source="@Embed(source='./assets/logo.jpg')"/>
     <mx:Image id="imgLogo2" creationComplete="createImage()"/></drdynscript:FlexTestApp4>

    I stumbled over this problem today, too.
    First, let me say that that problem did not exist with previous versions of the JWSDP. Now with 1.2 I noticed that wscompile generates class files with the same names as the custom classes that you wish to send over the net. Either this design is complete rubbish or indeed intentional, but the users are left alone, at least till the new tutorial is released.
    The solution that seems to work for me is to simply replace the classes generated by wscompile with the original ones.
    However I do not know if this will cause any problems or is the right way to handle the situation. Hopefully anybody of the responsible engineers at Sun will comment on this.
    Regards,
    Ingo

  • Dynamic class load problem..

    Hello all,
    I am rather new to this concept of creating class loaders.
    I started on a simple test and landed into a problem right away. I have a Java class file stuffed away somewhere on m machine (at a location not on my CLASSPATH) . I just want to load that class dynamically. Here is my humble code :
    import java.io.*;
    public class DynamicClassLoadTest extends ClassLoader {
         String classFileName;
         String pathToClassFile;
         public static void main(String[] args) {
              try {
                   if(args.length != 2) {
                        System.out.println("Usage : java DynamicClassLoadTest <path to class file> <name of class file>");
                        System.exit(0);
                   System.out.println("MISSION: To dynamically load class " + args[1] + " from path : " + args[0]);
                   DynamicClassLoadTest dcl = new DynamicClassLoadTest();
                   Class cls = dcl.loadClass(args[1], args[0], true);
              catch(Exception e) {
                   System.out.println("Mission failed with error : " + e);
                   e.printStackTrace();
         public Class loadClass(String name, String path, boolean resolve)
              throws ClassNotFoundException
              this.pathToClassFile=path;
              this.classFileName= name;
              return (loadClass(name, resolve));
         public Class loadClass(String name, boolean resolve)
              throws ClassNotFoundException
              try {
                   File f = new File(pathToClassFile, name + ".class");
                   if(!f.exists())
                        throw new ClassNotFoundException("Specified class not found");
                   FileInputStream fis = new FileInputStream(f);
                   long fileSize = f.length();
                   System.out.println("Size of class file = " + fileSize);
                   byte[] classBytes = new byte[(int) fileSize];
                   int r = fis.read(classBytes);
                   System.out.println("Bytes read is " + r + " and file size is " + fileSize + " and byte array length is " + classBytes.length);
                   Class c = defineClass(name, classBytes, 0, classBytes.length);
                   System.out.println("CLASS created..");
                   return c;
              catch(Exception e) {
                   throw new ClassNotFoundException(e.getMessage());
    When I execute as :
    java DynamicClassLoadTest /Users/user1 JustTest
    the below is printed on execution :
    MISSION: To dynamically load class JustTest from path : /Users/user1
    Size of class file = 421
    Bytes read is 421 and file size is 421 and byte array length is 421
    Exception in thread "main" java.lang.NoClassDefFoundError: java/lang/Object
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
    at DynamicClassLoadTest.loadClass(DynamicClassLoadTest.java:56)
    at DynamicClassLoadTest.loadClass(DynamicClassLoadTest.java:33)
    at DynamicClassLoadTest.main(DynamicClassLoadTest.java:18)
    The class file has apparently been read fine - then why is this java/lang/object reference ?
    Any tips would be of huge help.
    Thanks.

    An extension to this.
    What should I do when I have to load a jar dynamically ? I manage to load the main class of the jar successfully. But what about classes in the jar which are invoked by this class. Say we have case as below :
    JustAJar.jar contains :
    sh-2.05a$ jar tvf JustAJar.jar
    0 Fri May 23 14:41:14 PDT 2003 META-INF/
    70 Fri May 23 14:41:14 PDT 2003 META-INF/MANIFEST.MF
    567 Fri May 23 14:40:52 PDT 2003 InvokeTheNext.class
    475 Fri May 23 14:40:52 PDT 2003 InvokeMe.class
    Now, InvokeMe is the class I instantiate :
    public class InvokeMe {
    public static void main(String[] args) {
    System.out.println("Welcome to InvokeMe");
    InvokeTheNext itn = new InvokeTheNext("InvokeMe");
    InvokeTheNext is :
    public class InvokeTheNext {
    public InvokeTheNext(String str) {
    System.out.println("Welcome to InvokeTheNext");
    System.out.println("Recd ur msg " + str);
    Now I manage to define and resolve the class InvokeMe, but when the class is invoked, the foll error is thrown :
    Resolved class with name InvokeMe successfully
    Welcome to InvokeMe
    Mission failed with error : java.lang.reflect.InvocationTargetException
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at InvokeForClassLoad.main(InvokeForClassLoad.java:46)
    Caused by: java.lang.NoClassDefFoundError: InvokeTheNext
         at InvokeMe.main(InvokeMe.java:4)
    I tried loading the entire jar file into the CLASSPATH dynamically (using System.setProperty) but that doesnt help. Any inputs please ?
    Thanks.

Maybe you are looking for

  • Help using scanner class to count chars in file

    Hi all, I am learning Java right now and ran into a problem. I need to use the Scanner class to accurately count the number of chars in a file including the line feed chars 10&13. This what I have and it currently reports a 201 byte file as having 19

  • Itunes Library and ID3 tags

    Hi, So here's my problem : I spent hours cleaning my MP3 collection and re-Writing ID3 tags in order to have a clean Itunes Library without "Blink 182" and "Blink-182" (for exemple) in the Explorer but just "Blink 182". And importing my tied up music

  • Timeout in Block Function doesn't work

    Hi, I'm using a BLOCK FUNCTION, with a timeout of 3 minutes from a attribute type, I wait for about 10 minutes, but the process still blocked... what's wrong ? can't I use a block function with timeout, or the block process need to be completed by Co

  • Accessing a Item master from across multiple operating units

    HI, We have created two operating units and two inventory org's. we have created an item in teh item master and assigned to the inventory org. now we have a scenario. one inventory org belongs to one OU and another inventory belongs to another OU. i

  • How to fix zoomed out screen?

    My iPhone crashed while I'm traveling. I was running an app when it crashed and now the screen is expanded. It still works but cannot navigate. I have tried rebooting but no help. Unfortunately I don't have my iMac/iTunes to restore it. Is there a wa