Home » Developer & Programmer » JDeveloper, Java & XML » Problem during loadjava execution (Oracle10g,Window 2000)
Problem during loadjava execution [message #352547] Wed, 08 October 2008 06:29 Go to next message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
Hi All,

I am using Oracle10g on window machine.

I want to load a jar file into oracle using loadjava utility.
In my jar file I am using java security package(keystore etc).
I am facing below problem during javaload..

E:\DSDB\java>loadjava -user testdb/testdb -verbose -resolver "((*testdb)(*public)(* -))" -force -resolve -genmissing Xecure.jar
arguments: '-user' 'testdb/testdb' '-verbose' '-force' '-resolve' '-genmissing' 'XSecure.jar' '-resolver' '((*testdb)(
public)(* -))'
creating : resource META-INF/MANIFEST.MF with resolver ((*testdb)(*public)(* -))
loading  : resource META-INF/MANIFEST.MF
genmissing: com/nub/test/Test
creating : class com/nub/test/Test with resolver ((*testdb)(*public)(* -))
loading  : class com/nub/test/Test
genmissing: com/nub/test/Testcase
creating : class com/nub/test/Testcase with resolver ((*testdb)(*public)(* -))
loading  : class com/nub/test/Testcase
genmissing: com/mycompany/beans/KeyRelatedInformation
creating : class com/mycompany/beans/KeyRelatedInformation with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/beans/KeyRelatedInformation
genmissing: com/mycompany/beans/Participant
genmissing: com/mycompany/datasecure/XSecure
creating : class com/mycompany/datasecure/XSecure with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/datasecure/XSecure
genmissing: com/mycompany/datasecure/ResourceDTO
creating : class com/mycompany/datasecure/ResourceDTO with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/datasecure/ResourceDTO
genmissing: com/mycompany/datasecure/ResourceParser
creating : class com/mycompany/datasecure/ResourceParser with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/datasecure/ResourceParser
genmissing: com/mycompany/datasecure/keystore/KeyStoreHandlerImpl
creating : class com/mycompany/datasecure/keystore/KeyStoreHandlerImpl with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/datasecure/keystore/KeyStoreHandlerImpl
genmissing: com/mycompany/datasecure/keystore/SecurityProviderLoader
creating : class com/mycompany/datasecure/keystore/SecurityProviderLoader with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/datasecure/keystore/SecurityProviderLoader
genmissing: com/mycompany/datasecure/keystore/api/IKeyStoreHandler
creating : class com/mycompany/datasecure/keystore/api/IKeyStoreHandler with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/datasecure/keystore/api/IKeyStoreHandler
genmissing: com/mycompany/datasecure/keystore/api/XKeyStoreException
creating : class com/mycompany/datasecure/keystore/api/XKeyStoreException with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/datasecure/keystore/api/XKeyStoreException
genmissing: com/mycompany/exception/XCommonException
creating : class com/mycompany/exception/XCommonException with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/exception/XCommonException
genmissing: com/mycompany/jce/provider/mycompanyKeyStore
creating : class com/mycompany/jce/provider/mycompanyKeyStore with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/jce/provider/mycompanyKeyStore
genmissing: com/mycompany/jce/provider/mycompanyProvider
creating : class com/mycompany/jce/provider/mycompanyProvider with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/jce/provider/mycompanyProvider
genmissing: com/mycompany/nukeystore/HexString
creating : class com/mycompany/nukeystore/HexString with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/nukeystore/HexString
genmissing: com/mycompany/nukeystore/mycompanyException
creating : class com/mycompany/nukeystore/mycompanyException with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/nukeystore/mycompanyException
genmissing: com/mycompany/nukeystore/XFileKeyStore
creating : class com/mycompany/nukeystore/XFileKeyStore with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/nukeystore/XFileKeyStore
genmissing: com/mycompany/nukeystore/XKeyStore
creating : class com/mycompany/nukeystore/XKeyStore with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/nukeystore/XKeyStore
genmissing: com/mycompany/nukeystore/XKeyStoreEntry
creating : class com/mycompany/nukeystore/XKeyStoreEntry with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/nukeystore/XKeyStoreEntry
genmissing: com/mycompany/nukeystore/XKeyStoreType$1
creating : class com/mycompany/nukeystore/XKeyStoreType$1 with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/nukeystore/XKeyStoreType$1
genmissing: com/mycompany/nukeystore/XKeyStoreType
creating : class com/mycompany/nukeystore/XKeyStoreType with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/nukeystore/XKeyStoreType
genmissing: com/mycompany/nukeystore/XPKCS12
creating : class com/mycompany/nukeystore/XPKCS12 with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/nukeystore/XPKCS12
genmissing: com/mycompany/nukeystore/XX509
creating : class com/mycompany/nukeystore/XX509 with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/nukeystore/XX509
genmissing: com/mycompany/util/CastorUtil
creating : class com/mycompany/util/CastorUtil with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/util/CastorUtil
genmissing: com/mycompany/util/ResourceUtil
creating : class com/mycompany/util/ResourceUtil with resolver ((*testdb)(*public)(* -))
loading  : class com/mycompany/util/ResourceUtil
creating : resource mapping.xml with resolver ((*testdb)(*public)(* -))
loading  : resource mapping.xml
generating: java/security/KeyStore$ProtectionParameter
creating : class java/security/KeyStore$ProtectionParameter with resolver ((*testdb)(*public)(* -))
loading  : class java/security/KeyStore$ProtectionParameter
Error while creating class java/security/KeyStore$ProtectionParameter
    ORA-29545: badly formed class: User has attempted to load a class (java.security.KeyStore$ProtectionParameter) into
