Maven Eclipse NoClassDefFoundError using Cloudant - java

I have a Java project that is running on a local Liberty Server on eclipse. I am trying to use a Cloudant database.
If I run a test file using the database in the project as a Java Application, everything is fine, but when running the project on the Liberty Server, I get this error:
`[ERROR ] SRVE0777E: Exception thrown by application class 'org.apache.cxf.service.invoker.AbstractInvoker.createFault:162'
org.apache.cxf.interceptor.Fault: com/cloudant/client/api/ClientBuilder
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
at [internal classes]
Caused by: java.lang.NoClassDefFoundError: com/cloudant/client/api/ClientBuilder
at com.example.Testdb.createClient(Testdb.java:77)`
But the ClientBuilder is already added as a maven dependency in the pom.xml file:
<dependency>
<groupId>com.cloudant</groupId>
<artifactId>cloudant-client</artifactId>
<version>2.6.2</version>
<scope>provided</scope>
</dependency>
The .jar file is also included in the Java Build Path.
What can I do to eliminate the NoClassDefFoundError?

Related

Glassfish 4.12 Internal Exception: java.lang.NoClassDefFoundError: org/apache/commons/lang3/Validate

I am trying to deploy sample Java EE Cargo Tracker application
https://github.com/javaee/cargotracker
I am able to deploy it by executing maven, which build project completely
mvn package cargo:run
However when I am trying to deploying application from IntelliJ Idea on Glassfish 4.1.12 I am getting
Internal Exception: java.lang.NoClassDefFoundError:
org/apache/commons/lang3/Validate. Please see server.log for more details.
My pom contains
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
<scope>compile</scope>
</dependency>
Tried 3.4 and 3.6, does not help, application fails to deploy with above error
This is configuration of artifact in IntelliJ IDEA
Project -> Artifact
Exploded WAR details
may be old or previous dependency occurring the issue so delete .m2 folder and use commons-lang3 version 3.5 update maven project and rebuild it and run it.

Firebase in Google app engine throwing noMethodFound error while initialization

I am trying to initialize firebase in Google appengine web app and using maven for dependencies.
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-server-sdk</artifactId>
<version>[3.0.0,)</version>
</dependency>
Getting error
java.lang.NoSuchMethodError: com.google.api.client.googleapis.auth.oauth2.GoogleCredential.fromStream(....)
at com.google.firebase.FirebaseOptions$Builder.setServiceAccount(FirebaseOptions.java:77)
How to solve this issue:
Go to http://search.maven.org/#search%7Cga%7C1%7Cgoogle-api-client and find the last version of com.google.api-client API.
Add the dependency on you project
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-assembly</artifactId>
<version>last version </version>
</dependency>
I do this on EJB project using netbeans and glassfish server, so I download the jar file of the last version com.google.api-client add it on Netbeans Libraries and glassfish libraries, then I compile the project and restart glassfish.

java.lang.ClassNotFoundException: org.joda.time.ReadablePartial

I'm using Eclipse Luna with Jaspersoft Studio plugin 6.2.2 to developer reports for web application. No problem to run one basic blank report from Eclipse plugin, but when I load this jrxml from java class, I receive the message:
Servlet.service() for servlet [default] in context with path [/insurance] threw exception [Filter execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.joda.time.ReadablePartial
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1858)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
I'm using the code:
JasperDesign jasperDesign = JRXmlLoader.load(fileName);
What's this error?
Sounds like you're missing the Joda-Time dependency. GitHub project for Joda-Time available here.
As per documentation, to get the latest Joda-Time jar you can do:
Maven:
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
Gradle:
compile 'joda-time:joda-time:2.9.4'
Or you can manually download the latest jar from here and add it to your classpath.

Maven compilation and run time error java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z on Tomcat 8 Server

I've been converting a large Java Web App to a maven project, but I've run into an error in a handful of classes originating from the tomcat-dbcp jar. I get the following error messages from any class that needs to use BasicDataSource objects:
javax.servlet.ServletException: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z
Now I know this jar is present on the server (as it is default in our Tomcat8 installation). So in maven I declared this dependency as such:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>8.0.26</version>
<scope>provided</scope>
</dependency>
But I'm still seeing this error. What can I do to eliminate this error?
This error did go away, though I have no idea why. The pom entry is still the same and still running on Tomcat 8. We did find a hacky temporary fix:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ojdbc7-12.1.0.1.jar</systemPath>
</dependency>
But we reverted back at some point and it is working fine.

Maven Dependency Project Not Found While Deploy to Glassfish 4

I have a project IIFS-ejb (EJB project) and IIFS-common (jar file)
<dependency>
<groupId>com.islandfurniture</groupId>
<artifactId>IIFS-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
I define the dependency as shown above
However, receive an error saying when i try to deploy the ejb project together with iifs-common to glassfish 4.0. The iifs-common project can be deployed while the ejb failed with the following error
severe: java.lang.NoClassDefFoundError: iifs/common/exceptions/UserRoleNotFoundException
Please help thank you

Categories

Resources