When I run my Apache Flink app via Intellij, I see this error at runtime (at compile compile-time, there are no errors):
Caused by: java.lang.ClassNotFoundException: org.apache.flink.configuration.DescribedEnum
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
This is what I've listed in my pom.xml
<scala.version>2.12.8</scala.version>
<scala.binary.version>2.12</scala.binary.version>
<flink.version>1.13.5</flink.version>
...
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-scala_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
I I went to the following link for the source: https://flink.apache.org/downloads.html
wget https://archive.apache.org/dist/flink/flink-1.13.5/flink-1.13.5-src.tgz
The application (via Intellij) is unable to locate the DescribedEnum class.
I have tried adding some other dependencies, but I'm not sure which jar this is in.
Any thoughts?
You don't seem to have the basic dependency flink-streaming-java_${scala.binary.version} listed in your POM. See https://nightlies.apache.org/flink/flink-docs-release-1.13/docs/dev/datastream/project-configuration/ for more details.
Related
I am getting the error as mentioned below, while running the feed utility. I am trying to load an image "logo.png". The slf4j jar file is also available in the runtime classpath. But still I am getting this error.
Oct 16, 2012 7:34:11 PM com.ibm.commerce.foundation.dataload.FeedRetriever invokeDataLoad
SEVERE: An error occurred while performing data load.
Throwable occurred: com.ibm.commerce.foundation.dataload.exception.DataLoadException:
An error occurred while executing the data load.
java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at com.ibm.commerce.foundation.dataload.DataLoaderMain.execute(DataLoaderMain.java:664)
at com.ibm.commerce.content.commands.DataLoadInvoker.execute(DataLoadInvoker.java:101)
at com.ibm.commerce.foundation.dataload.FeedRetriever.invokeDataLoad(FeedRetriever.java:244)
at com.ibm.commerce.foundation.dataload.FeedRetriever.execute(FeedRetriever.java:172)
at com.ibm.commerce.foundation.dataload.FeedRetriever.main(FeedRetriever.java:321)
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at com.ibm.commerce.foundation.dataload.DataLoaderMain.execute(DataLoaderMain.java:488)
... 4 more
Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at org.apache.wink.client.ClientConfig.<clinit>(ClientConfig.java:52)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:167)
at com.ibm.commerce.foundation.dataload.feedreader.AtomReader.getFeed(AtomReader.java:104)
at com.ibm.commerce.foundation.dataload.feedreader.AtomReader.getEntries(AtomReader.java:147)
at com.ibm.commerce.foundation.dataload.feedreader.AtomReader.getEntries(AtomReader.java:1)
at com.ibm.commerce.foundation.dataload.feedreader.BaseFeedReader.init(BaseFeedReader.java:252)
at com.ibm.commerce.foundation.dataload.AbstractBusinessObjectLoader.initializeDataReaders(AbstractBusinessObjectLoader.java:1344)
at com.ibm.commerce.foundation.dataload.AbstractBusinessObjectLoader.init(AbstractBusinessObjectLoader.java:369)
at com.ibm.commerce.foundation.dataload.BusinessObjectLoader.init(BusinessObjectLoader.java:65)
at com.ibm.commerce.foundation.dataload.DataLoaderMain.execute(DataLoaderMain.java:431)
... 4 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:76)
at java.net.URLClassLoader.findClass(URLClassLoader.java:396)
at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
... 16 more
Oct 16, 2012 7:34:11 PM com.ibm.commerce.foundation.dataload.FeedRetriever main
SEVERE: An error occurred while performing data load.
Throwable occurred: com.ibm.commerce.foundation.dataload.exception.DataLoadException: An error has occurred. If this problem persists, contact product support.
at com.ibm.commerce.foundation.dataload.FeedRetriever.invokeDataLoad(FeedRetriever.java:247)
at com.ibm.commerce.foundation.dataload.FeedRetriever.execute(FeedRetriever.java:172)
at com.ibm.commerce.foundation.dataload.FeedRetriever.main(FeedRetriever.java:321)
Add a SLF4J implementation (as you only have its API):
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.26</version>
</dependency>
You have to provide one of the various SLF4J implementation .jar files in the classpath, as well as the interface .jar file. This is documented.
Download slf4j-1.7.5.zip
It holds different jar files.
Go to -> Integration folder after extracting zip and include following jar files
slf4j-api-2.0.99
slf4j-simple-1.6.99
junit-3.8.1
Right click on project properties and follow below steps Project Properties" --> "Deployment Assembly", adding "Java Build Path Entries -> Maven Dependencies
I tried other solutions and the exception didn't go away. So I decompiled the entire jose4j 0.6.5 jar with a Java Decomplier and look at its pom.xml.
I realised it has a specific dependency on slf4j-api, version 1.7.21:
So in my project's pom.xml, I added the exact same dependency, updated my Maven project so that it downloads this jar into my repository and the exception was gone.
However it may bring up another error caused by slf4j itself:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
To overcome this issue, I added the following into my project's pom.xml. So altogether you need to add the following to your pom.xml and my jose4j ran without anymore issues:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
</dependency>
Remember to update your Maven project after amending your pom.xml.
(Right-click Project folder in Eclipse -> Maven -> Update Project..)
I also had the similar problem. I had a maven project and was testing rabbitmq. Firstly it showed me the similar error then I added all the SLF4J dependencies in the maven project and then error changed to "Maven SLF4J: Class path contains multiple SLF4J bindings". Here is the complete list of dependencies from pom.xlm
<dependencies>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
<scope>compile</scope>
</dependency>
</dependencies>
It worked finally.
I was facing a similar issue and below line fixed the issue for me.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
Edit: I realized that I was using spring boot and the version of the dependency was getting pulled from spring-boot-starter-parent.
To be more specific if you are missing the class com.vaadin.external.org.slf4j.LoggerFactory add the below dependency.
<dependency>
<groupId>com.vaadin.external.slf4j</groupId>
<artifactId>vaadin-slf4j-jdk14</artifactId>
<version>1.6.1</version>
</dependency>
If you are missing any other org.slf4j.LoggerFactory, just go to Maven central class name search and search for the exact class name to determine what exact dependency you are missing.
You can use bellow dependency
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>
Add the following jars to the class path or lib folder
slf4j-api-1.7.2.jar
slf4j-jdk14-1.7.2.jar
The perfect solution which works undoubtedly is to just add these packages to your app:
https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.2
http://archive.apache.org/dist/logging/log4j/1.2.16/
after adding so you may encounter following WARNING which you can simply ignore!
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
credits:
https://www.javacodegeeks.com/2018/02/fix-exception-thread-main-java-lang-noclassdeffounderror-org-slf4j-loggerfactory-java.html
This error occurs because of referenced jars are not checked in our project's order and export tab.
Choose Project ->ALT+Enter->Java Build Path ->Order and Export->check necessary jar files into your project.
Finally clean your project and run.It will run successfully.
When we use the slf4j api jar, we need any of the logger implementations like log4j. On my system, we have the complete set and it works fine.
1. slf4j-api-1.5.6.jar
2. slf4j-log4j12-1.5.6.jar
3. **log4j-1.2.15.jar**
I believe the answer is outlined on the slf4j web-site (Failed to load class org.slf4j.impl.StaticLoggerBinder)
For a very quick solution I suggest adding no-operation (NOP) logger implementation (slf4j-nop.jar)
For example, if using maven:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>${slf4j-nop-version}</version>
</dependency>
I have the same issue for zookeeper start up.
# sh /opt/zookeeper-3.4.13-1.hardtop.0.9.1/bin/zkServer.sh start-foreground
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.4.13-1.hardtop.0.9.1/bin/../conf/zoo.cfg
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.apache.zookeeper.server.quorum.QuorumPeerMain.<clinit>(QuorumPeerMain.java:67)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 1 more
But the class is already there as part of other slf4j jars:
# grep LoggerFactory lib/*jar
Binary file lib/log4j-1.2-api-2.17.1.jar matches
Binary file lib/log4j-slf4j-impl-2.17.1.jar matches
Binary file lib/netty-all-4.1.30.Final.jar matches
make sure your MANIFEST.MF contains the name of the referenced jar in my application was slf4j-api-*. jar.
You need slf4j-api library. For most cases only slf4j-api and slf4j-jkd14 are only required:
Here you can download the version 1.7.2:
slf4j-api-1.7.2.jar
slf4j-jkd14-1.7.2jar
If you need an example to see how these are used, refers to this tutorial:
http://www.ibm.com/developerworks/java/library/j-hangman-app/index.html
All the code for the tutorial is available
get the compatible version of this jar slf4j-jdk14 and add it as a dependency.
this solved the problem for me.
You need slf4j-api library and slf4j-log4j12-1.7.25 jar. Copy this jars in your project-> WEBINF-> lib folder and in tomcat server lib folder to execute successfully.
When you copy dependency from maven repository there is:
<scope>test</scope>
Try to remove it from dependencies in pom.xml like this.
<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
This works for me. I hope it would be helpful for someone else.
this worked for me /properties/maven uncheck resolve dependencies from Workspace projects.
First, check the dependency hierarchy than to exclude all slf4j jars from other dependencies and add separate slf4j as dependencies.
If it is not maven project then make sure the jar file is inside the project folder. If it is a maven project then make sure it's in the pom.xml.
use maven it will download all the required jar files for you.
in this case you need the below jar files:
slf4j-log4j12-1.6.1.jar
slf4j-api-1.6.1.jar
These jars will also depend on the cassandra version which you are running.
There are dependencies with cassandra version , jar version and jdk version you use.
You can use : jdk1.6
with : cassandra 1.1.12
and the above jars.
If you are facing java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
Add slf4j-log4j12 jar in the library folder of the project
The LoggerFactory class is msising according to the error message:
java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
Apparently, the slf4j.jar file is not getting loaded for some reason.
Description:
Here below code of simple AppiumDriver initialization which always fails
with error below (independently whether selenium is present in maven dependencies or not)
test:
#Test
public void testSomething() throws MalformedURLException {
AppiumDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), new DesiredCapabilities());
driver.quit();
}
}
https://www.refheap.com/d0ec095c62d8061ac2cef768d
output error:
java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
https://www.refheap.com/b71dbf880e1c997b3a885c13d
POM.XML:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>3.2.0</version>
</dependency>
//Here was 2 cases: with and without selenium dependency
//both was not helpful
Interesting:
If I create simple Selenide\selenium test without appium in the same project where mentioned test is located - all tests are correctly working
What I did:
maven .m2 folder clean up - did not help,
importing\deleting selenium java clients - did not help,
Creating clean project - did not help,
does anyone know what is wrong?
I see that appium java-client already contains a dependency on selenium selenium-java 2.47.1 inside it's pom file (https://github.com/appium/java-client/blob/master/pom.xml).
NoClassDefFoundError might be thrown when there is a conflict between the same classes in a jar.
I would suggest you to delete
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.47.1</version>
</dependency>
from your pom and try to run it. I hope it helps.
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.47.1</version>
</dependency>
use this in your pom.xml
I am trying to add MS SQL driver dependency in my POM.xml file and the following is the dependency.
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
but I get this exception
Missing artifact com.microsoft.sqlserver:sqljdbc4:jar:4.0
I really don't understand the issue.
UPDATE
Microsoft now provide this artifact in maven central. See #nirmal's answer for further details: https://stackoverflow.com/a/41149866/1570834
ORIGINAL ANSWER
The issue is that Maven can't find this artifact in any of the configured maven repositories.
Unfortunately Microsoft doesn't make this artifact available via any maven repository. You need to download the jar from the Microsoft website, and then manually install it into your local maven repository.
You can do this with the following maven command:
mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar
Then next time you run maven on your POM it will find the artifact.
Microsoft recently open sourced their jdbc driver.
You can now find the driver on maven central:
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
or for java 7:
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre7</version>
</dependency>
I had the similar problem and solved it by doing following.
Download sqljdbc4.jar from the Microsoft website to your local machine.
Right click on Project-->Import-->Maven-->Install or deploy an artifact to a Maven repository as shown below.
* Next-->Fill the following details
Artifact file:
path of the jar you downloaded (Ex: E:\lib\sqljdbc4.jar in my case)
Group Id: com.microsoft.sqlserver
Artifact Id: sqljdbc4
Version: 4.0
Then Refresh/clean the project.
Thank you!
You can also create a project repository. It's useful if more developers are working on the same project, and the library must be included in the project.
First, create a repository structure in your project's lib directory, and then copy the library into it. The library must have following name-format: <artifactId>-<version>.jar
<your_project_dir>/lib/com/microsoft/sqlserver/<artifactId>/<version>/
Create pom file next to the library file, and put following information into it:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.2.0</modelVersion>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.2</version>
</project>
At this point, you should have this directory structure:
<your_project_dir>/lib/com/microsoft/sqlserver/sqljdbc4/4.2/sqljdbc4-4.2.jar
<your_project_dir>/lib/com/microsoft/sqlserver/sqljdbc4/4.2/sqljdbc4-4.2.pom
Go to your project's pom file and add new repository:
<repositories>
<repository>
<id>Project repository</id>
<url>file://${basedir}/lib</url>
</repository>
</repositories>
Finally, add a dependency on the library:
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.2</version>
</dependency>
</dependencies>
Update 2017-03-04
It seems like the library can be obtained from publicly available repository. #see nirmal's and Jacek Grzelaczyk's answers for more details.
Update 2020-11-04
Currently Maven has a convenient target install which allow you to deploy an existing package into a project / file repository without the need of creating POM files manually. It will generate those files for you.
mvn install:install-file \
-Dfile=sqljdbc4.jar \
-DgroupId=com.microsoft.sqlserver \
-DartifactId=sqljdbc4 \
-Dversion=4.2 \
-Dpackaging=jar \
-DlocalRepositoryPath=${your_project_dir}/lib
The above answer only adds the sqljdbc4.jar to the local repository. As a result, when creating the final project jar for distribution, sqljdbc4 will again be missing as was indicated in the comment by #Tony regarding runtime error.
Microsoft (and Oracle and other third party providers) restrict the distribution of their software as per the ENU/EULA. Therefore those software modules do not get added in Maven produced jars for distribution. There are hacks to get around it (such as providing the location of the 3rd party jar file at runtime), but as a developer you must be careful about violating the licensing.
A better approach for jdbc connectors/drivers is to use jTDS, which is compatible to most DBMS's, more reliable, faster (as per benchmarks), and distributed under GNU license. It will make your life much easier to use this than trying to pound the square peg into the round hole following any of the other techniques above.
just add
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>runtime</scope>
</dependency>
For self-containing Maven project I usually installing all external jar dependencies into project's repository. For SQL Server JDBC driver you can do:
download JDBC driver from https://www.microsoft.com/en-us/download/confirmation.aspx?id=11774
create folder local-repo in your Maven project
temporary copy sqljdbc42.jar into local-repo folder
in local-repo folder run mvn deploy:deploy-file -Dfile=sqljdbc42.jar -DartifactId=sqljdbc42 -DgroupId=com.microsoft.sqlserver -DgeneratePom=true -Dpackaging=jar -Dversion=6.0.7507.100 -Durl=file://. to deploy JAR into local repository (stored together with your code in SCM)
sqljdbc42.jar and downloaded files can be deleted
modify your's pom.xml and add reference to project's local repository:
xml
<repositories>
<repository>
<id>parent-local-repository</id>
<name>Parent Local repository</name>
<layout>default</layout>
<url>file://${basedir}/local-repo</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Now you can run your project everywhere without any additional configurations or installations.
If you are having some issue when including dependency for 6.1.0.jre7 from #nirmals answer in https://stackoverflow.com/a/41149866/1570834, in your pom with commons-codec/ azure-keyvault I prefer going with this:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.2.jre7</version>
</dependency>
It is not too hard. I have not read the license yet. However I have proven this works. You can copy sqljdbc4 jar file to a network share or local directory. Your build.gradle should look like this :
apply plugin: 'java'
//apply plugin: 'maven'
//apply plugin: 'enhance'
sourceCompatibility = 1.8
version = '1.0'
//library versions
def hibernateVersion='4.3.10.Final'
def microsoftSQLServerJDBCLibVersion='4.0'
def springVersion='2.5.6'
def log4jVersion='1.2.16'
def jbossejbapiVersion='3.0.0.GA'
repositories {
mavenCentral()
maven{url "file://Sharedir/releases"}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile "org.hibernate:hibernate-core:$hibernateVersion"
compile "com.microsoft.sqlserver:sqljdbc4:$microsoftSQLServerJDBCLibVersion"
}
task showMeCache << {
configurations.compile.each { println it }
}
under the sharedir/releases directory, I have directory similar to maven structure which is \sharedir\releases\com\microsoft\sqlserver\sqljdbc4\4.0\sqljdbc4-4.0.jar
good luck.
David Yen
You can use another driver
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
and in xml
<bean id="idNameDb" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="url" value="jdbc:jtds:sqlserver://[ip]:1433;DatabaseName=[name]" />
<property name="username" value="user" />
<property name="password" value="password" />
</bean>
The com.microsoft.sqlserver package on Maven now only has version 6.0 as the lowest version JDBC. So you need try another groupId Maven which has JDBC version 4.0.
I recommend this; it works for me. I'm using SQL Server 2012 and Java 8.
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
And a config properties file like:
jdbc.driverClassName = net.sourceforge.jtds.jdbc.Driver
jdbc.url = jdbc:jtds:sqlserver://localhost:1433;databasename=YourDB;encrypt=true;trustserverCertificate=true
I'm trying to use the Google Plugin for eclipse to run a GWT/GAE project as a web application, but I keep running into the error:
Unable to find path/to/war/WEB-INF/lib/shared
More specifically, I get:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.google.appengine.tools.util.Logging.initializeLogging(Logging.java:35)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:77)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: java.lang.IllegalArgumentException: Unable to find path/to/war/WEB-INF/lib/shared
at com.google.appengine.tools.info.SdkInfo._getLibs(SdkInfo.java:76)
at com.google.appengine.tools.info.SdkInfo.getLibsRecursive(SdkInfo.java:69)
at com.google.appengine.tools.info.SdkInfo.determineSharedLibFiles(SdkInfo.java:302)
at com.google.appengine.tools.info.SdkInfo.init(SdkInfo.java:237)
at com.google.appengine.tools.info.SdkInfo.getSdkRoot(SdkInfo.java:190)
at com.google.appengine.tools.info.SdkImplInfo.<clinit>(SdkImplInfo.java:19)
I had this application running fine previously, but it's been a while since I've worked on it. The GWT code compiles fine. It's only on attempting to run the code in a development server that this error arises. Looking through my previous commits I don't seem to see a time when WEB-INF/lib/shared ever existed, so either this is some new requirement or shared was just never committed in the past.
The only "solution" I've found online claims that they fixed it by removing appengine-utils-client-1.0.jar and appengine-utils-server-1.0.jar. However, neither of these seem to be in my project, so I don't think this solution will help me.
Any suggestions? Thank you much.
I ran into this problem also, after upgrading to GAE 1.8.0. Removing the appengine-tools-api.jar from the WEB-INF/lib directory solved the problem.
For anyone having the same trouble, I just ended up creating a new GWT setup and copying in my src files, and WEB-INF files that I specifically created/modified.
I got the same error when using GWTUpload. The previous posts helped me get on the right track, although I didn't have the jars mentioned in my web-inf/lib. Finally solved it by adding a Maven exclusion for appengine-tools-sdk. So my final GWTUpload pom.xml Maven code is:
<!-- GWTUpload -->
<dependency>
<groupId>com.googlecode.gwtupload</groupId>
<artifactId>gwtupload</artifactId>
<version>0.6.6</version>
</dependency>
<dependency>
<groupId>com.googlecode.gwtupload</groupId>
<artifactId>gwtupload-gae</artifactId>
<version>0.6.6</version>
<exclusions>
<!-- This exclusion got rid of the super hard to track down IllegalArgumentException on startup related to SdkInfo -->
<exclusion>
<artifactId>appengine-tools-sdk</artifactId>
<groupId>com.google.appengine</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
Just starting out with Flyway and Spring 3.0. So far, all I did was add the Flyway dependency and plugin to my pom.xml. Next, I tried running mvn flyway:status in the command line. However, it complains that it is unable to instantiate the jdbc driver (I'm using postgres).
Does anybody know what might be causing this? I'm using Springsource Tool Suite to develop my app. The postgres driver is located under WEB-INF/lib/postgresql-9.1-902.jdbc4.jar
Any help is greatly appreciated! Thanks!
For the Maven plugin to work you must:
Add this dependency to your project (or just the plugin):
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
and configure the plugin like this:
<plugin>
<groupId>com.googlecode.flyway</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>1.7</version>
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://...</url>
<user>...</user>
<password>...</password>
</configuration>
</plugin>
You also have to provide the Postgresql jdbc drivers as a maven dependency:
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-902.jdbc4</version>
</dependency>