I am using:
Eclipse Java EE IDE for Web Developers.
Version: Juno Service Release 1
Build id: 20121004-1855
And offline Jboss tools zip file is
jbosstools-4.0.0.Final.aggregate-Update-2012-12-06_13-22-08-B136
I successfully added zip file and it is also connecting to database,see the screenshot
http://imageshack.us/photo/my-images/21/jboss.png/
and my hibernate jars are(hibernate-release-4.1.8.Final)
hibernate-entitymanager-4.1.8.Final.jar
hibernate-envers-4.1.8.Final.jar
antlr-2.7.7.jar
dom4j-1.6.1.jar
hibernate-commos-annotations-4.0.1.Final.jar
hibernate-core-4.1.8.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
javassist-3.15.0-GA.jar
jboss-logging-3.1.0.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
In screenshot first exceptions is
org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge]**
org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge]
at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:402)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:270)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2155)
at org.hibernate.console.ConsoleConfiguration$6.execute(ConsoleConfiguration.java:430)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
at org.hibernate.console.ConsoleConfiguration.getSettings(ConsoleConfiguration.java:428)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:119)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:115)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:65)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:397)
... 15 more
Caused by: org.hibernate.cache.CacheException: could not instantiate CacheProvider [org.hibernate.cache.internal.NoCacheProvider]
at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:66)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.internal.NoCacheProvider
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 org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)
at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:63)
... 20 more
Related
I am trying to run apache jmeter on my VM but getting this error.
D:\Users\1255592\Desktop\apache-jmeter-3.1\apache-jmeter-3.1\bin>jmeter
java.lang.NoClassDefFoundError: com/thoughtworks/xstream/converters/ConversionException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.jmeter.NewDriver.main(NewDriver.java:257)
Caused by: java.lang.ClassNotFoundException: com.thoughtworks.xstream.converters.ConversionException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
JMeter home directory was detected as:
D:\Users\1255592\Desktop\apache-jmeter-3.1\apache-jmeter-3.1
I am using java 1.7
Your installation of JMeter is corrupt as the message here tells you that a class of xstream which is embedded as part of jmeter in lib folder is missing.
com.thoughtworks.xstream.converters.ConversionException
So reinstall your version and ensure you unzip in a folder that you own.
I want to create a Java API to access HBase DB, but I am always facing with this error in my project;
15/12/14 20:34:22 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=192.168.34.184:2181,192.168.34.173:2181 sessionTimeout=90000 watcher=hconnection-0xa80e050x0, quorum=192.168.34.184:2181,192.168.34.173:2181, baseZNode=/hbase
15/12/14 20:34:22 INFO zookeeper.ClientCnxn: Opening socket connection to server /192.168.34.184:2181
java.io.IOException: java.lang.reflect.InvocationTargetException
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:240)
at org.apache.hadoop.hbase.client.ConnectionManager.createConnection(ConnectionManager.java:420)
at org.apache.hadoop.hbase.client.ConnectionManager.createConnection(ConnectionManager.java:413)
at org.apache.hadoop.hbase.client.ConnectionManager.getConnectionInternal(ConnectionManager.java:291)
at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:222)
at api.ClientOperations.creatTable(ClientOperations.java:69)
at api.ClientOperations.main(ClientOperations.java:125)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:238)
... 6 more
Caused by: java.lang.NoClassDefFoundError: org/apache/htrace/Trace
at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.exists(RecoverableZooKeeper.java:217)
at org.apache.hadoop.hbase.zookeeper.ZKUtil.checkExists(ZKUtil.java:541)
at org.apache.hadoop.hbase.zookeeper.ZKClusterId.readClusterIdZNode(ZKClusterId.java:65)
at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getClusterId(ZooKeeperRegistry.java:105)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.retrieveClusterId(ConnectionManager.java:879)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.<init>(ConnectionManager.java:635)
... 11 more
Caused by: java.lang.ClassNotFoundException: org.apache.htrace.Trace
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
But I added HTrace jar in my project
HBase version: 1.1.2
Hadoop version: 2.6.0
You need to add right jar file to your project, add htrace-core-3.1.0 jar file to project class path then run it.htrace-core
<dependency>
<groupId>org.apache.htrace</groupId>
<artifactId>htrace-core</artifactId>
<version>3.1.0-incubating</version>
</dependency>
Recently I was trying to run 2048 bot (upd: author deleted the project, but created the new one). But it just didn't work. And the developer said that it runs from Intelij IDEA just fine. And yes, it appeared it does. So what I did:
>"c:\Program Files\Java\jdk1.7.0_51\bin\javac.exe" Program.java -cp selenium-java-2.41.0.jar
Note: Program.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
>java Program -cp selenium-java-2.41.0.jar
Error: Could not find or load main class Program
Intelij IDEA runs it this way:
"C:\Program Files\Java\jdk1.7.0_51\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.7.0_51\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\jce.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\jfxrt.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\resources.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\rt.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\zipfs.jar;C:\Users\Yuri\Desktop\2048_bot\2048_Bot_2.0-master\target\classes;C:\Users\Yuri\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\2.39.0\selenium-firefox-driver-2.39.0.jar;C:\Users\Yuri\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\2.39.0\selenium-remote-driver-2.39.0.jar;C:\Users\Yuri\.m2\repository\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar;C:\Users\Yuri\.m2\repository\org\json\json\20080701\json-20080701.jar;C:\Users\Yuri\.m2\repository\org\seleniumhq\selenium\selenium-api\2.39.0\selenium-api-2.39.0.jar;C:\Users\Yuri\.m2\repository\com\google\guava\guava\15.0\guava-15.0.jar;C:\Users\Yuri\.m2\repository\org\apache\httpcomponents\httpclient\4.3.1\httpclient-4.3.1.jar;C:\Users\Yuri\.m2\repository\org\apache\httpcomponents\httpcore\4.3\httpcore-4.3.jar;C:\Users\Yuri\.m2\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\Yuri\.m2\repository\commons-codec\commons-codec\1.6\commons-codec-1.6.jar;C:\Users\Yuri\.m2\repository\org\apache\commons\commons-exec\1.1\commons-exec-1.1.jar;C:\Users\Yuri\.m2\repository\net\java\dev\jna\jna\3.4.0\jna-3.4.0.jar;C:\Users\Yuri\.m2\repository\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar;C:\Users\Yuri\.m2\repository\commons-io\commons-io\2.2\commons-io-2.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain Program
Here are the jar files for convenience:
C:\Program Files\Java\jdk1.7.0_51\jre\lib\charsets.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\deploy.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\javaws.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\jce.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\jfr.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\jfxrt.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\jsse.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\management-agent.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\plugin.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\resources.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\rt.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\access-bridge-64.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\dnsns.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\jaccess.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\localedata.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\sunec.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\sunjce_provider.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\sunmscapi.jar
C:\Program Files\Java\jdk1.7.0_51\jre\lib\ext\zipfs.jar
C:\Users\Yuri\Desktop\2048_bot\2048_Bot_2.0-master\target\classes
C:\Users\Yuri\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\2.39.0\selenium-firefox-driver-2.39.0.jar
C:\Users\Yuri\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\2.39.0\selenium-remote-driver-2.39.0.jar
C:\Users\Yuri\.m2\repository\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar
C:\Users\Yuri\.m2\repository\org\json\json\20080701\json-20080701.jar
C:\Users\Yuri\.m2\repository\org\seleniumhq\selenium\selenium-api\2.39.0\selenium-api-2.39.0.jar
C:\Users\Yuri\.m2\repository\com\google\guava\guava\15.0\guava-15.0.jar
C:\Users\Yuri\.m2\repository\org\apache\httpcomponents\httpclient\4.3.1\httpclient-4.3.1.jar
C:\Users\Yuri\.m2\repository\org\apache\httpcomponents\httpcore\4.3\httpcore-4.3.jar
C:\Users\Yuri\.m2\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar
C:\Users\Yuri\.m2\repository\commons-codec\commons-codec\1.6\commons-codec-1.6.jar
C:\Users\Yuri\.m2\repository\org\apache\commons\commons-exec\1.1\commons-exec-1.1.jar
C:\Users\Yuri\.m2\repository\net\java\dev\jna\jna\3.4.0\jna-3.4.0.jar
C:\Users\Yuri\.m2\repository\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar
C:\Users\Yuri\.m2\repository\commons-io\commons-io\2.2\commons-io-2.2.jar
C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain Program
So it starts with jdk's jar files, then goes the project output directory, then some jar files, which are probably downloaded by Intelij IDEA on its own and it ends with the Intelij IDEA's jar file, which is probably needed for debugging or something along those lines.
So, how do I know which jar files are needed and where do those ~/.m2 files come from?
UPD Here are probably the minimal jar files set to start this program:
C:\Users\Yuri\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\2.39.0\selenium-firefox-driver-2.39.0.jar
C:\Users\Yuri\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\2.39.0\selenium-remote-driver-2.39.0.jar
C:\Users\Yuri\.m2\repository\org\json\json\20080701\json-20080701.jar
C:\Users\Yuri\.m2\repository\org\seleniumhq\selenium\selenium-api\2.39.0\selenium-api-2.39.0.jar
C:\Users\Yuri\.m2\repository\com\google\guava\guava\15.0\guava-15.0.jar
C:\Users\Yuri\.m2\repository\org\apache\httpcomponents\httpclient\4.3.1\httpclient-4.3.1.jar
C:\Users\Yuri\.m2\repository\org\apache\httpcomponents\httpcore\4.3\httpcore-4.3.jar
C:\Users\Yuri\.m2\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar
C:\Users\Yuri\.m2\repository\org\apache\commons\commons-exec\1.1\commons-exec-1.1.jar
So it's not all the jar files even in m2 diretory.
UPD Selenium Client & WebDriver Language Bindings comes with additional jar files but not all of them are needed. So one of the options was to specify all these jar files. But I was able to make it work this way:
>java Program
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/firefox/FirefoxDriver
at Program.main(Program.java:18)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.firefox.FirefoxDriver
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
>java -cp "selenium-java-2.41.0.jar;." Program
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function
at Program.main(Program.java:18)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
>java -cp "selenium-java-2.41.0.jar;guava-15.0.jar;." Program
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONException
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:87)
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:77)
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:65)
at org.openqa.selenium.firefox.FirefoxDriver.getProfile(FirefoxDriver.java:262)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at Program.main(Program.java:18)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 11 more
>java -cp "selenium-java-2.41.0.jar;guava-15.0.jar;json-20080701.jar;." Program
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/exec/Executor
at org.openqa.selenium.os.CommandLine.<init>(CommandLine.java:47)
at org.openqa.selenium.firefox.FirefoxBinary.startProfile(FirefoxBinary.java:96)
at org.openqa.selenium.firefox.FirefoxBinary.clean(FirefoxBinary.java:226)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:91)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at Program.main(Program.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.exec.Executor
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 11 more
>java -cp "selenium-java-2.41.0.jar;guava-15.0.jar;json-20080701.jar;commons-exec-1.1.jar;." Program
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/params/HttpParams
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:93)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at Program.main(Program.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.http.params.HttpParams
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more
>java -cp "selenium-java-2.41.0.jar;guava-15.0.jar;json-20080701.jar;commons-exec-1.1.jar;httpclient-4.3.1.jar;." Program
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/params/HttpParams
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:93)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at Program.main(Program.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.http.params.HttpParams
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more
>java -cp "selenium-java-2.41.0.jar;guava-15.0.jar;json-20080701.jar;commons-exec-1.1.jar;httpcore-4.3.jar;." Program
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/auth/Credentials
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:93)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at Program.main(Program.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.http.auth.Credentials
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more
>java -cp "selenium-java-2.41.0.jar;guava-15.0.jar;json-20080701.jar;commons-exec-1.1.jar;httpcore-4.3.jar;httpclient-4.3.1.jar;." Program
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.http.conn.ssl.AbstractVerifier.<init>(AbstractVerifier.java:82)
at org.apache.http.conn.ssl.AllowAllHostnameVerifier.<init>(AllowAllHostnameVerifier.java:40)
at org.apache.http.conn.ssl.SSLSocketFactory.<clinit>(SSLSocketFactory.java:145)
at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:60)
at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:48)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:100)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:81)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:93)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at Program.main(Program.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more
>java -cp "selenium-java-2.41.0.jar;guava-15.0.jar;json-20080701.jar;commons-exec-1.1.jar;httpcore-4.3.jar;httpclient-4.3.1.jar;commons-logging-1.1.1.jar;." Program
UPD Alternatively:
find -name '*.jar' -execdir cp -t ~/path/to/prj {} +
If you compile
javac Program.java
then Program.class will be generated. This must be in your classpath.
java -cp "Program.class;selenium-java-2.41.0.jar"
A Java program does not need any specific jar files to run, but it need the contained classes.
There are various tools and sites to help you find out:
How to find Jar to which an Java class belongs
There are also tools to help you manage those dependencies, like Maven (.m2 is related to it).
The author states that
You will need to install the Selenium dependency somehow, such as by using Maven.
IMHO the project should come with a pom.xml or the jars.
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 tried using "TRACE_LEVEL_FILE=4" on a server/tcp
DriverManager.getConnection("jdbc:h2:tcp://localhost/" + f.toURI() +";TRACE_LEVEL_FILE=4;", "sa", "");
and set the log level to warning with
java.util.logging.Logger h2database = java.util.logging.Logger.getLogger("h2database");
h2database.setLevel(Level.WARNING);
and all that I got was this message in scan123db.trace.db
01-24 15:04:14 database: org.h2.message.TraceWriterAdapter
org.h2.message.DbException: Class "org.h2.message.TraceWriterAdapter" not found [90086-169]
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.TraceSystem.setLevelFile(TraceSystem.java:199)
at org.h2.engine.Database.open(Database.java:519)
at org.h2.engine.Database.openDatabase(Database.java:222)
at org.h2.engine.Database.<init>(Database.java:217)
at org.h2.engine.Engine.openSession(Engine.java:56)
at org.h2.engine.Engine.openSession(Engine.java:159)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
at org.h2.engine.Engine.createSession(Engine.java:121)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:136)
at java.lang.Thread.run(Unknown Source)
Caused by: org.h2.jdbc.JdbcSQLException: Class "org.h2.message.TraceWriterAdapter" not found [90086-169]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
... 11 more
Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.h2.message.TraceWriterAdapter.<init>(TraceWriterAdapter.java:28)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.h2.message.TraceSystem.setLevelFile(TraceSystem.java:197)
... 9 more
I do wonder why?
As documented, the option TRACE_LEVEL_FILE=4 is for "Using Other Logging APIs". If you use it, then this "Other Logging API" also needs to be in the classpath, on the server side. As written in the documentation, "To use SLF4J, all required jar files need to be in the classpath."