Liquibase ClassCastException on LiquibaseConfiguration when running update on MongoDB - java

Below jars are present on the classpath
mongo-java-driver-3.12.11.jar
liquibase-mongodb-4.11.0.jar
liquibase-core-4.11.0.jar
[2022-06-17 12:54:30] SEVERE [liquibase.integration] Unexpected error running Liquibase: java.lang.ClassCastException: liquibase.configuration.LiquibaseConfiguration cannot be cast to liquibase.SingletonObject
java.lang.ExceptionInInitializerError
at liquibase.ext.mongodb.database.MongoLiquibaseDatabase.getAdjustTrackingTablesOnStartup(MongoLiquibaseDatabase.java:111)
at liquibase.ext.mongodb.lockservice.MongoLockService.adjustRepository(MongoLockService.java:97)
at liquibase.nosql.lockservice.AbstractNoSqlLockService.init(AbstractNoSqlLockService.java:102)
at liquibase.nosql.lockservice.AbstractNoSqlLockService.acquireLock(AbstractNoSqlLockService.java:155)
at liquibase.nosql.lockservice.AbstractNoSqlLockService.waitForLock(AbstractNoSqlLockService.java:119)
at liquibase.Liquibase$1.run(Liquibase.java:188)
at liquibase.Scope.lambda$child$0(Scope.java:159)
at liquibase.Scope.child(Scope.java:170)
at liquibase.Scope.child(Scope.java:158)
at liquibase.Scope.child(Scope.java:137)
at liquibase.Liquibase.runInScope(Liquibase.java:1790)
at liquibase.Liquibase.update(Liquibase.java:183)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.commandline.Main.doMigration(Main.java:1543)
at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:316)
at liquibase.Scope.lambda$child$0(Scope.java:159)
at liquibase.Scope.child(Scope.java:170)
at liquibase.Scope.child(Scope.java:158)
at liquibase.Scope.child(Scope.java:137)
at liquibase.Scope.child(Scope.java:183)
at liquibase.Scope.child(Scope.java:187)
at liquibase.integration.commandline.Main$1.run(Main.java:315)
at liquibase.integration.commandline.Main$1.run(Main.java:166)
at liquibase.Scope.child(Scope.java:170)
at liquibase.Scope.child(Scope.java:144)
at liquibase.integration.commandline.Main.run(Main.java:166)
at liquibase.integration.commandline.Main.main(Main.java:145)
Caused by: liquibase.exception.UnexpectedLiquibaseException: java.lang.ClassCastException: liquibase.configuration.LiquibaseConfiguration cannot be cast to liquibase.SingletonObject
at liquibase.Scope.getSingleton(Scope.java:269)
at liquibase.Scope.getSingleton(Scope.java:252)
at liquibase.Scope.getSingleton(Scope.java:252)
at liquibase.Scope.getSingleton(Scope.java:252)
at liquibase.configuration.ConfigurationDefinition$Building.build(ConfigurationDefinition.java:323)
at liquibase.ext.mongodb.configuration.MongoConfiguration.<clinit>(MongoConfiguration.java:23)
... 27 more
Caused by: java.lang.ClassCastException: liquibase.configuration.LiquibaseConfiguration cannot be cast to liquibase.SingletonObject
at liquibase.Scope.getSingleton(Scope.java:266)
... 32 more
Not sure if this is a dependency/classpath issue. Directions appreciated
Running Liquibase 4.0.0

Related

ClassNotFound exception for ch.qos.logback.​core.status.OnConsoleStatusListener

I am actually working on creating project which wrapped the logback methods.
For this project I had tried to add OnConsoleStatusListener in logback.xml file.
enter image description here
But after running the application I get ClassNotFound exception for OnConsoleStatusListener.
I checked in logback core jar OnConsoleStatusListener is present.
I am created the multimodule project.
Below is the structure.
project structure
So could you please help with this.
error:
ERROR in ch.qos.logback.core.model.processor.StatusListenerModelHandler - Could not create an StatusListener of type [ch.qos.logback.​core.status.OnConsoleStatusListener]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.​core.status.OnConsoleStatusListener
at ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.​core.status.OnConsoleStatusListener
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:69)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:44)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:33)
at at ch.qos.logback.core.model.processor.StatusListenerModelHandler.handle(StatusListenerModelHandler.java:46)
at at ch.qos.logback.core.model.processor.DefaultProcessor.mainTraverse(DefaultProcessor.java:203)
at at ch.qos.logback.core.model.processor.DefaultProcessor.mainTraverse(DefaultProcessor.java:211)
at at ch.qos.logback.core.model.processor.DefaultProcessor.process(DefaultProcessor.java:104)
at at ch.qos.logback.core.joran.GenericXMLConfigurator.processModel(GenericXMLConfigurator.java:200)
at at ch.qos.logback.core.joran.GenericXMLConfigurator.doConfigure(GenericXMLConfigurator.java:166)
at at ch.qos.logback.core.joran.GenericXMLConfigurator.doConfigure(GenericXMLConfigurator.java:122)
at at ch.qos.logback.core.joran.GenericXMLConfigurator.doConfigure(GenericXMLConfigurator.java:65)
at at ch.qos.logback.classic.util.DefaultJoranConfigurator.configureByResource(DefaultJoranConfigurator.java:53)
at at ch.qos.logback.classic.util.DefaultJoranConfigurator.configure(DefaultJoranConfigurator.java:34)
at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:98)
at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:77)
at at ch.qos.logback.classic.spi.LogbackServiceProvider.initializeLoggerContext(LogbackServiceProvider.java:50)
at at ch.qos.logback.classic.spi.LogbackServiceProvider.initialize(LogbackServiceProvider.java:41)
at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:183)
at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:170)
at at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:453)
at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:439)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:414)
at at com.nishchay.linkedlist.utility.App.(App.java:75)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.​core.status.OnConsoleStatusListener
at at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
at at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:56)
at ... 23 common frames omitted

java.lang.ClassNotFoundException: freemarker.template.Template , trying to implement hibernate there seems to be something wrong with the freemaker

Hi whenever I try to create a java class or anything on my project I get an unexpected error on my NetBeans, I installed a hibernate plugin which was requesting for freemaker jar version 238 and which after installing the hibernate plugin every time I try to create a java class this is the error I get, thank you in advance for your help.
java.lang.ClassNotFoundException: freemarker.template.Template
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.netbeans.ProxyClassLoader.doFindClass(ProxyClassLoader.java:209)
Caused: java.lang.ClassNotFoundException: freemarker.template.Template starting from ModuleCL#58762fd2[org.netbeans.libs.freemarker] with possible defining loaders null and declared parents [org.netbeans.JarClassLoader#6dedf07b, org.netbeans.MainImpl$BootClassLoader#51efea79, ModuleCL#9e4e8cd[org.netbeans.modules.queries]]
at org.netbeans.ProxyClassLoader.doFindClass(ProxyClassLoader.java:211)
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:125)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
Caused: java.lang.NoClassDefFoundError: freemarker/template/Template
at org.netbeans.libs.freemarker.FreemarkerFactory.getScriptEngine(FreemarkerFactory.java:156)
at java.scripting/javax.script.ScriptEngineManager.getEngineByName(ScriptEngineManager.java:241)
at org.netbeans.api.scripting.Scripting$EngineManager.getEngineByName(Scripting.java:180)
at org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler.getEngine(ScriptingCreateFromTemplateHandler.java:141)
at org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler.engine(ScriptingCreateFromTemplateHandler.java:150)
at org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler.accept(ScriptingCreateFromTemplateHandler.java:65)
at org.netbeans.api.templates.CreateFromTemplateImpl.build(CreateFromTemplateImpl.java:113)
at org.netbeans.api.templates.CreateFromTemplateImpl.build(CreateFromTemplateImpl.java:73)
at org.netbeans.api.templates.FileBuilder.build(FileBuilder.java:227)
at org.netbeans.api.templates.FileBuilder.createFromTemplate(FileBuilder.java:329)
at org.openide.loaders.MultiDataObject.handleCreateFromTemplate(MultiDataObject.java:853)
at org.openide.loaders.DataObject$CreateAction.run(DataObject.java:1572)
at org.openide.loaders.DataObjectPool$1WrapAtomicAction.run(DataObjectPool.java:236)
at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:102)
at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:494)
at org.openide.loaders.DataObjectPool.runAtomicAction(DataObjectPool.java:261)
at org.openide.loaders.DataObject.invokeAtomicAction(DataObject.java:1026)
at org.openide.loaders.DataObject.createFromTemplate(DataObject.java:958)
at org.netbeans.modules.java.project.ui.NewJavaFileWizardIterator.instantiate(NewJavaFileWizardIterator.java:340)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1050)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:602)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:436)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:223)
at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:135)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1605)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1546)
at org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:67)
at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2233)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

GenericJDBCException: Could not open connection .. caused by javax.resource.ResourceException: IJ000459: Transaction is not active

My Hibernate application starts running fine, but at some point something happens (I suspect some unexpected/unhandled constraint violation) that somehow breaks everything. From that point on I keep getting this huge stacktrace that I have trouble reading.... If I restart the app, or logout and login, the problem disappears for a while...
I found a related question, but was asked in the comments to create a new one for my issue as the exception is a very generic one.
Below a snipped version of the stacktrace. Full stacktrace on pastebin.
2015-11-05 17:27:39,349 ERROR [io.undertow.request] (default task-11) UT005023: Exception handling request to /api/ratings/synch: org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Could not open connection
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76) [resteasy-jaxrs-3.0.10.Final.jar:]
...
Caused by: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Could not open connection
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:163) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
...
at net.bridalapp.db.CrudService$$$view1.find(Unknown Source) [classes:]
...
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
...
at net.bridalapp.db.CrudServiceBean.find(CrudServiceBean.java:213) [classes:]
at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) [:1.8.0_65]
...
Caused by: org.hibernate.exception.GenericJDBCException: Could not open connection
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
...
Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:154)
...
Caused by: javax.resource.ResourceException: IJ000460: Error checking for a transaction
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:415)
...
Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffffac1001d4:-67c5b6ff:563b6a43:146d8 status: ActionStatus.ABORT_ONLY >
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:399)
... 348 more
http://pastebin.com/DV7zteED
I had the same error in wildfly/hibernate. For me the problem was that I was running a long transaction and I had a massive amount of hibernate transactions, that filled up my memory. In my case the answer was, that after a specified number of transactions I did this:
em.flush();
em.clear();
HTH

Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase

I use neo4j:2.2.4. This is my error:
Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, D:\neo4j\neo4j-enterprise-2.2.4\data\new_movie
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:366)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:59)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:91)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:181)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:71)
at traverser.Traversals.startTraversing(Traversals.java:34)
at traverser.Traversals.main(Traversals.java:28)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#1f6670f' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:513)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:343)
... 6 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource#1a1f567' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:513)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115)
at org.neo4j.kernel.impl.transaction.XaDataSourceManager.start(XaDataSourceManager.java:164)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:507)
... 8 more
Caused by: org.neo4j.kernel.impl.storemigration.StoreUpgrader$UnexpectedUpgradingStoreVersionException: 'neostore.nodestore.db' has a store version number that we cannot upgrade from. Expected 'v0.A.1' but file is version 'NodeStore v0.A.5'.
at org.neo4j.kernel.impl.storemigration.UpgradableDatabase.checkUpgradeable(UpgradableDatabase.java:80)
at org.neo4j.kernel.impl.storemigration.StoreMigrator.needsMigration(StoreMigrator.java:135)
at org.neo4j.kernel.impl.storemigration.StoreUpgrader.getParticipantsEagerToMigrate(StoreUpgrader.java:268)
at org.neo4j.kernel.impl.storemigration.StoreUpgrader.migrateIfNeeded(StoreUpgrader.java:143)
at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.start(NeoStoreXaDataSource.java:344)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:507)
... 11 more
The source of your error looks like
"has a store version number that we cannot upgrade from. Expected 'v0.A.1' but file is version 'NodeStore v0.A.5'. at"
You may take a look at this post : https://github.com/jexp/batch-import/issues/101
It sort of looks like you store is semi-upgraded, although I don't know how that would have happened. Could you copy-paste contents from your <graph.db>/messages.log file, whatever is in between the last:
--- INITIALIZED diagnostics START ---
and
--- INITIALIZED diagnostics END ---
that might help in investigations. Thanks

Using securesocial module in play

I get the following error the moment I add the #With (SecureSocial.class) to protect one of the controller classes. Not sure why, since I do have it working in another project which has more classes.
Oops: VerifyError
An unexpected error occured caused by exception VerifyError: Bad return type in method controllers.securesocial.SecureSocial.loadCurrentUser()Lsecuresocial/provider/SocialUser; at offset 53
play.exceptions.UnexpectedException: Unexpected Error
at play.Invoker$Invocation.onException(Invoker.java:232)
at play.Invoker$Invocation.run(Invoker.java:273)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.VerifyError: Bad return type in method controllers.securesocial.SecureSocial.lo
adCurrentUser()Lsecuresocial/provider/SocialUser; at offset 53
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getDeclaredMethods(Class.java:1808)
at play.utils.JavaWithCaching.findAllAnnotatedMethods(Java.java:500)
at play.utils.JavaWithCaching.findAllAnnotatedMethods(Java.java:507)
at play.utils.JavaWithCaching.findAllAnnotatedMethods(Java.java:470)
at play.utils.Java.findAllAnnotatedMethods(Java.java:255)
at play.mvc.ActionInvoker.handleFinallies(ActionInvoker.java:382)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:255)
... 1 more
A VerifyError happens when the code you run is compiled against a different version than the one the JVM loads when executing the code.
How does your dependencies.yml look like? Have you run play deps in this machine?

Categories

Resources