Cannot find parser that supports .groovy - postgresql

When I'm trying to start changelog.groovy via liquibase command line it tells me that
Unexpected error running Liquibase: Cannot find parser that supports changelog.groovy
I'm doing the next: java -jar liquibase.jar update
My liquibase.properties are:
driver=org.postgresql.Driver
classpath=C:\Users\Andrii\org.postgresql.Driver.jar;C:\Users\Andrii\liquibase-3.5.1-bin\lib\liquibase-groovy-dsl-1.2.2-SNAPSHOT.jar
changeLogFile=D:\changelog.groovy
url=jdbc:postgresql://localhost:5432/test
username=postgres
password=rup
It finds those jars since if I change something in that path it will tell that jars cannot be found.
I downloaded the groovy-liquibase-dsl project, build it and added a jar into classpath. What am I doing wrong?

To make it work, you need to additionally include groovy and groovy-sql jars in Liquibase's classpath.
So say you store all the jars in C:\Users\Andrii\LiquibaseDependencies, update your the classpath property of your file as such:
classpath=C:\Users\Andrii\LiquibaseDependencies\org.postgresql.Driver.jar;
C:\Users\Andrii\LiquibaseDependencies\liquibase-groovy-dsl-1.2.1.jar;
C:\Users\Andrii\LiquibaseDependencies\groovy-2.4.6.jar;
C:\Users\Andrii\LiquibaseDependencies\groovy-sql-2.4.6.jar

Related

How to run Liquibase on command line with Custom Change java class?

I am trying to run my liquibase update from the command line. However, I have a customChange in my changelog file, i.e. a Java file that implements liquibase.change.custom.CustomChange. The update is successful when running via Spring. However, when I try to apply the update via command line using
liquibase --changeLogFile=<my_changelog_file> --username=<my_user> --password=<my_password> --url=<my_url> --driver=org.postgresql.Driver --classpath='<path_to>/postgresql-42.2.8.jar:<absolute_path_to_my_jar.jar>' update
I am getting this error:
Liquibase Community 3.8.6 by Datical
Unexpected error running Liquibase: liquibase.parser.core.ParsedNodeException: liquibase.exception.CustomChangeException: java.lang.ClassNotFoundException: com.<my_company>.platform.changeset.EncryptPasswordsChangeset
I have obscured any real values I am passing in for security reasons. Anyone know how to let liquibase find this file? I tried creating a jar with just the necessary files and adding that jar to the classpath, but that doesn't seem to work as the jar does not contain any main classes.
Running
jar tf <my_jar.jar>
results in:
META-INF/
META-INF/MANIFEST.MF
com/<my_company>/platform/changeset/EncryptPasswordsChangeset.java
com/<my_company>/platform/security/PasswordEncryptUtil.java
com/<my_company>/platform/encrypt/SymmetricCipher.java
My jar was not formed properly. Should be building it with compiled .class files, not .java files.

How to add external jar files to a spark scala project

