Maven Dependency Project Not Found While Deploy to Glassfish 4 - java

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

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.

Maven Eclipse NoClassDefFoundError using Cloudant

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?

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.

Master project - Maven dependencies in Intellij

I'm currently working with Intellij as IDE, and I have 4 projects:
- An Admin project (contains java & ember for the front-end)
- An WS project (contains the WS)
- An API project (contains the objects, dao's etc)
- A master project which only contains a pom to reference the other 3.
Admin and WS depend on API.
I deploy everything in JBoss. Maven clean-install works, but I can't deploy to jboss: I get a ClassNotFoundError: WS can't find classes in API
My pom of the master file looks like this:
<dependencies>
<dependency>
<groupId>API</groupId>
<artifactId>API</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:/.../api/target/API-1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>WS</groupId>
<artifactId>WS</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:/.../ws/www/target/WS-1.0.war</systemPath>
</dependency>
<dependency>
<groupId>Admin</groupId>
<artifactId>Admin</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:/.../admin/www/target/Admin-1.0.war</systemPath>
</dependency>
</dependencies>
I use Maven 3.3.3 and Jboss WildFly 8.2.1
In Project Settings I've simply put the 3 Maven libraries (Admin, WS, API) under
In the Deployement tab of the Jboss condfiguration, the 2 wars (Admin, WS) and the jar (API) are listed
The errors I get:
Failed to define class ...ws.endpoints.helpers.WS in Module "deployment.WS-1.0.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link .../ws/endpoints/helpers/WS (Module "deployment.WS-1.0.war:main" from Service Module Loader) Caused by: java.lang.NoClassDefFoundError: .../dao/helpers/Dao Caused by: java.lang.ClassNotFoundException: ...dao.helpers.Dao from [Module "deployment.WS-1.0.war:main" from Service Module Loader]
What am I doing wrong? Is there a better way to deploy all this?
I've also tried to use the local Maven repository to find the correct depedencies (removed the scope and system path), but I can't find them, although they are correct located under the C:\users.m2 directory
Thanks in advance!
Specifying scope as 'system' means that your artifact is always available and is not looked up in a repository, so if you are building those artifacts during your build life cycle - "system" scope is not the right way to go.
I would recommend:
1. Try packaging your artifacts and deploy to JBoss manually, just to make sure that it works
2. Then try it out with Maven plugin for JBoss: http://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html

weblogic 12c deployment failure

I'm migrating from Weblogic 11g to 12c, during the deployment process it fails and shows the following error:
Caused by: weblogic.application.naming.ReferenceResolutionException: [J2EE:160199]Error resolving ejb-ref "ejb/BizRuleFacade" from module "BizAgi-ejb.jar" of application "BizAgi-ear-Weblogic". The ejb-ref does not have an ejb-link and the JNDI name of the target bean has not been specified. Attempts to automatically link the ejb-ref to its target bean failed because multiple EJBs in the application were found to implement the "BizAgi.bpm.rules.entities.BizRuleFacade" interface, including BizAgi-war.war/BizRuleFacadeBean, BizAgi-ejb.jar/BizRuleFacadeBean. Specify a qualified ejb-link for this ejb-ref to indicate which EJB is the target of this ejb-ref.
My web.xml file looks like this:
<ejb-local-ref>
<ejb-ref-name>ejb/BAScopeLogFacade</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>BizAgi.PAL.historylog.entities.BAScopeLogFacade</local>
<ejb-link>BizAgi-ejb.jar#BAScopeLogFacadeBean</ejb-link>
</ejb-local-ref>
The BizAgi-ejb.jar is a module inside the ear (BizAgi-ear-Weblogic.ear).
How can i properly deploy my application?
Thank you so much everybody, I've finally found the solution, it is to simply delete/remove the META-INF/MANIFEST.MF file from the .war file. That way the EJBs aren't double referenced.
1.Add below dependency in Ear Pom.xml
<dependency>
<groupId>com.example</groupId>
<artifactId>ejbModel</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
2.In Ear pom.xml in modules add ejb module
<modules>
<ejbModule>
<groupId>com.example</groupId>
<artifactId>ejbModel</artifactId>
<bundleFileName>ejbModel-1.0-SNAPSHOT.jar</bundleFileName>
</ejbModule>
.......
</modules>
3.Change scope of ejbmodel dependency to provided in application pom.xml
<dependency>
<groupId>com.example</groupId>
<artifactId>ejbModel</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
4.add persistence.xml of ejbmodel application to resource folder
Make sure that the same EJBs are not loaded multiple times in your deployment. You can check this by using the weblogic console (AdminServer) and checking the EJBs of the deployment (by clicking the little "+" sign next to the deployment that is failing int the deployments overview).
In my case I had to fix the maven dependencies (by setting one dependency of one project to "provided") so that it did not load the same EJB twice.
ERROR:
weblogic.management.DeploymentException: weblogic.application.naming.ReferenceResolutionException: [J2EE:160199]Error resolving ejb-ref "com.xxx.xxx.xxx.xxx.xxx.xxx.XXXX/xxxRemote" from module
"XXX-X.X.X.war" of application "XXX-X.X.X". The ejb-ref does not have an ejb-link and the JNDI name of the target Bean has not been specified.
SOLUTION:
1 SOLUTION: pom.xml (Web Project)
<dependencies>
<dependency>
<groupId>co.xx.cxxxx</groupId>
<artifactId>xxxxx-ejb</artifactId>
<version>1.0</version>
<type>ejb</type>
<scope>provided</scope>
</dependency>
<dependencies>
2 SOLUTION: Delete xxxxx-ejb.jar
xxxx.ear > xxxx.war > WEB-INF > lib > xxx-ejb.jar [remove]
3 Conclusion:
This is because there is a double reference to the ejb.jar, therefore the best way to control this is by saying in pom (web) that the is of type EJB, in order to take the (ejb.jar ) from the parent (EAR, where the ejb module is added).
I hope to be of help

Categories

Resources