Solr can't find JDBC driver - java

I haven't done anything with Java in years, so I'm trying to get this done as simply as possible. I'm running Ubuntu 10.04. So far I've just done:
apt-get install solr-jetty libmysql-java
and set up all my config files to pull in documents from my MySQL database. Now, however, I'm getting this in the logs when I try to do a full import:
SEVERE: Full Import failed
org.apache.solr.handler.dataimport.DataImportHandlerException: Could not load driver: com.mysql.jdbc.Driver Processing Document # 1
Now I'm a bit stuck, because if apt installing libmysql-java didn't get me the JDBC driver, I have no idea what will.

These error means that your mysql dirver cannot be found on java classpath and you should just add it to it.
In case of Jetty you should put your database driver in $JETTY_HOME/lib/ext directory. Just put there symbolic link or copy jar file.
If you don't know where is MySql JDBC jar file you can check it using these command:
dpkg-query -L libmysql-java
Or you can just simply download these driver from MySql download page.
PS. I have never used Jetty and I found these information here: http://content.liferay.com/4.2/doc/installation/liferay_4_installation_guide/multipage/ch03.html#d0e893, point 9, Jetty 5.1 installation.

I ended up just symlinking to .jars from /usr/share/java; maybe there's a better way though.
ln -s /usr/share/java/mysql-connector-java.jar \
/usr/share/solr/WEB-INF/lib/mysql-connector-java.jar
sudo ln -s /usr/share/java/mysql.jar /usr/share/solr/WEB-INF/lib/mysql.jar

put the file mysql-connector-java-5.1.22-bin.jar (or its symbol link) to this directory:
/var/lib/tomcat6/webapps/solr/WEB-INF/lib/
I know this is for tomcat case but you can do the similar.

Related

Encountered error setting up plugins for Minecraft Nukkitx server on Raspberry Pi

RPI 2B, running Debian/Jessie, with java version 1.8.0_65.
Downloaded latest nukkitx from https://nukkitx.com.
Followed installation instructions at https://github.com/IntellectualCrafters/PlotSquared/wiki/Installation.
Plugins I have installed:
Plot Squared 18.07.21-aaa7088-2022
FastAsyncWorldEdit 18.07.21-a00345f-1159-20.4.0
DbLib 0.2.3
Error I am encountering:
java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V
Stack trace: https://pastebin.com/C3DrUm0Q.
Full server log: https://pastebin.com/2iuvQmbC.
As you can see, it says that PlotSquared has been loaded, but none of the plot commands are available. It just says unknown command when I type it. I have tried several different versions of all of the plugins, and a couple previous versions of nukkitx, all have the same problem. I'm thinking its something about my device, but I'm still pretty new to Linux and am not sure what to try next. Any suggestions would be amazing!
EDIT: I download the driver from https://github.com/xerial/sqlite-jdbc, and added it to the class path when calling the nukkitx jar to start the server. This didn't fix the problem. Here is the .sh file to start the nukkit jar:
#!/bin/sh
echo $USER
java -Xms1G -Xmx1G -cp ".;sqlite-jdbc-3.23.1.jar" -jar nukkit-1.0-SNAPSHOT.jar
I figured it out! For whatever reason, the JbLib sqlite driver apparently wasn't working. The solution was to remove JbLib (jar and folder) from the plugins folder, change the start.sh file (which I created according to the installation instructions) to use a classpath command instead of a jar command, add the xerial sqlite driver to the class path, and specify the Main Nukkit class to execute, like so:
java -classpath nukkit-1.0-SNAPSHOT.jar:sqlite-jdbc-3.23.1.jar cn.nukkit.Nukkit

How do I install Spring Boot CLI in Ubuntu?

