jboss 6.4 ignoring webapp directory structure - java

we are moving from jboss 5.1 to jboss 6.4 and i have below entries in my xxx.ear/META-INF/application.xml. it seems like jboss 6.4 is not able to identify webapp but when I change this to webapp.war then it is deployed, due to this I need to rename my webapp folder to webapp.war.
With jboss 5.1 it is working fine but jboss 6.4 needs this change, is their any way I can suppress this?
Application scripts needs update to rename webapp to webapp.war every where and I want to avoid it.
Thanks in advance.
<?xml version='1.0' encoding='UTF-8'?>
<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>Web App</display-name>
<module>
<web>
<web-uri>webapp</web-uri>
<context-root>/app</context-root>
</web>
</module>
</application>

Related

Generating a .war file from a static html/css/js web app and .ear container

I have a static site built using HTML/CSS/JS that I want to wrap up in a .war file and wrap that up in a .ear file to deploy on a Glassfish java server. However I am unsure of how best to generate the .war and .ear files.
Currently I have zipped and renamed / changed the type of containing folders to make the .war and .ear files, creating a META-INF/application.xml in the .ear and a META-INF/MANIFEST.MF and WEB-INF/web.xml inside the .war alongside the build files:
my-app.ear
--- META-INF
--- application.xml
--- my-app.war
--- META-INF
--- MANIFEST.MF
--- WEB-INF
--- web.xml
--- website build files (various folders and html/css/js files)
When I deploy the .ear on Glassfish I get no errors however the localhost root only shows the welcome page. I have also tried various different contexts such as localhost/my-app which return 404s (although that is expected given my applicaiton.xml context route is set to '/'.
Is my folder/file structure correct or am I missing something in setting up the .war and .ear files?
Serving the site in this way is a requirement for this project and I am not a regular Java user so I may be have missed something basic.
EDIT:
My application.xml file looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="6" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd">
<display-name>my-app</display-name>
<module>
<web>
<web-uri>my-app.war</web-uri>
<context-root>/</context-root>
</web>
</module>
</application>
My web.xml looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="my-app" version="3.0">
<display-name>my-app</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
Use Eclipse / Export / Java EE / EAR file within a dynamic web project. May be a small test project first and then look at differences. There is too much information missing to answer your question without guessing.

Can't create cron job in Google App Engine app that has multiple services

When I deploy my application which has multiple services, I can't see the cron job to be registered in App Engine Console, despite following directory hierarchy described in Configuration files overview .
This is my cron.xml file, which I placed in my default service's WEB-INF directory:
<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
<cron>
<url>/cron</url>
<description>Execute scheduled tasks</description>
<schedule>every 5 minutes</schedule>
</cron>
</cronentries>
This is my default service's appengine-web.xml file:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>default</application>
<version>1</version>
<threadsafe>true</threadsafe>
<sessions-enabled>true</sessions-enabled>
<manual-scaling>
<instances>1</instances>
</manual-scaling>
</appengine-web-app>
My GAE application has 4 services, all defined in application.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
<display-name>modules-ear</display-name>
<module>
<web>
<web-uri>module-default-1.0</web-uri>
<context-root>module-default</context-root>
</web>
</module>
<module>
<web>
<web-uri>module-1-1.0</web-uri>
<context-root>module-1</context-root>
</web>
</module>
<!-- declared other modules likewise -->
<library-directory>lib</library-directory>
</application>
My project structure:
Can you please tell me what am I doing wrong that my cron job doesn't run?
Try deploying cron configuration in a separate command:
If you're using gcloud cli: gcloud app deploy cron.yaml
Or gradle appengine plugin: ./gradlew appengineUpdateCron
Or maven appengine plugin: mvn appengine:update_cron
I had the same problem and running the command after the deployment solved it!

Gradle adds all modules as EJBs in application.xml

I have the following EAR project in my Gradle script having 2 deploy dependencies:
An EJB jar
An EJB client jar
What I want to do is create an EAR with the 2 jars in ear root but only the actual EJB jar in application.xml, i.e. something like this:
<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="6" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd">
<display-name>MyEJBEAR</display-name>
<module>
<ejb>MyEJB.jar</ejb>
</module>
</application>
Here is my build.gradle file:
project(':MyEJBEAR'){
apply plugin: 'ear'
dependencies {
deploy project(':MyEJBClient')
deploy project(':MyEJB')
earlib <common jars>
}
}
The produced EAR structure is what I want however it contains an application.xml file like this (i.e. adds all deploy dependencies as EJBs):
<?xml version="1.0"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
<display-name>MyEJBEAR</display-name>
<module>
<ejb>MyEJB.jar</ejb>
</module>
<module>
<ejb>MyEJBClient.jar</ejb>
</module>
<library-directory>lib</library-directory>
</application>
I have tried to play with deploymentDescriptor like this but I had no luck:
ear {
deploymentDescriptor{
module("MyEJB.jar", "ejb")
}
}
Any idea on how could I exclude the MyEJBClient.jar reference from the application.xml file?
EDIT:
I have found a workaround solution to this by throwing my existing (IDE Generated) META-INF folder that contains a valid application.xml from the EAR project root to a dir(e.g. MyEJBEAR/resources) and adding the following
lines in project(':MyEJBEAR') closure:
ear {
appDirName = 'resources'
}
This done based on this section of Gradle Documentation but I still need to somehow generate a valid application.xml from my build script.

HTTP Status 404 when packaging WAR in EAR file

I'm using JBoss AS 7.1.1.Final and have been having problems getting my deployment to work. I have a couple of EJB jar files and a WAR file that I'm packaging into a single EAR. If I deploy the WAR file separately, I'm able to access it by the context-root specified in the jboss-web.xml file. However, when I package it up into an EAR file, I keep getting a "HTTP Status 404 - /pacbridge-web/" error for the same URL.
Here is what I have
EAR File:
|---pacbridge-app-6.0.0.jar
|---pacbridge-dom-6.0.0.jar
|---pacbridge-ejb-6.0.0.jar
|---pacbridge-web-6.0.0.war
|---META-INF
|---application.xml
|---MANIFEST.MF
|---lib
|----bunch of jar files
My application.xml looks like this:
<application ...>
<display-name>pacbridge-ear</display-name>
<module>
<web>
<web-uri>pacbridge-web-6.0.0.war</web-uri>
<context-root>/pacbridge-web</context-root>
</web>
</module>
<module>
<ejb>pacbridge-ejb-6.0.0.jar</ejb>
</module>
<module>
<ejb>pacbridge-app-6.0.0.jar</ejb>
</module>
<module>
<ejb>pacbridge-dom-6.0.0.jar</ejb>
</module>
<library-directory>lib</library-directory>
</application>
I'm not sure that it's applicable but there is my jboss-web.xml file:
<jboss-web>
<context-root>pacbridge-web</context-root>
</jboss-web>
Could someone give me some hints as to what I might be doing wrong?
Thanks

Do JBoss Seam applications have to be packages in an EAR?

Is it possible to package up a Seam application as a WAR file? I am trying to deploy a current Seam application that was running in JBoss to JBoss 6. It is packaged as a WAR file, but every example included with the Seam download seem to be packaged in an EAR with the Seam jar and application code, both deployed as EJBs
Sharing the error message at deployment would be helpful.
Was the web application (file.war) referencing services not in the file.war?
Most projects are deployed as an ear because the ejb modules are packaged separately (see below application.xml). Take a look at the application.xml back on the original pre JBoss 6 server that it was running on. It likely it had other modules besides the war file.
<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
version="5">
<display-name>Seam Registration</display-name>
<module>
<web>
<web-uri>jboss-seam-registration.war</web-uri>Chapter 1. Seam
Tutorial 14
<context-root>/seam-registration</context-root></web>
</module>
<module>
<ejb>jboss-seam-registration.jar</ejb>
</module>
<module>
<ejb>jboss-seam.jar</ejb>
</module>
<module>
<java>jboss-el.jar</java>
</module>
</application>

Categories

Resources