a restricted package. Permission can be granted using  dbms_java.grant_permission(<user>, LoadClassInPackage...
ORA-06512: at line 1

generating: java/security/KeyStore$Entry
creating : class java/security/KeyStore$Entry with resolver ((*testdb)(*public)(* -))
loading  : class java/security/KeyStore$Entry
Error while creating class java/security/KeyStore$Entry
    ORA-29545: badly formed class: User has attempted to load a class (java.security.KeyStore$Entry) into a restricted
ackage. Permission can be granted using  dbms_java.grant_permission(<user>, LoadClassInPackage...
ORA-06512: at line 1

generating: java/security/KeyStore$PrivateKeyEntry
creating : class java/security/KeyStore$PrivateKeyEntry with resolver ((*testdb)(*public)(* -))
loading  : class java/security/KeyStore$PrivateKeyEntry
Error while creating class java/security/KeyStore$PrivateKeyEntry
    ORA-29545: badly formed class: User has attempted to load a class (java.security.KeyStore$PrivateKeyEntry) into a r
stricted package. Permission can be granted using  dbms_java.grant_permission(<user>, LoadClassInPackage...
ORA-06512: at line 1

generating: java/security/KeyStore$PasswordProtection
creating : class java/security/KeyStore$PasswordProtection with resolver ((*testdb)(*public)(* -))
loading  : class java/security/KeyStore$PasswordProtection
Error while creating class java/security/KeyStore$PasswordProtection
    ORA-29545: badly formed class: User has attempted to load a class (java.security.KeyStore$PasswordProtection) into
 restricted package. Permission can be granted using  dbms_java.grant_permission(<user>, LoadClassInPackage...
ORA-06512: at line 1

generating: java/security/KeyStore$SecretKeyEntry
creating : class java/security/KeyStore$SecretKeyEntry with resolver ((*testdb)(*public)(* -))
loading  : class java/security/KeyStore$SecretKeyEntry
Error while creating class java/security/KeyStore$SecretKeyEntry
    ORA-29545: badly formed class: User has attempted to load a class (java.security.KeyStore$SecretKeyEntry) into a re
tricted package. Permission can be granted using  dbms_java.grant_permission(<user>, LoadClassInPackage...
ORA-06512: at line 1

skipping : resource META-INF/MANIFEST.MF
resolving: class com/nub/test/Test
resolving: class com/nub/test/Testcase
skipping : class com/mycompany/beans/KeyRelatedInformation
skipping : class com/mycompany/beans/Participant
skipping : class com/mycompany/beans/Resource
skipping : class com/mycompany/beans/ResourceKey
skipping : class com/mycompany/beans/SecureResources
resolving: class com/mycompany/constants/IKeyRotationConstants
skipping : class com/mycompany/crypto/CryptoHandlerImpl
skipping : class com/mycompany/crypto/ICryptoHandler
skipping : class com/mycompany/datasecure/XSecure
skipping : class com/mycompany/datasecure/ResourceDTO
skipping : class com/mycompany/datasecure/ResourceParser
skipping : class com/mycompany/datasecure/keystore/KeyStoreHandlerImpl
skipping : class com/mycompany/datasecure/keystore/SecurityProviderLoader
skipping : class com/mycompany/datasecure/keystore/api/IKeyStoreHandler
skipping : class com/mycompany/datasecure/keystore/api/XKeyStoreException
skipping : class com/mycompany/exception/XCommonException
resolving: class com/mycompany/jce/provider/mycompanyKeyStore
resolving: class com/mycompany/jce/provider/mycompanyProvider
skipping : class com/mycompany/nukeystore/HexString
skipping : class com/mycompany/nukeystore/mycompanyException
skipping : class com/mycompany/nukeystore/XFileKeyStore
skipping : class com/mycompany/nukeystore/XKeyStore
skipping : class com/mycompany/nukeystore/XKeyStoreEntry
skipping : class com/mycompany/nukeystore/XKeyStoreType$1
skipping : class com/mycompany/nukeystore/XKeyStoreType
skipping : class com/mycompany/nukeystore/XPKCS12
skipping : class com/mycompany/nukeystore/XX509
skipping : class com/mycompany/util/CastorUtil
skipping : class com/mycompany/util/ResourceUtil
skipping : resource mapping.xml
The following operations failed
    class java/security/KeyStore$ProtectionParameter: creation (createFailed)
    class java/security/KeyStore$Entry: creation (createFailed)
    class java/security/KeyStore$PrivateKeyEntry: creation (createFailed)
    class java/security/KeyStore$PasswordProtection: creation (createFailed)
    class java/security/KeyStore$SecretKeyEntry: creation (createFailed)
exiting  : Failures occurred during processing

E:\DSDB\java>



I think my schema user doesn't have permission to access java security classes. So i have provided some permission to user from dba account. here is what I did
-- from DBA account
begin
  dbms_java.grant_permission(
     grantee => 'TESTDB',
     permission_type => 'java.util.PropertyPermission',
     permission_name => '*',
     permission_action => 'read,write'
  );
  dbms_java.grant_permission(
     grantee => 'TESTDB',
     permission_type => 'java.net.SocketPermission',
     permission_name => '*',
     permission_action => 'connect,resolve'
   );
   
   dbms_java.grant_permission(
           grantee => 'TESTDB',
           permission_type => 'SYS:oracle.aurora.security.JServerPermission',
           permission_name => 'loadClassInPackage.*',
           permission_action => null
   );
   
    dbms_java.grant_permission(
              grantee => 'TESTDB',
              permission_type => 'SYS:oracle.aurora.security.JServerPermission',
              permission_name => 'loadClassInPackage.java.*',
              permission_action => null
   );
   dbms_java.grant_permission(
                 grantee => 'TESTDB',
                 permission_type => 'SYS:oracle.aurora.security.JServerPermission',
                 permission_name => 'LoadClassInPackage.oracle.aurora.*',
                 permission_action => null
   );
   
  
commit;
end;
/

After that i again run above loadjava task but problem is still there.
To verify the same I dropped the schema and created it again with above grants,but still I am facing same problem :

Error while creating class java/security/KeyStore$SecretKeyEntry
ORA-29545: badly formed class: User has attempted to load a class (java.security.KeyStore$SecretKeyEntry) into a re
tricted package. Permission can be granted using dbms_java.grant_permission(<user>, LoadClassInPackage...
ORA-06512: at line 1


Please guide me to resolve the above issue. Is there any other way to grant permissions.

Thanx in advance.

Regards,
Rajesh Bhadu Embarassed

Sad
Re: Problem during loadjava execution [message #352560 is a reply to message #352547] Wed, 08 October 2008 06:46 Go to previous messageGo to next message
Michel Cadot
Messages: 59109
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Permission can be granted using dbms_java.grant_permission(<user>, LoadClassInPackage...

Regards
Michel
Re: Problem during loadjava execution [message #352563 is a reply to message #352547] Wed, 08 October 2008 06:54 Go to previous messageGo to next message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
@Michel
Thanx for your reply and help.
I have granted permission to TESTDB using dbms_java.grant_permission. U can refer my post.
Re: Problem during loadjava execution [message #352871 is a reply to message #352547] Thu, 09 October 2008 23:58 Go to previous messageGo to next message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
Hi All,

Please help me.

Thanx in advance. Embarassed
Re: Problem during loadjava execution [message #352909 is a reply to message #352547] Fri, 10 October 2008 03:43 Go to previous messageGo to next message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
Hi All,

Above problem has been removed by granting permission for specific class. Here is what i have done.


dbms_java.grant_permission('TESTDB','SYS:oracle.aurora.security.JServerPermission','LoadClassInPackage.java.security.KeyStore$ProtectionParameter', null );
     dbms_java.grant_permission('TESTDB','SYS:oracle.aurora.security.JServerPermission','LoadClassInPackage.java.security.KeyStore$Entry', null );
     dbms_java.grant_permission('TESTDB','SYS:oracle.aurora.security.JServerPermission','LoadClassInPackage.java.security.KeyStore$PrivateKeyEntry', null );
     dbms_java.grant_permission('TESTDB','SYS:oracle.aurora.security.JServerPermission','LoadClassInPackage.java.security.KeyStore$PasswordProtection', null );
  dbms_java.grant_permission('TESTDB','SYS:oracle.aurora.security.JServerPermission','LoadClassInPackage.java.security.KeyStore$SecretKeyEntry', null );


Now my jar file has been uploaded successfully. But when I tried to retrieve it using stored procedure I am getting below error:

Error report:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.InternalError: Prohibited package name: java.security
ORA-06512: at "TESTDB.test", line 1
ORA-06512: at line 15
29532. 00000 -  "Java call terminated by uncaught Java exception: %s"
*Cause:    A Java exception or error was signaled and could not be
           resolved by the Java code.
*Action:   Modify Java code, if this behavior is not intended.


I have gone through trace file under udump directory, in this file same exception is populated that my java class is using java.security.Key as reference that is root of problem.

This time I am getting frustrated because all the references in jar has been resolved at loading time. To make sure i have verified status of all the loaded classes, it is valid for all.



Please tell me what is the issue.

Regards,
Bhadu Embarassed Embarassed
Re: Problem during loadjava execution [message #352930 is a reply to message #352909] Fri, 10 October 2008 04:57 Go to previous messageGo to next message
Michel Cadot
Messages: 59109
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The execution leads to an exception that is not caught in the class.
This is a problem with your Java class (or the way it is used) not with Oracle which only report the exception.
For instance, if you divide by 0 in the code and don't catch this exception then Oracle will report this error.

Regards
Michel
Re: Problem during loadjava execution [message #352966 is a reply to message #352547] Fri, 10 October 2008 06:07 Go to previous message
rajesh_bhadu
Messages: 48
Registered: June 2007
Member
Thanx @Michel I got your point.
Previous Topic: How to get count of a repetating element in xml -tricky -need Help
Next Topic: How to connect to AQ using OEMS Resource Adapters with Database Persistence
Goto Forum:
  


Current Time: Wed Sep 17 09:33:19 CDT 2014

Total time taken to generate the page: 0.10725 seconds