Cannot resolve type problems with eclipse - mysql

It seems that I got the wires crossed & ask you to point me the right direction.
I have a problem with the Eclipse IDE for Enterprise Java Developers (version: 2019-06 (4.12.0), build id: 20190614-1200). There is a code part where I get the error message MysqlDataSource cannot be resolved to a type. Searching the Web, I found out that this class is included in the download of mysql-connector-java JAR 8.0.14 with all dependencies. I added it over the 'Fix project setup…', where I added the JAR file to the libraries of the Java Build Path.
Unfortunately, the error message does not vanish. Can you see what I am doing wrong?
Edit 1:
With the hint from another Website, I found out that the hibernate JAR included was the source files JAR. So, I corrected it the hibernate-entitymanager JAR, clicked "Clean…" under "Project", but to no avail: the EntityManager is still unlocatable. (Well, after several tries, the first error message to resolve is no more with MySQL.)

As I learned from somebody on another Web site, the following lines have to be added to the pom.xml file:
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.2.Final</version>
</dependency>
or
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>

Related

maven-connector-java, module not found

Successfully I did my first JDBC program using MariaDB, Maven, Java-11.
Now I have to access MySQL and just exchanged the MariaDB dependency by
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
I figured out, that com.mysql.jdbc and com.mysql.cj and other modules are hosted in the mysql-connector-java-8.0.28.jar.
Hence, in module-info.java I exchanged
requires org.mariadb.jdbc;
by
requires com.mysql.jdbc;
I also tried
requires com.mysql.cj;
but still, the maven-compiler-plugin:3.9.0 complains
module not found
What did I miss, here?
khmarbaise has put me on the right track: I almost forgot that there are legacy jar files around not prepared for easy integration into JPMS. To include the jar file mysql-connector-java-8.0.28.jar, which comes without a module-info.class, I had to enter
requires java.sql;
requires mysql.connector.java;
to my module-info.java.
The module name mysql.connector.java is derived from the name of its jar file by omitting the version info and substituting the dashes by dots.

terminating: loadlib libVisionProxy.dylib not available in /Users/priya/Library/Application Support/Sikulix/SikulixLibs_201510051707

I have added below 2 dependencies in POM file for running a Sikuli program and getting the error
"loadlib: libVisionProxy.dylib not available in /Users/priya/Library/Application Support/Sikulix/SikulixLibs_201510051707"
what should I do to fix this issue in my MAC system.
**Dependency added.**
'<dependency>
<groupId>org.sikuli</groupId>
<artifactId>sikuli-api</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>2.0.4</version>
</dependency>'
In Maven dependency I can see the Jar added are
Sikuli-api 1.2.0 ,
Sikuli-core 1.2.2 ,
sikulixapi 2.0.4.,
sikulix2tigervnc 1.1.4
sikuli-api and sikulixapi are two different packages, that should not be used together. decide for one of them.
For SikuliX: Delete the folder /Users/priya/Library/Application Support/Sikulix/ and Strat all over again.

eXist-db installing MySQL connector

Does anyone know the steps to correctly install the MySQL JDBC driver into eXist-db for MacOS? I’m following http://www.exist-db.org/exist/apps/wiki/HowTo/SQLDatabases/QueryingSQLDatabases, but am stuck at 1.2. Everything I try results in the error
exerr:ERROR sql:get-connection() Cannot find database driver class: com.mysql.jdbc.Driver [at line 4, column 20]
I’ve installed mysql-connector-java-8.0.22.jar into
/Applications/eXist-db.app/Contents/Java/
/Applications/eXist-db.app/Contents/lib/user/
/Applications/eXist-db.app/Contents/Resources/lib/user/
/Applications/eXist-db.app/Contents/Resources/etc/webapp/WEB-INF/lib/
And none of these locations resolved the error. I must be missing a step.
Are you working with eXist-db 5?
It is important to register the JDBC driver jar file in eXist-db. The jar file is placed in the $EXIST_HOME$/lib directory and the dependency on the jar file must be registered in eXist-db by adding an entry similar to the following in etc/startup.xml where the relativePath is the relative path to the jar file from the lib directory.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
<relativePath>jdbc/mysql-connector-java-8.0.18.jar</relativePath>
</dependency>

java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; while launching Chrome through ChromeDriver

Hi I am facing this issue while launching the driver.
Starting ChromeDriver 2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73) on port 4097
Only local connections are allowed.
Exception in thread "main" java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder;
at org.openqa.selenium.json.Json.<clinit>(Json.java:47)
at org.openqa.selenium.logging.profiler.HttpProfilerLogEntry.constructMessage(HttpProfilerLogEntry.java:37)
at org.openqa.selenium.logging.profiler.HttpProfilerLogEntry.<init>(HttpProfilerLogEntry.java:29)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at isf.Login.main(Login.java:21)
Can anybody tell what i am missing ..because same libs i am using for another project and its working fine there.
I was facing the same issue and got resolved using below approach:
If you check JSON class at line 47, setLenient() is missing.
This issue is possibly due to conflicts in Gson versions.
Go to your repository:
C:\Users\User_name\.m2\repository\com\google\code\gson
Delete all the existing folders.
Now, add below maven dependency in your pom file:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>provided</scope>
</dependency>
Re-build your pom.xml file and execute the script.
In case you are using maven, you should add the following dependency:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
That should solve it. Gson package version should be correlated with latest Selenium version.

osgi.wiring.package; (&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0))))

I am trying to use com.google.maps in my OSGi bundle. I've added the dependency like this:
<dependency>
<groupId>com.google.maps</groupId>
<artifactId>google-maps-services</artifactId>
<version>0.1.7</version>
</dependency>
However, when I try to deploy this bundle to AEM, I get an error:
Unable to resolve 392.38: missing requirement [392.38] osgi.wiring.package; (&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0))))
How can I resolve this?
go to maven central: http://search.maven.org
Advanced search
Write to the By Classname section: com.google.gson
In the list of results, find the ones that might be good for you
Download the jars and check the manifest header if the required package is exported
If you do that, you will find the following maven dependency:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
Alternatively, you can use JPM website for the search as it indexes all OSGi related MANIFEST headers and it mirrors the whole maven central repo. After you find the artifact that is necessary for you, there is a good chance that it is from maven central originally (so you do not have to set alternate repositories in your maven project). You can check the origin of the bundle in the details page.