How to deploy JAR file on JBoss? - java

I have a Java application using Spring, Hibernate and JMX.
Now i wanna deploy it on JBoss. I exported it to a Jar file and copy to the deploy folder of JBoss. But when i start JBoss, that app isn't deployed.
The error I saw that JBoss can't find out library files of Spring and Hibernate.So guys how to deploy a file Jar on JBoss ?

Java enterprise applications are not deployed as jar files, but as .war files (for web application) or .ear files (for complete enterprise applications, including EJB).
You would probably be looking at packaging your app as a .war file. Even if it's not a "web application", it needs to be packaged as one to be deployed to a Java enterprise/web container like JBOSS.
I would suggest browsing the tutorial available from Oracle to learn more.

Related

Jar via Tomcat in IntelliJ

I spended a few hours to resolve my problem with deploying jar file on tomcat but I lost all fights, and I must ask one question:
Is it possible to run the jar file via tomcat in intelliJ?
Best regards
It's not possible deploy a jar in Tomcat anywhere. You can only deploy war files.
Normally when you distribute a web application in a jar (like a spring boot app) you don't deploy it in a server, it's a standalone application you run from the command line.

Deploy to Tomcat

How can I deploy a war file to Tomcat in exactly the same way Eclipse deploys to Tomcat, if I configured Tomcat in Eclipse?
Reason for asking is that when I deploy with Eclipse everything works fine (databse connection, log4j ect). But when I manually deploy the corresponding war file to the same Tomcat installation, none of my external resources like database connection, logging to files work!
You can add the external jars to $CATALINA_BASE/lib Read here
Common — This class loader contains additional classes that are made
visible to both Tomcat internal classes and to all web applications

Is it possible to deploy war file into WebSphere 7?

I am able to deploy ear file into WAS 7. But for same project unable to deploy the war file into websphere 7. Is it possible to deploy war file into websphere 7?
I would strongly recommend deploying your WAR file in EAR archive for WebSphere Application Server. Although WAS servers support deploying WAS from admin console (and not from IDE like Eclipse or RAD), after deploying such WAR, WAS packages it into automatically generated EAR. So WAS (and also some other servers like Weblogic) always in fact run EAR applications.
With deploying WAR you also have no influence on EAR level configuration as it is generated automatically on WAS.
Websphere 7 is a Java-ee 5 application server and provides so both ejb and servlet container.
It's so indeed possible to deploy a war.
If your web-application (war) is part of your Java-ee application (ear) you have to package it inside the ear, otherwise you can deploy it alone.
See packaging application

Deploying Eclipse Java Dynamic web project on Apache Tomcat permanently

I have a Java web project in Eclipse which I run through Eclipse on Apache Tomcat.
Is there a way for me to permanently deploy the project on Tomcat such that it runs without having to open Eclipse and rather just starting Tomcat?
If yes, then what steps do I need to follow?
*UPDATE*
If I take the .war file and deploy it on another system will it work? Note that I am using a MySql database in this project. So will transferring the .war file also transfer the database?
You package the project into a war file (since it is a web project) and put that one into the Tomcat's webapps folder. The deployment should then happen automatically, when Tomcat is started.
Generate a WAR file within Eclipse. (Properties->Export->WAR File)
Place this file in the {installation}/webapps folder of Tomcat.
It should deploy now.

Deploy Java Web Project on Tomcat without WAR or EAR

I have a Java Web project (Struts + Spring) working perfectly in my localhost. I have to deploy it on my website, but the Tomcat Manager interface given by the webhost says it cannot upload a WAR file due to safety reasons. When contacting the tech support I was told it is not possible to upload a WAR and that I should try deploying my project by uploading the files directly (I have FTP access).
My problem is that no one at the tech support gave specific instructions on where I should put my project files (I don't know if it should be on de same folder the WAR would be sent to) neither how to start/stop it (Will the Tomcat Manager recognize it once I upload the files?).
You can always try to upload a war file to webapps folder of tomcat.
if tomcat is running with autoDeploy set to true it will auto deploy your application.
i think that the same will happen if you upload the exploded war to the webapps, the context will be the name of the directory you put your files in.
Just place your apllication's root folder to the Tomcat's directory webapps and configure tomcat to auto deploy. Restart the server and your application will be deployed.
You transfer the files to the same place as the war file would go - but just as an expanded war.
Whether or not tomcat will recognise that the files have changed depends on the configuration of the tomcat server. I'd just give it a go - transfer the files and see what happens. If it doesn't pick up the changes then you'll need to find out from tech support how to restart tomcat.

Categories

Resources