I have an executable jar, it was compiled with java 6 and in this project datanucleus is used as ORM (an old version, 1.1.6).
The jar runs fine with java 6, 7, 8 but not with 9 (10): running it I get a lot or errors like this one on various classes:
javax.jdo.JDOFatalUserException: A property named javax.jdo.PersistenceManagerFactoryClass must be specified, or a jar file with a META-INF/services/javax.jdo.PersistenceManagerFactory entry must be in the classpath, or a property named javax.jdo.option.PersistenceUnitName must be specified.
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:856) ~[jdo2-api-2.3-eb.jar:na]
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:698) ~[jdo2-api-2.3-eb.jar:na]
at app.services.DatabaseService.inizializza(DatabaseService.java:193) ~[MyJar.jar:na]
at app.startup.DatabaseLoader.load(DatabaseLoader.java:49) ~[MyJar.jar:na]
at app.startup.Startup.inizializzaDatabasePrincipale(Startup.java:148) [MyJar.jar:na]
at app.startup.Startup.start(Startup.java:47) [MyJar.jar:na]
at app.Test.main(Test.java:81) [MyJar.jar:na]
Caused by: javax.jdo.JDOException: Exception during population of metadata for MyClass1
at org.datanucleus.jdo.JDOPersistenceManagerFactory.initialiseProperties(JDOPersistenceManagerFactory.java:429) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.jdo.JDOPersistenceManagerFactory.<init>(JDOPersistenceManagerFactory.java:260) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:173) ~[datanucleus-core-1.1.6.jar:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1956) ~[jdo2-api-2.3-eb.jar:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1951) ~[jdo2-api-2.3-eb.jar:na]
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1159) ~[jdo2-api-2.3-eb.jar:na]
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:839) ~[jdo2-api-2.3-eb.jar:na]
... 6 common frames omitted
Caused by: org.datanucleus.exceptions.NucleusUserException: Exception during population of metadata for app.dati.MyClass1
at org.datanucleus.metadata.MetaDataManager$1.run(MetaDataManager.java:2331) ~[datanucleus-core-1.1.6.jar:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at org.datanucleus.metadata.MetaDataManager.populateAbstractClassMetaData(MetaDataManager.java:2316) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.metadata.MetaDataManager.populateFileMetaData(MetaDataManager.java:2153) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaDataForUse(MetaDataManager.java:864) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:794) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.jdo.JDOPersistenceManagerFactory.initialiseProperties(JDOPersistenceManagerFactory.java:425) ~[datanucleus-core-1.1.6.jar:na]
... 17 common frames omitted
Caused by: java.lang.NullPointerException: null
at java.base/java.util.Arrays.binarySearch(Unknown Source) ~[na:na]
at org.datanucleus.store.types.TypeManager.isDefaultEmbeddedType(TypeManager.java:225) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.metadata.AbstractMemberMetaData.populate(AbstractMemberMetaData.java:477) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.metadata.ClassMetaData.populateMemberMetaData(ClassMetaData.java:543) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.metadata.ClassMetaData.populate(ClassMetaData.java:206) ~[datanucleus-core-1.1.6.jar:na]
at org.datanucleus.metadata.MetaDataManager$1.run(MetaDataManager.java:2322) ~[datanucleus-core-1.1.6.jar:na]
... 23 common frames omitted
javax.jdo.JDOFatalUserException: A property named javax.jdo.PersistenceManagerFactoryClass must be specified, or a jar file with a META-INF/services/javax.jdo.PersistenceManagerFactory entry must be in the classpath, or a property named javax.jdo.option.PersistenceUnitName must be specified.
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:856)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:698)
at app.services.DatabaseService.inizializza(DatabaseService.java:193)
at app.startup.DatabaseLoader.load(DatabaseLoader.java:49)
at app.startup.Startup.inizializzaDatabasePrincipale(Startup.java:148)
at app.startup.Startup.start(Startup.java:47)
at app.Test.main(Test.java:81)
NestedThrowablesStackTrace:
javax.jdo.JDOException: Exception during population of metadata for app.dati.MyClass1
at org.datanucleus.jdo.JDOPersistenceManagerFactory.initialiseProperties(JDOPersistenceManagerFactory.java:429)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.<init>(JDOPersistenceManagerFactory.java:260)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:173)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1956)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1951)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1159)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:839)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:698)
at app.services.DatabaseService.inizializza(DatabaseService.java:193)
at app.startup.DatabaseLoader.load(DatabaseLoader.java:49)
at app.startup.Startup.inizializzaDatabasePrincipale(Startup.java:148)
at app.startup.Startup.start(Startup.java:47)
at app.Test.main(Test.java:81)
NestedThrowablesStackTrace:
Exception during population of metadata for app.dati.MyClass1
org.datanucleus.exceptions.NucleusUserException: Exception during population of metadata for app.dati.MyClass1
at org.datanucleus.metadata.MetaDataManager$1.run(MetaDataManager.java:2331)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.datanucleus.metadata.MetaDataManager.populateAbstractClassMetaData(MetaDataManager.java:2316)
at org.datanucleus.metadata.MetaDataManager.populateFileMetaData(MetaDataManager.java:2153)
at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaDataForUse(MetaDataManager.java:864)
at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:794)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.initialiseProperties(JDOPersistenceManagerFactory.java:425)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.<init>(JDOPersistenceManagerFactory.java:260)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:173)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1956)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1951)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1159)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:839)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:698)
at app.services.DatabaseService.inizializza(DatabaseService.java:193)
at app.startup.DatabaseLoader.load(DatabaseLoader.java:49)
at app.startup.Startup.inizializzaDatabasePrincipale(Startup.java:148)
at app.startup.Startup.start(Startup.java:47)
at app.Test.main(Test.java:81)
Caused by: java.lang.NullPointerException
at java.base/java.util.Arrays.binarySearch(Unknown Source)
at org.datanucleus.store.types.TypeManager.isDefaultEmbeddedType(TypeManager.java:225)
at org.datanucleus.metadata.AbstractMemberMetaData.populate(AbstractMemberMetaData.java:477)
at org.datanucleus.metadata.ClassMetaData.populateMemberMetaData(ClassMetaData.java:543)
at org.datanucleus.metadata.ClassMetaData.populate(ClassMetaData.java:206)
at org.datanucleus.metadata.MetaDataManager$1.run(MetaDataManager.java:2322)
... 23 more
Nested Throwables StackTrace:
java.lang.NullPointerException
at java.base/java.util.Arrays.binarySearch(Unknown Source)
at org.datanucleus.store.types.TypeManager.isDefaultEmbeddedType(TypeManager.java:225)
at org.datanucleus.metadata.AbstractMemberMetaData.populate(AbstractMemberMetaData.java:477)
at org.datanucleus.metadata.ClassMetaData.populateMemberMetaData(ClassMetaData.java:543)
at org.datanucleus.metadata.ClassMetaData.populate(ClassMetaData.java:206)
at org.datanucleus.metadata.MetaDataManager$1.run(MetaDataManager.java:2322)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.datanucleus.metadata.MetaDataManager.populateAbstractClassMetaData(MetaDataManager.java:2316)
at org.datanucleus.metadata.MetaDataManager.populateFileMetaData(MetaDataManager.java:2153)
at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaDataForUse(MetaDataManager.java:864)
at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:794)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.initialiseProperties(JDOPersistenceManagerFactory.java:425)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.<init>(JDOPersistenceManagerFactory.java:260)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:173)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1956)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1951)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1159)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:839)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:698)
at app.services.DatabaseService.inizializza(DatabaseService.java:193)
at app.startup.DatabaseLoader.load(DatabaseLoader.java:49)
at app.startup.Startup.inizializzaDatabasePrincipale(Startup.java:148)
at app.startup.Startup.start(Startup.java:47)
at app.Test.main(Test.java:81)
MyClass and all the classes where I get the error are classes that were enhanced via datanucleus enhancer.
Reading something around I tried this:
java --illegal-access=permit --add-opens java.base/java.lang=ALL-UNNAMED -jar MyJar.jar
but same result.
I am just interested to run this executable jar with java 9 not to recompile the code with java 9.
I know it's a difficult from just an error message to give an answer but someone have some hint?
The code is old, the libraries used are old too but it runs fine on java 8, it's something that changed on java 9 that cause the problem.
UPDATE:
updated with the full stacktrace as requested
Related
My spark code run (even unit test of some method) suddenly failed for the
ERROR [BoneCP-pool-watch-thread] (PoolWatchThread.java:118) - Error in trying to obtain a connection. Retrying in 7000ms
java.sql.SQLException: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.setReadOnly(Unknown Source)
at com.jolbox.bonecp.ConnectionHandle.setReadOnly(ConnectionHandle.java:1324)
at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:262)
at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:115)
at com.jolbox.bonecp.PoolWatchThread.run(PoolWatchThread.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
... 13 more
Caused by: ERROR 25505: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericAuthorizer.setReadOnlyConnection(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.setReadOnly(Unknown Source)
... 8 more
This issue suddenly happens and I am using java spark/mysql. This should has nothing to do with my local db. Because I tried java code to directly write to db and it succeeded. Please help?
UPDATE:
I googled online and then find there is a folder metastore_db under my code directory (I actually found a couple of db.lck files - 1 in my home folder, 1 in spark bin, 1 in the code folder). Then, I follow some online answer to go inside and change the db.lck file's owner and right (777). Then, run the code again. Now, I got the following error and found the file was changed back to 644.
Caused by: java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:derby:;databaseName=metastore_db;create=true, username = APP. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
java.sql.SQLException: Database 'metastore_db' not found.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.Driver20.connect(Unknown Source)
at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:361)
at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)
at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:120)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:501)
at org.datanucleus.store.rdbms.RDBMSStoreManager.<init>(RDBMSStoreManager.java:298)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:631)
at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:301)
at org.datanucleus.NucleusContext.createStoreManagerForProperties(NucleusContext.java:1187)
at org.datanucleus.NucleusContext.initialise(NucleusContext.java:356)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:775)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:333)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1965)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1960)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1166)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)
at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:365)
at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:394)
at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:291)
at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:258)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:73)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:133)
at org.apache.hadoop.hive.metastore.RawStoreProxy.<init>(RawStoreProxy.java:57)
at org.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:66)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:593)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:571)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:624)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:461)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:66)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:72)
at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:5762)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:199)
at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:74)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1521)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:86)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:132)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:104)
at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:3005)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3024)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:503)
at org.apache.spark.sql.hive.client.ClientWrapper.<init>(ClientWrapper.scala:204)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.spark.sql.hive.client.IsolatedClientLoader.createClient(IsolatedClientLoader.scala:249)
at org.apache.spark.sql.hive.HiveContext.metadataHive$lzycompute(HiveContext.scala:327)
at org.apache.spark.sql.hive.HiveContext.metadataHive(HiveContext.scala:237)
at org.apache.spark.sql.hive.HiveContext.setConf(HiveContext.scala:441)
at org.apache.spark.sql.hive.HiveContext.defaultOverrides(HiveContext.scala:226)
at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:229)
at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:101)
at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:103)
at com.aktana.api.command.DSESparkDriverCommand.run(DSESparkDriverCommand.java:317)
at com.aktana.api.command.DSESparkDriverCommand.run(DSESparkDriverCommand.java:156)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
at com.aktana.api.command.DSESparkDriverCommand.run(DSESparkDriverCommand.java:170)
at io.dropwizard.cli.Cli.run(Cli.java:74)
at io.dropwizard.Application.run(Application.java:89)
at com.aktana.api.AktanaService.main(AktanaService.java:675)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.sql.SQLException: Database 'metastore_db' not found.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
... 97 more
------
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.jolbox.bonecp.PoolUtil.generateSQLException(PoolUtil.java:192)
at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:422)
at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:120)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:501)
at org.datanucleus.store.rdbms.RDBMSStoreManager.<init>(RDBMSStoreManager.java:298)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:631)
at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:301)
at org.datanucleus.NucleusContext.createStoreManagerForProperties(NucleusContext.java:1187)
at org.datanucleus.NucleusContext.initialise(NucleusContext.java:356)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:775)
... 69 more
Caused by: java.sql.SQLException: Database 'metastore_db' not found.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.Driver20.connect(Unknown Source)
at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:361)
at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)
... 81 more
Caused by: java.sql.SQLException: Database 'metastore_db' not found.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
... 97 more
This issue seems caused by a spark code unit testing was added during the fat jar build.
To fix it, all I did is deleting the metastore_db folder under the code directory.
I created quite complex project with JavaFX and now I'm having some trouble deploying it, as I never deployed any app in Java before.
I tried using Intellij "Build artificial" but I always get "Error: corrupted jarfile" when I try to open the the Jar it builds.
Any suggestions? I'm using external libraries from Maven and some local ones too if it helps...
Edit:
Ok I changed some of the settings in the Make Artificial, now I don't get that error.
I get this Exception, seems it can't file the fxml file...
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
at sample.Main.start(Main.java:20)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(Unknown Source)
at
javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
... 1 more
Exception running application sample.Main
SOLVED!: just played with the fxml files patches and it fixed it...
I'm following this guide: https://docs.oracle.com/cd/E56351_01/doc.30/e87809/getting-started-with-RESTful-services.htm#AELIG90200
but I got stuck in "F.2 Create a RESTful Service from a SQL Query".
In the folder where Oracle REST Data Services was installed, I entered the following command in a command prompt:
java -jar ords.war user test_developer "SQL Developer"
and I got this error:
java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
at java.base/java.lang.Class.getDeclaredFields0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.base/java.lang.Class.getDeclaredFields(Unknown Source)
at oracle.dbtools.injector.impl.__Reflections.constantFields(__Reflectio ns.java:30)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja va:356)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja va:378)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja va:310)
at oracle.dbtools.common.di.Services$Builder.add(Services.java:409)
at oracle.dbtools.common.di.Services$Builder.load(Services.java:474)
at oracle.dbtools.common.app.ApplicationContext.loadServices(Application Context.java:167)
at oracle.dbtools.cmdline.Commands.main(Commands.java:345)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at oracle.dbtools.jarcl.Entrypoint.main(Entrypoint.java:58)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandl er
at java.base/java.lang.ClassLoader.findClass(Unknown Source)
at oracle.dbtools.jarcl.JarClassLoader.findClass(JarClassLoader.java:63)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at java.base/java.lang.Class.getDeclaredFields0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.base/java.lang.Class.getDeclaredFields(Unknown Source)
at oracle.dbtools.injector.impl.__Reflections.constantFields(__Reflectio ns.java:30)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja va:356)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja va:378)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja va:310)
at oracle.dbtools.common.di.Services$Builder.add(Services.java:409)
at oracle.dbtools.common.di.Services$Builder.load(Services.java:474)
at oracle.dbtools.common.app.ApplicationContext.loadServices(Application Context.java:167)
at oracle.dbtools.cmdline.Commands.main(Commands.java:345)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at oracle.dbtools.jarcl.Entrypoint.main(Entrypoint.java:58)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/java.lang.ClassLoader.findClass(Unknown Source)
at oracle.dbtools.jarcl.JarClassLoader.findClass(JarClassLoader.java:63)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at java.base/java.lang.Class.getDeclaredFields0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.base/java.lang.Class.getDeclaredFields(Unknown Source)
at oracle.dbtools.injector.impl.__Reflections.constantFields(__Reflectio ns.java:30)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja va:356)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja va:378)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja va:310)
at oracle.dbtools.common.di.Services$Builder.add(Services.java:409)
at oracle.dbtools.common.di.Services$Builder.load(Services.java:474)
at oracle.dbtools.common.app.ApplicationContext.loadServices(Application Context.java:167)
at oracle.dbtools.cmdline.Commands.main(Commands.java:345)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at oracle.dbtools.jarcl.Entrypoint.main(Entrypoint.java:58)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/java.lang.ClassLoader.findClass(Unknown Source)
at oracle.dbtools.jarcl.JarClassLoader.findClass(JarClassLoader.java:63)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
null
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at oracle.dbtools.jarcl.Entrypoint.main(Entrypoint.java:58)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Unknown Sour ce)
at java.base/java.lang.Class.getDeclaredConstructors(Unknown Source)
at oracle.dbtools.injector.impl.__Reflections.getConstructorsAnnotatedWi th(__Reflections.java:56)
at oracle.dbtools.injector.impl.Constructors.getInjectConstructors(Const ructors.java:39)
at oracle.dbtools.injector.impl.DependencyGraph.annotatedConstructor(Dep endencyGraph.java:416)
at oracle.dbtools.injector.impl.DependencyGraph.dependencies(DependencyG raph.java:204)
at oracle.dbtools.injector.impl.DependencyGraph.graph(DependencyGraph.ja va:297)
at oracle.dbtools.injector.impl.DependencyGraph.<init>(DependencyGraph.j ava:55)
at oracle.dbtools.injector.impl.DependencyGraph.<init>(DependencyGraph.j ava:37)
at oracle.dbtools.injector.impl.DependencyGraph$Builder.build(Dependency Graph.java:490)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.build(InjectorImpl. java:385)
at oracle.dbtools.injector.impl.InjectorImpl$Builder.build(InjectorImpl. java:310)
at oracle.dbtools.common.di.Services$Builder.build(Services.java:416)
at oracle.dbtools.common.di.Services$Builder.build(Services.java:431)
at oracle.dbtools.conf.ConfigurationSettings.injectConfigurationSettingV alues(ConfigurationSettings.java:48)
at oracle.dbtools.common.app.ApplicationContext.<init>(ApplicationContex t.java:98)
at oracle.dbtools.common.app.ApplicationContext.<init>(ApplicationContex t.java:48)
at oracle.dbtools.cmdline.Commands.main(Commands.java:345)
... 5 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandl er
at java.base/java.lang.ClassLoader.findClass(Unknown Source)
at oracle.dbtools.jarcl.JarClassLoader.findClass(JarClassLoader.java:63)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 24 more
Why is this for? and How to fix it?
An issue with Java 9 and addressed in this SO post
Your issue can be worked around by issuing this
java -jar --add-modules java.xml.bind ords.war user test_developer "SQL Developer"
Also, if you're wanting to build RESTful Services with ORDS, you can also use SQL Developer and simply connect to the REST enabled schema and use the REST feature in the connection tree. I talk about this here.
I am using the Data Adapter Wizard in Jaspersoft Studio 5.5.1 in order to set up a Hibernate connection.
The wizard asks for the Hibernate configuration (hibernate.cfg.xml) which is what I supply. My Hibernate configuration is functional in other settings...
When I test the connection in the wizard, I get the following error:
net.sf.jasperreports.engine.JRException: java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration
at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:137)
at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:129)
at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.run(AbstractDataAdapterWizard.java:163)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(JRClassLoader.java:175)
at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:79)
... 3 more
It seems that the wizard is missing the Hibernate binaries. My question is; how to properly attach these binaries to the classpath of Jaspersoft Studio?
EDIT
One may add JARs to the classpath with 'The Database JDBC Connection' option:
But this isn't possible with the 'Hibernate Session' option:
I worked my pom was added to this line
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.6.0</version>
<type>jar</type>
</dependency>
It seem that Jaspersoft studio classpath is located at:
Jaspersoft Studio-5.5.1.final\features\jre.win32.win32.x86_64.feature_1.7.0.u25\jre\lib\ext
When I copied Hibernate JARs to the classpath above, the exception I posted in my answer changed into:
net.sf.jasperreports.engine.JRException: java.lang.reflect.InvocationTargetException
at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:147)
at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:129)
at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.run(AbstractDataAdapterWizard.java:163)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:121)
... 3 more
Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [com.microsoft.sqlserver.jdbc.SQLServerDriver]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:245)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.loadDriverIfPossible(DriverManagerConnectionProviderImpl.java:200)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildCreator(DriverManagerConnectionProviderImpl.java:156)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:95)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)
... 8 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.microsoft.sqlserver.jdbc.SQLServerDriver
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:230)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:242)
... 22 more
The new exception is due to a missing SQL Server JDBC driver. So I copied this driver to the same classpath. The exception changed into:
net.sf.jasperreports.engine.JRException: java.lang.reflect.InvocationTargetException
at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:147)
at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:129)
at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.run(AbstractDataAdapterWizard.java:163)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:121)
... 3 more
Caused by: java.lang.NoClassDefFoundError: javax/validation/ValidatorFactory
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:124)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:311)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)
... 8 more
Caused by: java.lang.ClassNotFoundException: javax.validation.ValidatorFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
This time the exception is due to a missing Bean Validation API. So I copied validation-api-1.1.0.Final.jar to Jaspersoft classpath. This was ultimately enough to connect to Hibernate.
Obs. My Hibernate is 4.3.1.
I have a webstart application which connects to a web service. The manifest has:
Permissions: all-permissions
And the jnlp has:
<security>
<all-permissions/>
</security>
However when the connection to the web service is created I get a java.lang.SecurityException: setContextClassLoader (full stack trace below). When I run the application directly (without webstart) it works fine. Is there anything that I should check or change in my setup to fix the problem?
Note: I am using Java 8. The application was working fine with build 121 but fails with build 123, 124 or 125 (the most recent one). So either my setup is fine and a bug has been introduced between b121 and b123 or a bug has been fixed in b123 which exposes a problem in my setup.
org.glassfish.hk2.api.MultiException: A MultiException has 2 exceptions. They are:
1. java.lang.SecurityException: setContextClassLoader
2. java.lang.IllegalStateException: Unable to perform operation: create on org.jvnet.hk2.internal.DynamicConfigurationServiceImpl
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:362) ~[na:na]
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:454) ~[na:na]
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:119) ~[na:na]
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2296) ~[na:na]
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:590) ~[na:na]
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:577) ~[na:na]
at org.glassfish.hk2.utilities.ServiceLocatorUtilities.enablePerThreadScope(ServiceLocatorUtilities.java:89) ~[na:na]
at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:144) ~[na:na]
at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:137) ~[na:na]
at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:352) ~[na:na]
at org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:85) ~[na:na]
at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:117) ~[na:na]
at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:114) ~[na:na]
at org.glassfish.jersey.internal.util.collection.Values$LazyValue.get(Values.java:311) ~[na:na]
at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:669) ~[na:na]
at org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:214) ~[na:na]
at org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:124) ~[na:na]
at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:97) ~[na:na]
at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:90) ~[na:na]
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:396) ~[na:na]
at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:296) ~[na:na]
at com.assylias.fund.master.impl.DefaultUserMaster.authenticate(DefaultUserMaster.java:55) ~[na:na]
at com.assylias.bigblue.gui.javafx.users.Login$AuthenticationTask.call(Login.java:342) ~[na:na]
at com.assylias.bigblue.gui.javafx.users.Login$AuthenticationTask.call(Login.java:325) ~[na:na]
at javafx.concurrent.Task$TaskCallable.call(Unknown Source) ~[na:na]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[na:1.8.0-ea]
at java.util.concurrent.CompletableFuture$AsyncRun.exec(Unknown Source) ~[na:1.8.0-ea]
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) ~[na:1.8.0-ea]
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) ~[na:1.8.0-ea]
at java.util.concurrent.ForkJoinPool.scan(Unknown Source) ~[na:1.8.0-ea]
at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) ~[na:1.8.0-ea]
at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) ~[na:1.8.0-ea]
Caused by: java.lang.SecurityException: setContextClassLoader
at java.util.concurrent.ForkJoinWorkerThread$InnocuousForkJoinWorkerThread.setContextClassLoader(Unknown Source) ~[na:1.8.0-ea]
at org.glassfish.hk2.utilities.reflection.ReflectionHelper$2.run(ReflectionHelper.java:1049) ~[na:na]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0-ea]
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.setContextClassLoader(ReflectionHelper.java:1045) ~[na:na]
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1101) ~[na:na]
at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:261) ~[na:na]
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:336) ~[na:na]
I should have read the stacktrace more carefully. The exception is thrown by java.util.concurrent.ForkJoinWorkerThread$InnocuousForkJoinWorkerThread.setContextClassLoader which is a default, no-permission, worker thread. The change has been made following this post and this is the diff.
I was accessing the web service with:
CompletableFuture.runAsync(accessWebservice());
which uses the default ForkJoinPool threadpool, which itself relies on the new InnocuousForkJoinWorkerThread, which throws an exception if setContextClassLoader is called.
Workaround:
CompletableFuture.runAsync(accessWebservice(), executor); //provide an executor