How can I use the same jar files in EJB and EAR projects?
EJB ---> Jar files to add build path in Eclipse.
EAR ---> EJB project & jar files to add Java EE dependencies.
Otherwise I'm getting a class cast Exception for what seems to be identical classes.
Example:
com.sample.es.ra.EsCciConnectionFactory cannot be cast to com.sample.es.ra.EsCciConnectionFactory
In short: add the jar files as dependencies to your EJB project and the resulting EJB jar to your EAR project.
You can do it differently depending on the build management system. With ant, use depends attribute for your targets, with maven, define the EAR project as parent for your EJB project.
Ant example
Maven example
Jar files that are to be shared by all modules in an EAR archive can be placed in the \lib folder that's in the root of the EAR.
In Eclipse, using WTP's Enterprise Application Project it will look like this in project explorer:
foo_ear <--- the EAR project
EarContent
lib <--- Put your jars here
bar.jar
kaz.jar
foo_ejb <--- the EJB project
src
com.example
Something.java
EAR Libraries <--- lists libraries "found" in root EAR's /lib
bar.jar
kaz.jar
Related
I added a class library project to my .net core 5 solution. I realized that it doesn't contain configuration files that other project types normally do, such as appsettings.json. And it doesn't have the Startup.cs either. I wonder if I can simply add them into the project? If I do, will they work just like they do in other project types? I need this project to be able to read from configuration file and load services and pipelines in Startup.cs.
Having migrated from Spring Boot 1.5.19 to Spring Boot 2.0.4, we are encountering problems with the build on jenkins. Using gradle 4.2.1. We think the behavioural changes in the spring boot gradle plugin between the versions is causing our issue.
The spring Boot gradle plugin has also been updated from 1.5.19 to 2.0.4
Our target artefact naming convention is :
project-name-<version>-<branch>-RELEASE.jar
The jar file gets generated correctly, having specified the following in the build.gradle file.
bootJar {
baseName = 'project_name'
}
The problem occurs when the uploadArchives task is executed. This task looks for an artefact with the following naming convention.
<path-folder-name>-<version>-<branch>-RELEASE.jar
where is the name of the folder path on the jenkins.
It doesn’t seem to be picking up the baseName config.
The build pipeline runs successfully when we don’t perform the uploadArchives task. Also, prior to the Spring Boot upgrade, this was not an issue.
Is there a way to get uploadArchives task to look for the generated jar file name?
I resolved this eventually by adding a settings.gradle file and defining a a root project name in that
rootProject.name = "project_name"
I think the upgrading of the spring Boot gradle plugin must have changed the way the project was being defined.
The 1.5.* version seemed to be taking the project name from the baseName in the Jar task, but the newer version was using the folder name where the app sits.
That was fun
Please help me out,I have developed the simple application with two external jar files.While clean and build,it's creating a jar file for the application and the library folder in dist directory. When I try to execute as a jar,it's executing perfectly
But When I converted the jar into exe file using launch4j,after conversion,the execution is reporting NoClassDefFoundError.
I Hope, One-Jar is a solution for ma problem, But How to do One-Jar in Netbeans IDE or how to wrap all the dependency libraries with the application?
There are yet answers to this question here:
NetBeans - deploying all in one jar
Put external library to the JAR?
I have a GUI application that connects to a SQL Server 2008 database using sqljdbc4.jar. If I run this from the command line it works great.
However, once I wrap it into an executable JAR, I get a "No suitable driver found for jdbc:sqlserver://myServer:1433;databaseName=myDb" error. I know that my Windows system CLASSPATH is ignored once it's in a JAR, but I can't figure out include the sqljdbc4.jar within the executable JAR and get a portable application.
My most recent attempt to fix this is as follows:
My MANIFEST.MF file:
Manifest-Version: 1.0
Class-Path: lib/sqljdbc4.jar
Created-By: 1.7.0_11 (Oracle Corporation)
Main-Class: MyApp
The command I use to compile the JAR:
jar cmf MANIFEST.MF MyApp.jar MyApp.class help.html lib
My directory structure is below. I am running the jar command inside the MyApp directory.
+ MyApp
+ lib
- sqljdbc.jar
- help.html
- MANIFEST.MF
- MyApp.class
- MyApp.java
When I create the JAR and run it inside the MyApp directory, it works fine. As soon as I pull it out of the directory, I get the error. How can I make the JAR access the sqljdbc.jar that is available internally?
Thanks in advance.
When you have an executable jar MyApp.jar with entry in the manifest.mf:
Class-Path: lib/sqljdbc4.jar
This means that the jar has an external dependency to sqljdbc4.jar in the (relative) folder lib. It is not included in the jar you created! So you need to make sure that there is a lib-folder containing sqljdbc4.jar relative to that jar when you execute it. So the folder structure when executing needs to be;
+ (a folder)
+ lib
- sqljdbc.jar
- MyApp.jar
I try to use Hudson's Deploy Websphere plug-in to deploy my artifacts to remote websphere.
From the plug-in documentation, I need to do this:
The following WAS JAR files need to be placed into the Hudson class path or dropped into the %project.basedir%/WEB-INF/lib/ directory. These JAR files can be copied from the %WAS_HOME%/runtimes/ directory of your WAS server installation.
com.ibm.ws.admin.client_6.1.0
com.ibm.ws.webservices.thinclient_6.1.0
I have installed hudson as a windows service, how can I add these jars to hudson's class path?
According to Hudson's documentation:
Changing the configuration of services
The JVM launch parameters of these
Windows services are controlled by an
XML file hudson.xml and
hudson-slave.xml respectively. These
files can be found in $HUDSON_HOME and
in the slave root directory
respectively, after you've install
them as Windows services.
The file format should be
self-explanatory. Tweak the arguments
for example to give JVM a bigger
memory.
Stdout and stderr from the service
processes go to log files in the same
directory.
So, it appears you can manipulate the service's JVM classpath using the hudson.xml file.
HTH