I am trying to install Spring Boot CLI in Ubuntu. I am new to spring boot and was trying to learn it. I have already installed Gradle and groovy but did not find anything online to install Spring boot CLI.
please follow the code
sudo apt install unzip zip
curl -s https://get.sdkman.io | bash
source "/home/username/.sdkman/bin/sdkman-init.sh"=
sdk install springboot
spring version
The Spring boot CLI install guide link
Spring boot CLI
You can read the docs for installation steps:
Manual installation:
Download the Spring CLI distribution: you can find the latest version link here.
Extract the downloaded zip file to any path of your choice.
Prerequisite: Make sure you have Java JDK v1.8 or above (check INSTALL.txt file from extracted archive in Step-1). You can check your JDK version using command: java --version.
Add the spring CLI script's path to $PATH environment variable:
For example, you can add below lines to your .bashrc file in *nix systems:
export SPRING_HOME=/path/to/your/extracted-spring-cli/spring-2.4.0
export PATH=$SPRING_HOME/bin:$PATH
After saving the .bashrc file, run $ source .bashrc to reload the environment variables you just added.
(optional; and not for Windows user) Shell auto-completion scripts are provided for BASH and ZSH with the extracted archive in Step-1. Add symlinks to the appropriate
location for your environment. For example, something like:
ln -s /path/to/your/extracted-spring-cli/spring-2.4.0/shell-completion/bash/spring /etc/bash_completion.d/spring
ln -s /path/to/your/extracted-spring-cli/spring-2.4.0/shell-completion/zsh/_spring /usr/local/share/zsh/site-functions/_spring
To check if you are using BASH or ZSH, run the command: $ echo $SHELL.
DONE: To test if you have successfully installed the CLI you can run the following command: spring --version.
Here is detailed instruction on how to do it, much more useful than official one, at least for manual installation. One more thing - to make path change permanent you might need to logout - login, as "source /etc/profile" will be effective only for currently opened terminal.
Use this link to get a detailed instruction on how to download the Spring framework successfully, It really helped me a lot after long time of making research.
https://www.decodejava.com/download-and-install-spring-framework.htm

Unable to install Elasticsearch on Mac Sierra (10.12.2)

When attempting to start Elasticsearch 5.1.1 via
$ elasticsearch
I get the output:
Error: Could not find or load main class -Xms2g
I've looked into:
I read it may be an error in how a class is called? But I'm not exposed to doing that. This thread doesn't help and isn't really my problem as I'm not installing a plugin.
I installed via Homebrew. Here is some output from that:
$ brew info elasticsearch
elasticsearch: stable 5.1.1, HEAD
Distributed search & analytics engine
https://www.elastic.co/products/elasticsearch
Conflicts with: elasticsearch#1.7, elasticsearch#2.4
/usr/local/Cellar/elasticsearch/5.1.1 (98 files, 35.2M) *
Built from source on 2016-12-14 at 09:23:56
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/elasticsearch.rb
==> Requirements
Required: java >= 1.8 ✔
==> Caveats
Data: /usr/local/var/elasticsearch/elasticsearch_GabbAHH/
Logs: /usr/local/var/log/elasticsearch/elasticsearch_GabbAHH.log
Plugins: /usr/local/Cellar/elasticsearch/5.1.1/libexec/plugins/
Config: /usr/local/etc/elasticsearch/
plugin script: /usr/local/Cellar/elasticsearch/5.1.1/libexec/bin/plugin
To have launchd start elasticsearch now and restart at login:
brew services start elasticsearch
Or, if you don't want/need a background service you can just run:
elasticsearch
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
mongodb
ruby
I also tried originally installing via manually extracting the .tar.gz package. I at first got some Java permission denied errors, but after running a chown to admin for myself I also got this same Error: Could not find or load main class type error.
I just updated my Java JDK to the latest: 1.8.0_112 and set my JAVA_HOME variable to that directory accordingly.
The most recent version of Elasticsearch 2 (2.4.3) works. Meanwhile, Elasticsearch v5.0.2 fails.
What can I do to have Elasticsearch properly installed on my Mac?
Watch out with this line in your .bashrc or similar:
export GREP_OPTIONS='--color=always'
That will break many shell's pipes, so many runners will fail without giving you any clue.
Distros as Ubuntu usually have this enabled by default for system users. Be careful and check that shell environment variable.
This problem was solved on my servers by just unsetting this variable.
You most likely have a problem in your .bash_profile. Usually elastic starts out of the box on a mac.
What I usually do to make upgrading and using multiple projects on my machine is using the following script:
#!/bin/bash
CURRENT_PROJECT=$(pwd)
CONFIG=$CURRENT_PROJECT/config
DATA=$CURRENT_PROJECT/data
LOGS=$CURRENT_PROJECT/logs
BASH_ES_OPTS="-Epath.conf=$CONFIG -Epath.data=$DATA -Epath.logs=$LOGS"
ELASTICSEARCH=$HOME/Development/elastic/elasticsearch/elasticsearch-5.1.1
$ELASTICSEARCH/bin/elasticsearch $BASH_ES_OPTS
Notice the options in BASH_ES_OPTS, these are the ones that changes a lot in version 5. My structure is a folder per project with this script and a few folders: config, data and logs. The config folder contains the files from the elastic distribution: elasticsearch.yml, jvm.properties and log4j2.properties.

