I am new to weblogic and have joined a team that has a number of projects. These projects have a master ant build that creates the associated ear, war, jar files and places them in a shared folder. This makes it handly to deploy to weblogic via the weblogic console. However, I have not found a way to make this process work with intellij's weblogic server integration.
I created a server instance in intellij and a run configuration that triggers the master build prior to running the weblogic server. I am not sure how to get the resources from this shared file and deploy them. Any guidance is greatly appreciated,
Ant build should not be used in local server deployment for weblogic. They just create deployable files.
In order to deploy the project to weblogic on IDEA, you must first create an artifact. Hit Ctrl+Shift+Alt+S(Project Structure Screen) and on the artifacts section, click "+" to create a new artifact. In the dropdown, you shuld see different kinds of deployable artifact types. Choose the appropriate type and it will create an artifact for you. If your configuration is correct, it should gather all the files needed in that artifact by itself. After that, you must go in the Run/Debug configuration screen for your local weblogic server and on the "Deployment" tab, choose the artifact you created.
Here
Run/Debug Configurations Screen:
Notice the "Before launch" section. You must see your newly created artifact there. If not, simply click "+" and choose your artifact.
Take a look: Packaging the application in a JAR
It explains a jar deployment, but the process is really the same. You just have to choose web application or JavaEE application. Remember;
choose JavaEE Application for ear packaging.
choose Web Application for war packaging.
Exploded means it will deploy the extracted content of the war/ear. You should stick with exploded.
Related
I have a project that is dependent on two war files being deployed to Tomcat. So every time I want to test it, I need to build an artifact and manually deploy it alongside the two wars. Is there a way to somehow add those war files to my Idea project so they can be deployed automatically by pressing Shift+F10.
I would deploy it manually, but I have several people working on the project and it would greatly simplify the communication.
Wars are external and they have no sources, so creating new modules/artifacts out of their source is out of the question.
Could you help me?
Since the link on the accepted answer is dead, here is the process, step by step (I'm using Intellij 14):
1) Select Run/Edit Configuration
2) If no Tomcat Run Config exists yet, create one
3) Select the Tomcat run config just created, on Deployment tab, under Deploy at server startup section, click the "+" (right sidebar), select External source, and select your war file.
You can add external webapps to deploy at startup at the Deployment-Tab of your tomcat runtime configuration page.
https://www.jetbrains.com/idea/help/run-debug-configuration-tomcat.html?search=tomcat#d884440e708
In my application I have three java modules. I have to deploy it into the tomcat server dynamically by selecting module 1 and module 2 or module 3. The selected modules will gets packaged and form a war file and gets deployed in server without restarting. How can I achieve this? Is there any Apache products/tools or any available to do this?
The products/tools you should look at is the Tomcat Manager. The default installation of Tomcat comes with the Tomcat Manager. As the names says it can manage (deploy, undeploy, reload, start, stop) applications for Tomcat without reastart. I'm not realy sure what are your needs and how your precondition look like, but i see four ways how you may can do this:
If you already have a WAR, you can simply use the Tomcat-Manager via a Browser. Just call the manager URL (e.g. http://localhost:8080/manager/html). There you have options to upload a WAR and undeploy a application. (Before you can login, you have to edit tomcat-users.xml - just google a bit).
Use Apache Ant. Ant is a XML-based build tool for Java. With Ant you can compile your SourceCode and pack it into a WAR. If you tomcat runs local, you can copy the WAR via ant in the webapps directory of the Tomcat. Tomcat will auto-deploy it (if auto-deploy is active, as it is by default). And if you remove one WAR from webapps, tomcat will auto undeploy.
Tomcat provides a library with ant commands, to deploy the WAR via HTTP over Tomcat-Manager to the server (Tomcat Ant Commands). So if the tomcat is remote, use this command via ant.
You don't like Ant? Use the Tomcat Manager direct via HTTP. (HTTP Commands). Of course than you have to compile and build the WAR on your own.
I hope it is usefull for you.
We have an .ear project with several dependent .jar projects and we are using Maven. Each project has its own property file, but the properties inside do not have specific values but placeholders, e.g.
database.url=${database.url}
The placeholder ${database.url} is replaced during Maven build process using the resources plugin. So for each stage (local, test, integration, production) we have a different Maven profile defining the filter, so if we build for the test stage we get something like
database.url=url.for.test.db
The application is running on WLS 12, and we want to deploy it on local WLS using the Eclipse server plugin (we are using Eclipse Kepler). However, when we add the application to the server in Eclipse and publish, it is not working since the placeholders in the property files are not replaced with specific values.
AFAIK, the content being deployed is located in the Eclipse workspace:
<workspace>\.metadata\.plugins\org.eclipse.core.resources\.projects\<ear-project-name>\beadep\<WLS domain name>\<ear-project-name>
Of course we could change the property files in that location, but whenever we publish in Eclipse, those changes are overwritten and we get again the original property file
database.url=${database.url}
which is useless when it is deployed to WLS.
Is there any mechanism or possibility to change the property files before they are deployed to WLS from Eclipse?
Thanks for your help.
Ok here is the solution I chose to solve this (I am not sure whether it is the best one, but at least it is working):
I added a new folder to the .ear project named "properties-local". This folder contains only those property files which are relevant for local deployment (without placeholders), e.g.
database.url=url.for.local.db
Wihtin the properties of the Eclipse project, there is a section "Deployment Assembly". I added the new folder "properties-local" to the deploy path APP-INF/classes, so this is the place where they will appear in the .ear which is used for local deployment.
The maven-ear-plugin, which is responsible to build .ear files for remote stages, is not aware of the directory properties-local.
So the drawback of the solution is, there are now two folders with property files: one for local Eclipse deployment, one for .ear files which are deployed on remote servers.
I've developed a small MVC project using Spring MVC, Hibernate, MySQL, Maven and Tomcat. I can run and test the application (locally) smoothly.
Now I need to publish/deploy this project on an (online) server that have only Tomcat installed on it. How can I publish/deploy the project online? Is there any special build I should do? What files I shall upload and to where?
There are several types of development options available.
For development on localhost EAR (Exploded ARchive) type of project is usually used (because you can easily make hot deploy on servery). But for production WAR (Web ARchive) is used (basically it's the same EAR archive, but compressed using ZIP algorithm).
If you want to deploy your project to remote Tomcat server then make your project as WAR archive and upload it to Tomcat's webapps directory. Then you might need to restart Tomcat. But it's manual way of deploying.
Better option is to use automated build tools (like Maven) which can compile your project, run unit tests, deploy on web server (local or remote) etc.
This one is a great example of how to deploy your project on Tomcat server by using Maven's tomcat-maven-plugin: http://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/
Good luck ;)
Do a mvn clean install and you will get a .war file in your target directory of web module.
Copy it and paste it in tomcat_home/webapps directory and restart tomcat. Thats it. now, you can access it in whatever configured port (eg: http://localhost:8080/<your webapp war name>). lets say your war name is myapp.war, then tomcat would have extracted it into myapp folder in webapps.
so your url will be http://localhost:8080/myapp
With maven deploy command, usually gets errors for various reasons.
if you work in Unix/Linux system, I recommend using "rsync" method on console. (You can write own shell script to manage easily). It helps not only deploying without a problem but also helps to get time while redeploying (only uploading changed / new files). Because maven deploy / redeploy uploads your project as a bundle in jar/war. However "rysnc" method uploads your project files one by one.
Before using it, you should sure that two conditions.
1- your project is built in target folder (Spring Tool Suite)
2- you have access to tomcat via ssh
example code : (v_ : prefix which is variable(customizable))
rsync -avz v_your_project_in_target root#v_ip:v_tomcat_name/webapps/v_project_name
(Second sharing)
I have a project with maven, this a multimodule project
Mainproject
project1 - jar
project2 - jar
project3 - web
Now that I finished the project I want to test it on the server but don't know how to upload them, on my computer I have added a plug for tomcat which deploys the war file to tomcat automatically, but the server doesn't have maven.
What is the way for moving to production with this kind of projects?
Should I just upload the target directories for each module?
Thanks
You're asking a few questions here. There is the "how do I test on a server" one, and there is "what is the way for moving to production" one. And they can be quite different.
I have assumed that the JAR files in the project are used by the WAR file and packaged within its WEB-INF/lib directory. If I'm wrong, that's cool. Just this sort of information is handy to know.
Maven is a build tool. It is not a deployment tool. What you have at the end of this, is a WAR file. If you run mvn install (or mvn deploy) you have a SNAPSHOT version of the WAR file. This would be suitable for quick, ad-hoc testing to other machines. But you would most likely use methods approriate for the hosting container for making them available. Note: a Maven DEPLOY is a different thing from a DEPLOY a war file to tomcat.
To my mind, if you're putting anything into production, or in front of a customer, or in front of a testing group, you should use Maven to make a Release of the product. That is, using the release plugin (via the release:prepare and release:plugin goals) to create a non-SNAPSHOT release of your artifact (in this case, a official version of the WAR file). Once you have that WAR file, you can migrate it to your production server in whatever way is easiest (copy, deploy into tomcat in the best way). You haven't mentioned if there are database requirements for this web application, and that would need to be considered before you change any production application.
But, once you have official versions, you have tags of source code, and you can accurately know what code is being run.
What I don't think you're going to get is being able to automatically copy the WAR file into a production server from your development environment. Here be dragons.