NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Netbeans6.7.1 JavaME3.0 CDC app - 'Prohibited package name: java.sql' runtime exception when Derby classes uses java.sql package from 'jsr169.jar'

 
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users
View previous topic :: View next topic  
Author Message
pragun@imcsystemsuk.com



Joined: 01 Sep 2009
Posts: 2

PostPosted: Tue Sep 01, 2009 3:51 pm    Post subject: Netbeans6.7.1 JavaME3.0 CDC app - 'Prohibited package name: java.sql' runtime exception when Derby classes uses java.sql package from 'jsr169.jar' Reply with quote

Hi Friends,

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

Pragun.



cdcapplication6.zip
 Description:
Source files

Download
 Filename:  cdcapplication6.zip
 Filesize:  3.22 KB
 Downloaded:  312 Time(s)

Back to top
Petr Suchomel
Posted via mailing list.





PostPosted: Tue Sep 01, 2009 3:55 pm    Post subject: Netbeans6.7.1 JavaME3.0 CDC app - 'Prohibited package name: java.sql' runtime exception when Derby classes uses java.sql package from 'jsr169.jar' Reply with quote

You are not allowed to use packages starting with java.* and javax.* on
CDC and CLDC platforms.
--Petr

address-removed wrote:
Quote:
Hi Friends,



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



Pragun.




Attachments:
http://forums.netbeans.org//files/cdcapplication6_100.zip








--
Petr Suchomel <address-removed>
Sun Microsystems, Inc.
Phone +420 2 33009234 (x49234), Fax +420 2 33009311
Back to top
pragun@imcsystemsuk.com



Joined: 01 Sep 2009
Posts: 2

PostPosted: Tue Sep 01, 2009 4:19 pm    Post subject: Re: Netbeans6.7.1 JavaME3.0 CDC app - 'Prohibited package name: java.sql' runtime exception when Derby classes uses java.sql package from 'jsr169.jar' Reply with quote

[quote="Petr Suchomel"]You are not allowed to use packages starting with java.* and javax.* on CDC and CLDC platforms.
--Petr

JavaME3.0 release itself comes with many Optional package integration support. e.g. you can see C:\java\netbeans6.7.1\mobility8\Java_ME_platform_SDK_3.0\lib\jsr280_1.0.jar which uses javax.xml.parsers.SAXParser

Otherwise, how can anyone integrate external optional package support (say, JSR169) to JavaME application as mentioned in http://java.sun.com/javame/reference/apis.jsp ?

How can any CDC application communicates with Derby database without having JSR169 support witch uses java.sql.*, javax.sql.* ?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo