I have error in simple spring jdbc application - java

org.springframework.context.support.AbstractApplicationContext
prepareRefresh INFO: Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext#4413ee:
startup date [Fri Jun 26 16:02:03 CDT 2015]; root of context hierarchy
Exception in thread "main" java.lang.IncompatibleClassChangeError:
Implementing class
I have connection with sql table. I have include all jars that is required. I have no idea what to do with it.
Any help would be appreciated.

Related

Specified module could not being found loading DLL in JNA

I have this class initialiser:
System.setProperty("java.library.path", "C:\\Users\\lucas\\Desktop\\libraries");
System.loadLibrary("libTTARCHHelper");
TTARCH_LIBRARY=(TtarchLibrary)Native.loadLibrary(TtarchLibrary.class);
And the DLL is located at C:\\Users\\lucas\\Desktop\\libraries\\libTTARCHHelper.dll
If I run this in Eclipse I get 'The specified module could not be found' and if I run it as a JAR I get 'no libTTARCHHelper in java.library.path'.
How do I fix these? I even tried putting the DLL in a folder in the PATH environment variable.
Full debug using the file direct load:
Aug 26, 2020 12:28:51 AM com.sun.jna.Native extractFromResourcePath
INFO: Looking in classpath from jdk.internal.loader.ClassLoaders$AppClassLoader#c387f44 for /com/sun/jna/win32-x86-64/jnidispatch.dll
Aug 26, 2020 12:28:51 AM com.sun.jna.Native extractFromResourcePath
INFO: Found library resource at jar:file:/C:/Users/lucas/Desktop/My%20Stuff/Eclipse%20Workspaces/Build%20Paths/jna-5.6.0.jar!/com/sun/jna/win32-x86-64/jnidispatch.dll
Aug 26, 2020 12:28:51 AM com.sun.jna.Native extractFromResourcePath
INFO: Extracting library to C:\Users\lucas\AppData\Local\Temp\jna-103324076\jna5931694657592960137.dll
Aug 26, 2020 12:28:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Looking for library 'C:\Users\lucas\Desktop\libraries\libTTARCHHelper.dll'
Aug 26, 2020 12:28:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Adding paths from jna.library.path: null
Aug 26, 2020 12:28:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Trying C:\Users\lucas\Desktop\libraries\libTTARCHHelper.dll
Aug 26, 2020 12:28:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Loading failed with message: The specified module could not be found.
Aug 26, 2020 12:28:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Adding system paths: []
Aug 26, 2020 12:28:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Trying C:\Users\lucas\Desktop\libraries\libTTARCHHelper.dll
Aug 26, 2020 12:28:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Loading failed with message: The specified module could not be found.
Aug 26, 2020 12:28:51 AM com.sun.jna.Native extractFromResourcePath
INFO: Looking in classpath from jdk.internal.loader.ClassLoaders$AppClassLoader#c387f44 for C:\Users\lucas\Desktop\libraries\libTTARCHHelper.dll
Aug 26, 2020 12:28:51 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Loading failed with message: Native library (win32-x86-64/C:\Users\lucas\Desktop\libraries\libTTARCHHelper.dll) not found in resource path (C:\Users\lucas\eclipse-workspace\TEST\bin;C:\Users\lucas\Desktop\My Stuff\Eclipse Workspaces\Build Paths\jna-5.6.0.jar)
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'C:\Users\lucas\Desktop\libraries\libTTARCHHelper.dll':
The specified module could not be found.
The specified module could not be found.
The rest of the trace:
Native library (win32-x86-64/C:\Users\lucas\Desktop\libraries\libTTARCHHelper.dll) not found in resource path (C:\Users\lucas\eclipse-workspace\TEST\bin;C:\Users\lucas\Desktop\My Stuff\Eclipse Workspaces\Build Paths\jna-5.6.0.jar)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
at com.sun.jna.Library$Handler.<init>(Library.java:192)
at com.sun.jna.Native.loadLibrary(Native.java:646)
at com.sun.jna.Native.loadLibrary(Native.java:630)
at com.test.TTARCHHelper.<clinit>(TTARCHHelper.java:17)
at com.test.main.main(main.java:6)
Suppressed: java.lang.UnsatisfiedLinkError: The specified module could not be found.
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:191)
... 6 more
Suppressed: java.lang.UnsatisfiedLinkError: The specified module could not be found.
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:204)
... 6 more
Suppressed: java.io.IOException: Native library (win32-x86-64/C:\Users\lucas\Desktop\libraries\libTTARCHHelper.dll) not found in resource path (C:\Users\lucas\eclipse-workspace\TEST\bin;C:\Users\lucas\Desktop\My Stuff\Eclipse Workspaces\Build Paths\jna-5.6.0.jar)
at com.sun.jna.Native.extractFromResourcePath(Native.java:1095)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:275)
... 6 more
So it looks like it doesnt find it , It throws a
java.lang.UnsatisfiedLinkError: The specified module could not be found.
I found the problem, the DLLs were for the wrong bit. Eclipse runs on 64 and the JAR uses the 32bit JVM. I downloaded the 32 bit dlls too and now it works when I run the JAR. However the 64 bit dlls in Eclipse keep throwing the module exception above
JNA will look for libraries at locations in the jna.library.path environment variable.
One option is to specify it as a command line option in Eclipse's run configuration. In the Run menu, select Run Configuration. Go to the (x)=Arguments tab. Add this in the VM arguments field:
-Djna.library.path=C:\Users\lucas\Desktop\libraries
You can also programmatically set it in your code before attempting to load the DLL:
System.setProperty("jna.library.path", "C:\\Users\\lucas\\Desktop\\libraries");
As you later indicated with the debug log, it may be finding the DLL but failing to open it. Possible reasons for this can be:
The DLL is runtime-dependent on another DLL on your system that's not in the appropriate path(s). A common one is the Visual C++ Distributable.
You may need to consult the DLL documentation for more information. You can sometimes use Process Monitor from the SysInternals library to try to see what it's opening.
Having a duplicate/incompatible version of a dependent DLL as above
Running a 64-bit JVM and trying to open a DLL that's not 64-bit compatible, or vice-versa
Your Java program may not have permission to read the directory where your library is located
To help diagnose the problem, look at the full stack trace. While the most recent error message may not be relevant (file not found in a "backup" search) if you look down the trace you may see multiple suppressed exceptions from earlier attempts to open a DLL which may give you more informative debugging information.

