I am using JBoss to deploy my EAR application which contains a RESTful War file.
I am using javax.was.rs.ApplicationPath, and the REST is accessible and running ok when I deploy the WAR directly on the server.
Problem is when I deploy it within the EAR file, I am not able to access it.
In the application.xml, I have the following
<module>
<web>
<web-uri>TP-Server.war</web-uri>
<context-root>/api</context-root>
</web>
</module>
In the javax.ws.rs.Application:
#ApplicationPath("/")
public class ApplicationConfig extends Application {
}
Is there any special configuration to make REST works in EAR?
Thanks
got problem solved. i think i just tried to republished the app.
Related
We are deploying an ear file on Tomee server. We have placed the ear file in tomee/apps folder.
EAR file consists of 1 ejb jar. When we start tomee, deployment is successful without any errors. The ejb has a listener class. How do we tell the EAR to invoke the listener class? Here is my application and web xml but do not see log messages printed from the Listener class. So I know the listener class its not called. Can anyone help? Totally new in this area and migrating from weblogic to tomee. Thanks
myproject/src/main/application/META-INF/application xml
<module>
<ejb>abc-ejb.jar</ejb>
</module>
myproject/src/main/webapps/WEB-INF/web xml
<listener>
<listener-class>com.xyz.listener.startup.AbcListener</listener-class>
</listener>
I am attempting to deploy a war file in Jboss eap 6.4 and I want to use the --name argument with the deploy. However, when I do so the war gets deployed but is inaccessible via the name..
The war file is named testweb.war. It works perfectly fine when I deploy it without the --name argument during the deploy command, but I am creating a deploy script where customers need to be able to name the application as well...
Here is the web.xml in my war file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd">
<jboss-web>
<context-root></context-root>
</jboss-web>
The command I'm using with the jboss-cli is:
deploy /path/to/war/testweb.war --name=testweb
And the web application is inaccessible via the url:
localhost:8085/testweb
This is the correct port number, and should be the correct application name..
Thank you in advance.
Well, I figured it out today in case anyone out there was also asking this very obscure question haha..
The issue is with the runtime-name of the deployed war. In Jboss the runtime name must end with the extension of the file being deployed.. So if you deploy example.war the runtime name must end with .war
When you specify a name without specifying the runtime name you get a problem, because by default jboss will use the application name as the runtime name.
So when I did: deploy /path/to/war/testweb.war --name=testweb
It was subsequently using testweb as the runtime name, and therefore wouldn't work properly.
/path/to/war/testweb.war --name=testweb --runtime-name=testweb.war is a way to fix this issue.
this has got to be a stupid question but my Google-fu fails me. I have a JBoss server (actually EAP 6.1) and a packaged web application, myapp.war.
By copying the file to .../standalone/deployments/ it gets deployed to <server>/myapp. Renaming the file to somename.war, it becomes <server>/somename, and ROOT.war gets deployed directly on <server.
So far so good.
But how do I get the application to appear under e.g. <server>/antares/myapp?
I tried simply making a subdirectory under deployments/ and placing my war file there, but that still gets deployed simply as <server>/myapp. I also read somewhere on a Tomcat forum to call my file antares#myapp.war, but that resulted in an error when the deployment scanner tried to run it.
Searching around on the web, I so far mostly found (a) descriptions of the folder and subfolder structure of a web project or (b) things about projects and sub-projects and how to handle dependencies.
I don't need all of that, I just want my perfectly fine war file to show up with a slightly deeper path. Preferably without having to touch many configuration files.
What am I missing?
You need to wrap your .war in to a .ear and add the following information in to the application.xml in order to achieve what you want.
<application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
<display-name>Your App name</display-name>
<module>
<ejb>a-ejb-module-if-you-have-one.jar</ejb>
</module>
<module>
<web>
<web-uri>myapp.war</web-uri>
<context-root>antares/myapp</context-root>
</web>
</module>
</application>
Please take a look at the documentation here: Setting the context root of a web application
I have an application deployed in JBOSS and it is accessed as: localhost/appname
When i enter only the IP address i get redirected to the JBOSS default page.
Is there a way to go to the application's homepage with no need to give /appname ?
I hope the question is clear.
Thanks in advance.
A part of the solution given by Nightsorrow, you can also define the context root of your web application using the context-root tag of the WEB-INF/jboss-web.xml file. So defining it as '/', you can keep your original file name. This way you override the default behaviour of JBoss, which is defining the context root of web apps as the file name of the application (unless the app name is ROOT.war, which its default context is '/').
So the jboss-web.xml file would look like something similar to:
<jboss-web>
... other tags ...
<context-root>/</context-root>
... other tags ...
</jboss-web>
Notice that there can't be two applications with the same context root, so first you will have to remove ROOT.war, or change its context root following the same procedure:
adding the context-root tag to jboss-web.xml (for example: <context-root>/oldRoot</context-root>, which would make the old ROOT.war application available through localhost/oldRoot),or
just changing its file name.
In case you want to deploy an EAR file with a web module (war) inside (instead of just a plain war file), you've to use the META-INF/application.xml of the EAR. Defining the web module this way:
<application>
... other tags and other modules (ejb, web ...) ...
<module>
<web>
<web-uri>nameOfYourWarFile.war</web-uri>
<context-root>/</context-root>
</web>
</module>
... other tags and other modules (ejb, web ...) ...
</application>
You have to deploy your application in file named "ROOT.war". Also you have to delete existing ROOT.war in deploy directory.
I am using eap6. This is my first time to use jboss. I don't see that I have $JBOSS_HOME/server. I see $JBOSS_HOME/domain/server. I have searched all the files under $JBOSS_HOME. I cannot find any WEB-INF and jboss-web.xml
I have an EAR file I am trying to deploy alongside various WAR deployments on JBoss 4.2.3
The individual standalone WAR deployments are all working fine and are just a copy of the same application that is contained inside the EAR but the EAR deployment and it's included WAR(s) does not work correctly.
I am receiving a blank white page in the browser when I visit the virtual host that the jboss-web.xml is configured to associate with this EAR. The other virtual hosts associated with the standalone WAR deployments all work fine and are configured the same way.
I get no errors on startup and JBoss reports that the site was started. I have a jboss-web.xml file in the WAR's WEB-INF that ties it into a definition from server.xml. This works on every other type of configuration except the EAR. I keep getting just a white page, as if JBoss can't connect the WAR in the EAR to the host or maybe the WAR isn't starting right or I have some config wrong here.
When I fire up JBoss it creates the flex and railo directories in webwar1.war/WEB-INF as well as a railo-server directory as railo.ear/lib/railo-server but still just serves me a blank white page.
Here is where I stand...
I have a set of shared Railo JAR files are located in /JBoss/server/default/deploy/jboss-web.deployer/railojars/lib (I have told jboss-service.xml to include this as a classpath)
My site1.WAR and site2.WAR files are in the deploy folder and each contain an index.cfm and a WEB-INF with web.xml and jboss-web.xml mapped to a virtual host. They each use this shared Railo JAR instance and run perfectly. The sites I've configured in server.xml with a docPath and appPath to an outside folder use this shared JAR installation and run perfectly. Everything is good with this.
If I place a railo1.war, railo2.war, etc in the /JBoss/server/default/deploy folder (the full WAR with Railo lib folder) those sites use the Railo instance contained within the WAR. This is also great.
So, my only problem left is this:
under /JBoss/server/default/deploy I have created railo.ear
Inside railo.ear is:
META-INF which contains application.xml with:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd">
<application id="RailoInstance1">
<display-name>Railo3</display-name>
<description>Railo3</description>
<module id="Module1">
<web>
<web-uri>webwar1.war</web-uri>
<context-root>/webwar1</context-root>
</web>
</module>
</application>
It also contains webwar1.war which contains: index.cfm and WEB-INF
WEB-INF has has web.xml, lib and jboss-web.xml
jboss-web.xml looks like this:
<jboss-web>
<context-root>/</context-root>
<virtual-host>foo3.com</virtual-host>
</jboss-web>
From server.xml:
<Host name="foo3.com">
<Alias>www.foo3.com</Alias>
</Host>
foo3.com is using jk_mod to send to JBoss via a virtual host from Apache. The other two sites (foo1.com, foo2.com) which are mapped to WAR deployments are configured the exact same way and work fine.
The WEB-INF includes the lib folder so I would expect this webwar1.WAR instance to use the Railo JAR files contained in that lib folder. The problem is that when I start JBoss, all of my other sites configured their various ways work, but the site in webwar1.war is not coming up. I simply see a white page in the browser.
So, either the jboss-web.xml in WEB-INF in the webwar1.war file is not being connected to the defined in server.xml or something else is going wrong here. My other standalone WAR installations and the shared JARs sites all see their respective descriptors as marked in their jboss-web.xml and have the same content as this deployment.
So, I'm just trying to figure out what I need to do to get this last EAR configuration to work.
The way I am trying now seems like each WAR would try to use the JAR files it contains, but I want to have one set of shared JAR files for the whole EAR and then each WAR file in the ear use those JARS.
I want to be able to have webwar1.war, webwar2.war, etc under this one EAR configuration so I have moved the lib folder out of webwar1.war/WEB-INF/lib and into railo.ear/lib
I would love to set it up this way, but I can't even get one WAR with its own JAR files to load up right when inside the EAR. I have tried this new configuration and get the same blank white page in the browser.
Any ideas?
JBoss gives me no errors. Another odd thing is that I don't get an error from Apache like I do when I try to visit a site that is improperly configured and did not start up. And if I visit a site that is not set up as a host in JBoss and I am redirected via jk_mod to JBoss, I see the JBoss default page. I am not seeing this default page when I visit the virtual host associated with this webwar1.war in the railo.ear, so JBoss must know that it's supposed to do something with the domain / virtual host or else it would show me that default JBoss page. Instead I see a blank white one.
I should also mention that this works on JBoss 5.1. The railo.ear configured the exact same way latches onto the virtual host and works properly.
Help? Thanks!!!!
Sounds like a complicated job; the folks on the railo-users mailing list might be able to help : http://groups.google.com/group/railo
Railo also has a professional services team who are ace : http://www.getrailo.com/index.cfm/contact-us/