I'm trying to run my camel application on external tomcat. There are 2 application.properties files present in my project, one under src/main/resources and other under src/test/resources. When I create war file using maven install command, it uses the application.properties file from src/main/resources (which is needed) but when I start the application using tomcat in eclipse, it is using application.properties file from src/test/resources. I've also removed classpath entry of src/test/resources from eclipse but no luck. I'm not really sure how is it picking the application.properties file from src/test/resources.
When I delete the application.properties file present under src/test/resources then it works fine i.e. then it picks the application.properties file present under src/main/resources.
We are using:
Oracle JDK 8
Spring 4.3.11.RELEASE
Tomcat 8.5
Camel 2.20.2
ActiveMQ 5.15.0
Maven Build Tool
Thanks in advance.
When Eclipse deploys a project to a server the important setting is the "Deployment Assembly", not the "Java Build Path". If you remove the src/test/resources folder from the deployment assembly, the files it contains will not be copied.
I packaged my spring boot application into a jar and I made it as a web service via apache tomcat 9 with a .bat file.
on the other hand the externalization of application-prod.yml does not work and the .yml file is ignored in the same path as the jar.
how can I do it please
use packaging tools to package,such as maven.
if you use maven,you should config packaging plugins
you may check the official document, and as your .yml file is already in the same path as the jar file, you may try this :
java -jar myproject.jar --spring.config.location=/path/to/your/yaml
I have written a REST-API using JAX-RS. For that I have created a Dynamic Web Project in Eclipse, and than converted it into a Maven project.
I want my logger folder to be WEB-INF/logs/loggerFile.out.
So I created a folder in my WebContent/WEB-INF/logs.
But now when I am packaging it in a WAR, the logs folder is missing in the packages WAR as as in the target/MyProj/WEB-INF..there is no log folder there as well.
I tried creating the folder inside target/MyProj/WEB-INF manually, but still its not available in the WAR file.
(I am viewing the content inside the WAR file using 7-zip).
I am doing all this on my Windows-7.
Please help
We use Maven war plugin to generate a war with attached classes jar. During the build, a properties file is generated. This property file should be put into the root directory of both the war and the classes jar.
Defining the properties file as "resource" implies that it goes the jar (and not war). Is there any way to put it into both artifacts?
I am trying to create an EAR file from the command prompt. I have used
jar -cvf myServletWAR.ear .
But my question is, how can I get this EAR file to have WAR files and JAR files inside it?
Do I need to create the war file separately and include in the ear file?
I can't use the ANT file for this, as there are few restrictions on this project.
One of my EAR files has structure as follows:
app.ear
- APP-INF
- lib
// libraries (.jar) here
- META-INF
- MANIFEST.MF
- weblogic-application.xml
- module1.war
- customlib.jar
This archive is being deployed onto WebLogic 10.3.
Remeber .ear is just a ZIP file, so you can always create it this way, although it seems messy.
check if jar cmd is working if so, create the jar of your class files and descriptors etc.
After that jar -cvf <<earname>> <<files want to be in the ear >>
Could you try this :
jar -xvf myServletWAR.ear
You could also refer to :
How to add a WAR file into an existent EAR file? and how to I have two .war files within one .ear file?
You would have to add these EAR file references in the application.xml of the ear file.
If you have generated a client and EJB together, they are automatically packaged into an enterprise archive file (.ear) and you do not need to do this. Otherwise:
Package the EJB's .jar file into an .ear for your application. To do
this use a jar command similar to the following:
jar -cvf myApplication .ear myService.jar
If you have a client .war file you can add that to the .ear file in the same way.
Create a deployment descriptor application.xml either using your
application server's tools or by copying and editing a sample, as
follows:
Locate a sample .ear, which is in examples directory in
mapdemo/mapdemo/repos/myService.deploy/JMapServ-WL.ear
Extract the descriptor application.xml from the .ear file, using the following jar command:
jar -xvf JMapServ-WL.ear META-INF/application.xml
Make a copy of the application.xml descriptor and edit it, replacing JMapServ with the name of your .jar file. You can also add the name of your .war file if you added that to the .ear file.
Put the descriptor in the meta-inf subdirectory of the directory containing your .ear file.
Package the descriptor into your .ear file using a jar command similar to:
jar -uvf myService.ear META-INF/application.xml
If you want to create an ear from the command line, following are the options that you can try.
Option 1. Using an ant build and use the ear task. Configure this ear task as stated in stackoverflow question on ant ear task usage
Note: Maven based build is preferred over ant these days.
Option 2. If you can use maven, configure your modules and use maven ear plugin to generate an ear. The below command will be able to generate the ear.
mvn clean package
Refer to the maven question regarding a Java EE project for more information on configuring war, jars for an ear.
.jar file into an .ear
jar -cvf myApplication.ear myService.jar
.war file you can add that to the .ear file in the same way.
Refer http://supportline.microfocus.com/Documentation/books/sx51/thdpoy10.htm