War file failed to deploy it on Tomcat 7

I am using Grails Frame work and when i create a war file and deploy it on Tomcat-7, I am getting the below error. But some time the deployment is success.
Jul 29, 2016 10:19:23 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jul 29, 2016 10:19:23 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
2016-07-29 10:19:23,951 [localhost-startStop-1] WARN lifecycle.ShutdownOperations - Error occurred running shutdown operation: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Jul 29, 2016 10:19:23 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Jul 29, 2016 10:19:23 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
Jul 29, 2016 10:19:23 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [net.sf.ehcache.CacheManager#6b0bbde6] but has failed to stop it. This is very likely to create a memory leak.
I am not able to understand why this is happening. Can anybody tell me what is the problem here ? I believe this error is coming because its not able to connect to mysql database due to some problem.
If you Google for this phrase: SEVERE: Error listener You'll get some explanation why this is happening.
Tomcat doesn't display by default log/exception messages in Listeners and Filters initialization code.
Try adding a logging.properties file and place it to WEB-INF/classes in your war with the following content:
org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler
to make it easier you can do it automatically in BuildConfig.groovy in the following way:
grails.war.resources = { stagingDir, args ->
def tomcatLoggingProperties = '''org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler'''
new File("${stagingDir}/WEB-INF/classes/logging.properties").write tomcatLoggingProperties
}
After deploying the war to Tomcat inspect your catalina.out log file. It should now give more feedback about the problem.

Neo4j Server Startup Exception

Iam unable to start the neo4j server..iam using java 1.7 and neo4j 2.0.0 when i run the sample java with maven example, iam getting this problem. Here is the log file
Oct 09, 2013 8:49:14 AM org.neo4j.server.logging.Logger log
INFO: Setting startup timeout to: 120000ms based on -1
Oct 09, 2013 8:49:15 AM org.neo4j.server.logging.Logger log
SEVERE:
org.neo4j.server.ServerStartupException: Starting Neo4j Server failed: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#ce8273' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:211)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:86)
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:49)
Caused by: java.lang.RuntimeException: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#ce8273' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:280)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:106)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:88)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:207)
at org.neo4j.kernel.impl.recovery.StoreRecoverer.recover(StoreRecoverer.java:114)
at org.neo4j.server.preflight.PerformRecoveryIfNecessary.run(PerformRecoveryIfNecessary.java:59)
at org.neo4j.server.preflight.PreFlightTasks.run(PreFlightTasks.java:70)
at org.neo4j.server.AbstractNeoServer.runPreflightTasks(AbstractNeoServer.java:276)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:162)
... 2 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#ce8273' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:497)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:104)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:258)
... 10 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource#1f5329f' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:497)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:104)
at org.neo4j.kernel.impl.transaction.XaDataSourceManager.start(XaDataSourceManager.java:128)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:491)
... 12 more
Caused by: org.neo4j.kernel.impl.storemigration.UpgradeNotAllowedByConfigurationException: Failed to start Neo4j with an older data store version. To enable automatic upgrade, please set configuration parameter "allow_store_upgrade=true"
at org.neo4j.kernel.impl.storemigration.ConfigMapUpgradeConfiguration.checkConfigurationAllowsAutomaticUpgrade(ConfigMapUpgradeConfiguration.java:39)
at org.neo4j.kernel.impl.storemigration.StoreUpgrader.attemptUpgrade(StoreUpgrader.java:66)
at org.neo4j.kernel.impl.nioneo.store.StoreFactory.tryToUpgradeStores(StoreFactory.java:113)
at org.neo4j.kernel.impl.nioneo.store.StoreFactory.newNeoStore(StoreFactory.java:96)
at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.start(NeoStoreXaDataSource.java:240)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:491)
... 15 more
Oct 09, 2013 8:49:15 AM org.neo4j.server.logging.Logger log
SEVERE: Failed to start Neo Server on port [7474]
How to clear this?
According to the documentation,
set the Neo4j configuration parameter "allow_store_upgrade=true" in your neo4j.properties or embedded configuration
Hope that helps.
In general with Neo4j, a database can be upgraded from a minor version to the next, e.g. 1.7 → 1.8, and 1.8 → 1.9, but you can not jump directly from 1.7 → 2.0.
You have two options:
upgrade to each minor version in succession setting the Neo4j configuration parameter "allow_store_upgrade=true" as in #Vidya's answer, or
re-import your data into the new 2.0 version of Neo4j.