I am trying to use an LSH implementation of Scala(https://github.com/marufaytekin/lsh-spark) in my Spark project.I cloned the repository with some changes to the sbt file (added Organisation)
To use this implementation , I compiled it using sbt compile and moved the jar file to the "lib" folder of my project and updated the sbt configuration file of my project , which looks like this ,
Now when I try to compile my project using sbt compile , It fails to load the external jar file ,showing the error message "unresolved dependency: com.lendap.spark.lsh.LSH#lsh-scala_2.10;0.0.1-SNAPSHOT: not found".
Am i following the right steps for adding an external jar file ?
How do i solve the dependency issue
As an alternative, you can build the lsh-spark project and add the jar in your spark application.
To add the external jars, addJar option can be used while executing spark application. Refer Running spark application on yarn
This issue isn't related to spark but to sbt configuration.
Make sure you followed the correct folder structure imposed by sbt and added your jar in the lib folder, as explained here - lib folder should be at the same level as build.sbt (cf. this post).
You might also want to check out this SO post.

Importing MySQL JDBC driver in lift

I'm trying to establish a database connection in my lift app using the mysql jdbc driver. I included the jar file in the eclipse build path, but building with importing the jar using import com.mysql._the app with sbt always throws the error:
object mysql is not a member of package com
Setting the classpath in the sdb.bat didn't help neither setting the system classpath variable.
set SCRIPT_DIR=%~dp0
java -Dscala.userjavacp=true -cp "%SCRIPT_DIR%\src\main\java\mysql.jar" -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx1024M -Xss2M -jar "%SCRIPT_DIR%\sbt-launch-0.12.1.jar" %*
SBT doesn't know anything about Eclipse build path. You need to add dependencies in the way SBT understands, e.g.:
add jars to lib and they will be placed on the project classpath. Not much else to it!
I would suggest using the SBT Eclipse plugin and then use SBT to manage your dependencies which should keep the two programs in sync.
So, for MySQL, you'd want to modify your sbt configuration in your project to include:
libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.6"
Then all you would need to do is launch sbt, and type eclipse to update your Eclipse configuration files with the correct classpath. When you restart Eclipse, everything should work.
The plugin will also pick up files in the lib directory as noted in the other answer.

create a new ontology with Jena

I'm trying to use Jena. For creating a new ontology my code is:
String SOURCE = "http://www.w3.org/2002/07/owl#";
String NS = SOURCE + "#";
OntModel ontology = ModelFactory.createOntologyModel();
ontology.read( SOURCE, "OWL/XML" );
But it gives me this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.hp.hpl.jena.util.Metadata.<clinit>(Metadata.java:26)
at com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:25)
at com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.<clinit>(RDFReaderFImpl.java:85)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.<clinit>(ModelCom.java:42)
at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:122)
at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:116)
at com.hp.hpl.jena.vocabulary.OWL.<clinit>(OWL.java:37)
at com.hp.hpl.jena.ontology.ProfileRegistry.<clinit>(ProfileRegistry.java:48)
at com.hp.hpl.jena.ontology.OntModelSpec.<clinit>(OntModelSpec.java:54)
What's the problem?I couldn't find any solution for it.
If you use a Jena distribution, all the jars needed are in the lib/ directory. You need them all on the classpath.
On Windows / cygwin:
javac -cp '<install dir>\lib\*;' MyClass.java
On Linux:
javac -cp '<install dir>/lib/*' MyClass.java
To run, the created .class needs to be in your path, too:
java -cp '.:<install dir>/lib/*' MyClass
If you use maven to get Jena, the dependencies are automatically pulled in.
Your Java classpath is missing one of the jar files required by Jena. Looks like it's one of the slf4j jars. You need to have all the jar files that come with Jena on the classpath. How to set the classpath depends on your OS and/or IDE, but Google can help.

Error in Eclipse about type indirectly referenced from required .class file

I'm having this exception with some stubs generateds by Axis2:
"The type org.apache.axiom.om.OMElement cannot be resolved. It is
indirectly referenced from required .class files"
I've been reading many posts, and trying to find a solution. What I've found so far is to add the apache tomcat 5.5 library to the build path. It removed the error in the java file, but then, when I to execute any java program inside the project, I got this error:
'Launching myApp' has encountered a problem Exception occurred
executing command line. Cannot run program "C:\Program
Files\Java\jdk1.5.0_22\bin\javaw.exe" (in directory
"D:\Digicel\workspace\Digicel\myClassSample"): CreateProcess error=87,
The parameter is incorrect
then if I remove the apache tomcat library from the build path, I can run the other java programs, but not the one mentioned initially.
Any thoughts about it?
Okay, I've found the cause of the problem with the help of a friend :)
The thing is that Eclipse is aware that one of my dependencies, depends of another library, and Eclipse is checking for it when it tries to build the code.
So, what I've done is try to check which jar file contains this library: " org.apache.axiom.om.OMElement".
I've googled it and found that it is "axiom-api-1.2.10.jar" and finally my file compiled with 0 errors.
He also explained to me that my original solution of adding the apache tomcat server library is adding all the jars that cames with apache tomcat (which is a big list), and probably there may have been a version conflict with my current list of added jars.
So, the fix was to find the appropriate jar and add it to the project.
This error can also occur when a indirect dependency has a corrupt jar file. This may be caused by problems at the public maven repository.
If this is the case removing the local maven repository to download fresh jar files will fix your problem:
rm -Rf ~/.m2/repository/{enter/path/to/broken/stuff}
Goto Maven >Update Maven project>checkmark the Force update >Then Run
..That error Will gone....