0 Replies Latest reply on Sep 1, 2009 4:24 PM by 843849

    Prohibited package name: java.sql when Derby classes calls jsr169.jar

      I am using Netbeans6.7.1 to develope CDC apllication which runs fine on NetBeans6.7.1 CDC Device Emulator platform tp print "Hello world"

      Than, I used XML parsing code in my application and also got success by putting xercesImpl.jar, xml-apis.jar (I should used JSR280...but its just to test XML parsing) library in C:\java\netbeans6.7.1\mobility8\Java_ME_platform_SDK_3.0\runtimes\cdc-hi\lib\ext. My sample program parse XML file correctly.

      Now, I want my application to use Derby Embedded database. So, I build JSR169 (http://blogs.sun.com/wittyman/entry/building_jdbc_for_cdc_foundation) and Derby (http://svn.apache.org/viewvc/db/derby/code/trunk/BUILDING.html?view=co)

      and copied derby.jar, derbytools.jar and jsr169.jar in my Netbeans6.7.1 CDC emulator library C:\java\netbeans6.7.1\mobility8\Java_ME_platform_SDK_3.0\runtimes\cdc-hi\lib\ext

      My sample program starts Derby database and displays all information using org.apache.derby.tools.sysinfo
      But when Derby classes tries to call JSR169.jar, I am getting runtime error as
      java.lang.SecurityException: Prohibited package name: java.sql
      at java.lang.ClassLoader.defineClass(ClassLoader.java:588)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:143)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:282)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:75)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:222)
      at java.security.AccessController.doPrivileged(AccessController.java:351)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:208)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:291)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:365)

      googling issue I found two things,
      (1) As JSR169.jar is an external library which has "java.sql" package. So java security/policy is not allowing to do this
      (2) if compilation java version is higher than running environment java version. Not sure about it because I build jsr169.jar and Derby*.jar in JDK1.5.0_20 and my application source files are compiled with -source 1.5 -target 1.5 and Netbeans6.7.1 inbuilt CDC emulator is using jdk1.4.2_15 (I saw this version in Manifest file of rt.jar in C:\java\netbeans6.7.1\mobility8\Java_ME_platform_SDK_3.0\runtimes\cdc-hi\lib)

      Highly appreciate your help
      Thanks in advance