Need help in error in Neo4j

I am getting this error while clicking on the neo4j.bat file in Windows. I tried other answers on stackoverflow but none of them is working. I set all variables in path JAVA_HOME & JRE_HOME. It says database incorrectly shutdown, performing recovery. And then console goes off. I have installed jdk 1.7 & jre7.
Sep 15, 2013 11:52:57 PM org.neo4j.server.logging.Logger log
INFO: Setting startup timeout to: 120000ms based on -1
Sep 15, 2013 11:52:58 PM org.neo4j.server.logging.Logger log
SEVERE:
java.lang.RuntimeException: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.StoreLockerLifecycleAdapter#3e890800' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:280)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:106)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:88)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:207)
at org.neo4j.kernel.impl.recovery.StoreRecoverer.recover(StoreRecoverer.java:114)
at org.neo4j.server.preflight.PerformRecoveryIfNecessary.run(PerformRecoveryIfNecessary.java:59)
at org.neo4j.server.preflight.PreFlightTasks.run(PreFlightTasks.java:70)
at org.neo4j.server.AbstractNeoServer.runPreflightTasks(AbstractNeoServer.java:280)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:160)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:86)
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:49)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.StoreLockerLifecycleAdapter#3e890800' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:497)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:104)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:258)
... 10 more
Caused by: org.neo4j.kernel.StoreLockException: Could not create lock file
at org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:74)
at org.neo4j.kernel.StoreLockerLifecycleAdapter.start(StoreLockerLifecycleAdapter.java:40)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:491)
... 12 more
Sep 15, 2013 11:52:58 PM org.neo4j.server.logging.Logger log
SEVERE: Failed to start Neo Server on port [7474]
Most likely, you have an instance already running. Kill any Java processes and try again.