ORACLE SQL DEVELOPER,Asking for JDK 7 and NO ADMIN rights

I am trying to use Oracle SQL Developr.
When I try to open it, it asks for the jdk path. Whereas I have only a JRE installed.
I do not have admin privileges and I can not get it that.
I have tried modifying the sqldeveloper\bin\sqldeveloper.CONF file but it did not help.
Is there any alternative to do that.
I have searched for around 3 hours on Google. Nothing hits up straight.
And if you are planning to call it duplicate. I have gone through the similar questions but dint worked out. And installed as per the answer How to start Oracle SQL Developer 4 using 32 bit JDK on Win 64?. But there also ERROR pops up when I start.
I'm assuming you're using the SQL Developer that comes bundled with the Oracle database. IME, it's not worth struggling with that.
I'd recommend using the standalone version instead - it comes with its own JDK, all you need to do is unzip the archive.
UPDATE
Apparently, there's no standalone version of the current SQL Developer 4 for 32bit Windows. But you can use the 3.2.2 release instead.
Copied from this link just for getting it straight to the pointTRIED AND TESTED SOLUTION-With 100 upvotes
As I have tried it and it really works.Posting the solution here.
JDK is not available as a portable zip unfortunately.
However, you can:
Create working JDK directory (C:\JDK in this case)
Download latest version of JDK from oracle (for example jdk-7u7-windows-i586.exe)
Download and install 7-zip (or download 7-zip portable version if you are not administrator)
With 7-zip extract all the files from jdk-[6-7]u?-windows-i586.exe in directory C:\JDK
In command shell (cmd.exe) do the following:
--> change directory to directory C:\JDK\.rsrc\JAVA_CAB10
--> execute command: extrac32 111
Unpack C:\JDK\.rsrc\JAVA_CAB10\tools.zip with 7-zip
In command shell (cmd.exe) do the following:
--> change directory to C:\JDK\.rsrc\JAVA_CAB10\tools\
--> execute command:
for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"
(this will convert all pack files into jar)
Copy whole directory and all subdir of c:\JDK\.rsrc\JAVA_CAB10\tools where you want your JDK to be and setup manually JAVA_HOME and PATH to point to your JDK dir and its BIN subdir.
Thats all. After this you'll be able at least to use javac.exe

Where do I install a jdbc driver on ubuntu?

I'm trying to install the MS SQL JDBC driver on ubuntu to be used with sqoop for Hadoop. I'm totally new to java and linux, so I'm not sure where to extract everything to.
Just put it in the runtime classpath or add its path to the runtime classpath.
How to do it depends on how you're executing the program. If you're using java command in command console to execute a .class file, then use the -cp argument to specify the paths to classes and/or JAR files which are to be taken in the classpath. The classpath is basically a collection of absolute/relative disk file system paths where Java has to look for JAR files and classes.
Assuming that you've downloaded a .zip, you need to extract it and then look for a .jar file (usually in a /lib folder). For starters, it's the easiest to put the .jar in the current working directory and then execute your program (with the Class.forName("com.mysql.jdbc.Driver"); line) as follows:
java -cp .:mysql.jar com.example.YourClass
The . signifies the current path and the : is the separator (which I believe is correct for Ubuntu, on Windows it's ;).
To install the driver, you can:
Download the driver from Microsoft: https://www.microsoft.com/en-us/download/details.aspx?id=11774
Unzip and untar it (gzip -d sqljdbc_6.0.7507.100_enu.tar.gz and
tar -xf sqljdbc_6.0.7507.100_enu.tar)
Install it by copying the correct version into /usr/share/java (It will need to be world readable.) (sudo cp sqljdbc42.jar /usr/share/java/)
In the tomcat directory (/usr/share/tomcat8/lib but it could be tomcat7 if you are running a different version.) run sudo ln -s ../../java/sqljdbc42.jar sqljdbc42.jar (with the correct version names from below).
If you are using Maven, see Setting up maven dependency for SQL Server
The correct version is as follows: (Under System Requirements)
Sqljdbc.jar requires a JRE of 5 and supports the JDBC 3.0 API
Sqljdbc4.jar requires a JRE of 6 and supports the JDBC 4.0 API
Sqljdbc41.jar requires a JRE of 7 and supports the JDBC 4.1 API
Sqljdbc42.jar requires a JRE of 8 and supports the JDBC 4.2 API
Just put your jdbc jar file into /usr/lib/jvm/java-8-oracle/jre/lib/ext by using this command:
sudo cp ojdbc6.jar /usr/lib/jvm/java-8-oracle/jre/lib/ext

Categories