We have to package (using ant) a war file to be deployed (on tomcat )
Inside the lib folders, there are several jar files:
3rd-party-lib-A.jar
3rd-party-lib-B.jar
3rd-party-lib-C.jar
...etc
Such that lib-A depends on lib-B ...etc
The WAR is deployed fine, but cannot be started because errors likes this happen:
INFO: ExtensionValidator[/MyWebApp][3rd-party-lib-A.jar]: Required extension "lib-B" not found
INFO: ExtensionValidator[/MyWebApp][3rd-party-lib-A.jar]: Required extension "lib-C" not found
..etc
inside the manifest file of "3rd-party-lib-A.jar" we can find:
...
lib-B-Extension-Name: lib-B
lib-B-Implementation-Version: 1.1
lib-B-Implementation-URL: http://10.10.1.148/bundle/3rd-party-lib-B.jar
log4j-Extension-Name: log4j
log4j-Implementation-Version: 1.2.9
log4j-Implementation-URL: http://jakarta.apache.org/log4j
...
My question is, how to go from here?
1) repackage each jar to have a manifest with class-path, using relative path?
2) put the jars in the tomcat lib?
3) read the manual? :)
4) use maven?
thanks
Related
I have the following error when deploying and starting the application with Wildfly.
No EJB found with interface of type "de.dev.java.project.api.ProjectApi" for binding de.dev.java.project.restservice.ProjectRestService/projectApi.
Project module structure:
- project-api -> built as jar
- ProjectApi.java
- project-impl -> built as jar
- ProjectRestService.java
{
#EJB ProjectApi projectApi
}
- application -> built as ear, which includes modules above
I only have a problem when i build "project-impl" module as jar. When i built as war i do not have a problem. What does war include which jar does not?
You must build as a proper ejb jar, not just regular jar. It also needs to be referenced properly in the ear. Use you IDE to setup suitable maven project with the right archetype
I exported my Eclipse project as a runnable Jar file, added a manifest, as well as the appropriate class files with the command:
jar cfm JarFile.jar manifest.txt *.class
However, when I try to run the jar file with
java -jar JarFile.jar
I get the error that it "Could not find or load main class" etc. etc.
The structure of my manifest.txt file looks like this:
Main-Class: EclipseProjectName.src.packagename.mainclassname
(With a carriage return at the end)
Is something wrong with my manifest file? If not, what may be the reason that the main class cannot be found?
Thank you!
The manifest file extension should be .mf i.e manifest.mf. See here for jar file specification
Suggest to use fat jar eclipse plugin for exporting java projects as runnable jars.
Edit
Correct the content of manifest.txt as shown below
Main-Class: EclipseProjectName.src.packagename.mainclassname
project name and src are not required. Refer this
The entry in the META-INF/MANIFEST.MF entry in the finished jar file should be
Main-Class: packagename.mainclassname
and should correspond exactly to
/packagename/mainclassname.class
in your jar file (or jar file_s_ if you use Class-Path too).
I want to share a jar file for two war in the same instance.
For test, I make the jboss folder and war file like this.
1)JBoss Folder
server/default
-- deploy/
-- myApp.war
-- lib/
-- test_1.2.jar(only one method to output "1.2")
2)WAR
myApp.war
-- META-INF/
-- WEB-INF/
-- class/
-- myservlet(reference class test to output the version)
-- lib/
-- test_1.1.jar(only one method to output "1.1")
I hope the shared library could override the jar file in WAR,
but i still get the version "1.1".
it means that the jar file in WAR worked, but not the jar in the "server/default/lib".
Have you considered packing both WARs into an EAR and moving to JAR to the lib/ folder in the EAR? This makes it portable and will also work on JBoss AS 7 and later.
I have a project that only needs to take a proguard-constructed jar file, which is built in a separate SBT project and contains all classes needed to run as a servlet, and create a war file out of it.
The dependency is properly packaged into the war, and the transitive jars are excluded correctly using notTransitive(), but scala-library.jar continues to be placed into the war file as well. This is not desired, since the proguard-built jar contains those scala classes that are necessary for the servlet filter to run. The present project just needs to take that dependent jar, add a web.xml, and package it into a war file.
What is the simplest way (preferably using a build.sbt file) to get the war packaging mechanism from the xsbt-web-plugin to exclude the scala-library.jar?
This should work, it .sbt:
autoScalaLibrary := false
I'm making webapp using scalatra framework via sbt & xsbt-web-plugin.
I want to package all resources(templates, css, js) into a single jar.
In sbt with sbt-assembly plugin, assembly command makes single jar which includes all of project's dependencies.
$ java -jar myproject.jar
and I open it in browser
Could not load resource: [/WEB-INF/views/index.scaml]; are you sure it's within [null]?
I unzipped jar to confirm that it does not include src/main/webapp/*.
How can I config sbt for including src/main/webapp/* and building executable jar?
Resources are meant to be put under the resources folders. There are two such folders:
src/main/resources for resources available at runtime
src/test/resources for resources available only during testing
sbt will package those automatically for you when you run package-war or test. The project does not need to have the assembly plugin for sbt to include resources.
In your case, you should put the WEB-INF directory in src/main/resources/WEB-INF/.