jooq startup: command line to generate classes

could you help me to change this command line to use it in a MacOS? the jar files will be on the desktop.
java -classpath jooq-2.0.0.jar;jooq-meta-2.0.0.jar;jooq-codegen-2.0.0.jar;mysql-connector-java-5.1.18-bin.jar;. org.jooq.util.GenerationTool /guestbook.xml
Thank you.
F.
UPDATE:
ok, this is the full lines and the error that I got. All the listed jars are present in the folder:
java -classpath ~/Desktop/JOOQ/jooq-2.1.0.jar:~/Desktop/JOOQ/jooq-
meta-2.1.0.jar:~/Desktop/JOOQ/jooq-codegen-2.1.0.jar:~/Desktop/JOOQ/
mysql-connector-java-5.1.15-bin.jar:. org.jooq.util.GenerationTool /bookstore.xml
Exception in thread "main" java.lang.NoClassDefFoundError: org/jooq/
util/GenerationTool
Caused by: java.lang.ClassNotFoundException:
org.jooq.util.GenerationTool
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
UPDATE 2
If I change the path removing ~/ and usign:
java -classpath /Users/fabio/Desktop/JOOQ/jooq-2.1.0.jar:/Users/fabio/Desktop/JOOQ/jooq-meta-2.1.0.jar:/Users/fabio/Desktop/JOOQ/jooq-codegen-2.1.0.jar:/Users/fabio/Desktop/JOOQ/mysql-connector-java-5.1.15-bin.jar org.jooq.util.GenerationTool /Users/fabio/Desktop/JOOQ/bookstore.xml
I got a different error:
Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: Cannot find /Users/fabio/Desktop/JOOQ/bookstore.xml
Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: -----------
Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: Please be sure it is located on the classpath and qualified as a classpath location.
Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: If it is located at the current working directory, try adding a '/' to the path
Apr 1, 2012 5:19:52 PM org.jooq.tools.JooqLogger error
SEVERE: Usage : GenerationTool
You can prepend the full path to each jar file (e.g. ~/Desktop/), and you also need to replace the windows classpath separator (semicolon, ';'), with the UNIX/MAC separator (colon, ':'). For example:
java -classpath ~/Desktop/jooq-2.0.0.jar:~/Desktop/jooq-meta-2.0.0.jar:~/Desktop/jooq-codegen-2.0.0.jar:~/Desktop/mysql-connector-java-5.1.18-bin.jar:. org.jooq.util.GenerationTool /guestbook.xml
Ok found. Commands to use:
cd /Users/fabio/Desktop/JOOQ
java -classpath /Users/fabio/Desktop/JOOQ/jooq-2.1.0.jar:/Users/fabio/Desktop/JOOQ/jooq-meta-2.1.0.jar:/Users/fabio/Desktop/JOOQ/jooq-codegen-2.1.0.jar:/Users/fabio/Desktop/JOOQ/mysql-connector-java-5.1.15-bin.jar:. org.jooq.util.GenerationTool /bookstore.xml
The ':.' after the last jar file is required.
Thank you.

Categories

Resources