I know that when a war file is created of my web application, i have to deploy it, that is if i am using JBoss i have to copy it to deploy folder and if using WAS i have to install it.
But i want to know, When i start the server from where the server starts deploying my application. that is which is the entry point to start loading my classes, properties ,DB connections etc..
Thanks.
It's the web.xml file, which is known as the deployment descriptor. This is where you configure your servlets and filters. In particular, you map urls to servlets, and this is the entry point into your application. The classes are loaded on startup, before any requests are handled.
Here is a link to more information about deployment descriptors.
Related
Is there any way I create or upload a configuration file to weblogic server. The configuration file will be used by a java application deployed on the weblogic server. But I can use weblogic server admin console to update this configuration file and don't have to have someone go to the server and find this file and update it in an text editor.
Is this possible? If so, how can I do this.
You want Deployment Plans for your app. They allow you to customise an EAR or WAR's internal settings.
Bear in mind that early versions of WLS 11g had a bug where specifying a deployment plan at the same time as uploading an app didn't work through the console, and you had to upload, then apply the deployment plan in a separate step (or use WLST or a maven plugin to do it)
I use tomcat as web server,I want to deploy many same war file in tomcat server with different config. How to do this in the best way possible manner?
So I want to run tomcat server per each war application, my means is tomcat1 handle the .war1 in webapp and ... or handle all war files with one tomcat?which one is better?
Change the names of your war files and deploy
Use the same tomcat server, but copy and rename your web application to something different. For eg, the original application name app, copy and rename as following.
webapp -> app1
app2
app3
Running a different tomcat server for each war application might not be necessary.
In a JBoss 5 JEE project which I have inherited, the web application (WAR) project contains a JNDI configuration file which seems to be unneccessary. Its content is
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost:1099
Removing it has no obvious effect, deployment and execution works well and unit tests show no errors.
Is it safe to delete this file?
You would create that file if you want to create a -client- that connects to a JNDI context to invoke EJBs remotely. If that war is part of the application that serves the EJB, you indeed do not need it since you already have local access to the JNDI context. Assuming the war is part of an EAR that also holds the EJB module.
I have two war files WARA and WARB deployed in a tomcat, both use same log4j properties file. How to reset the log4j configurations in both war files through another stand alone application deployed in same tomcat without disturbing WARA and WARB? Is it possible to do?
If polling is an option you can use PropertyConfigurator.configureAndWatch().
More here.
If you need to do it manually the process is bit longer. On a high level its as follows.
Configure JMX for your application server / servlet container.
Write an MBean to trigger full reconfiguration.
Register the MBean in WARA and WARB.
Connect to the MBean server from the other webapp.
Invoke the MBean in WARA and WARB.
If you can provide more details on what software stack your are using I may be able to provide specific details on how to do the above.
not the best way , but make a jar file that contains properties file ,and place it tomcat lib folder ,all applications use same propertyfiles.
I want all my .jsp files to be compiled at deploy instead on first access. Anyone knows how to do it in a webserver agnostic way (through web.xml maybe?). If there is not a way to do this through a project configuration I would like to know how to do it on Weblogic.
You can set the server to precompile JSPs on deployment. See section Precompiling JSPs in the WebLogic JSP Reference. From there:
You can configure WebLogic Server to precompile your JSPs when a Web
Application is deployed or re-deployed or when WebLogic Server starts
up by setting the precompile parameter to true in the
element of the weblogic.xml deployment descriptor. To avoid
recompiling your JSPs each time the server restarts and when you
target additional servers, precompile them using weblogic.jspc and
place them in the WEB-INF/classes folder and archive them in a .war
file. Keeping your source files in a separate directory from the
archived .war file will eliminate the possibility of errors caused by
a JSP having a dependency on one of the class files.
For more information on the web.xml deployment descriptor, see
Assembling and Configuring Web Applications.
For weblogic, you have both approaches here (http://m-button.blogspot.com.es/2008/09/using-jsp-precompilation-in-weblogic.html).
I prefer doing it at build time, as it will not impact application deploy time.
One way to get this done is to add the jsp_precompile as a request parameter to the desired jsp as in
http://localhost/myApp/desired_page.jsp?jsp_precompile=true
I personally am not an advocate of sending such a systemic config parameter so obviously in a request, so you should do it within the page (or group of pages) as described in this tutorial