I creating some application, using glassfish v4 web container.
I want to know "how to get properties of domain.xml({GLASSFISH_HOME}/glassfish/domains/{APPLICATION_NAME}/config/domain.xml) in java source using glassfish package"
Actually I need a glassfish application root context path
Related
I developed a web application using java and mongodb. I used glassfish server.
I tried to deploy it on jelastic cloud service
I uploaded my war file. But when I run it after deploying the war file it shows a 404 error. Why? The project works fine on my machine.
There are at least few potential causes:
your app needs some resources which are not started by default (such as DerbyDB). In this case you can check GlassFish log file - server_instance.log for more details.
you are trying to get resources from wrong context, make sure you are trying to get it via correct context name
In JBoss 4.2.3 we could configure items in
[jboss_server]/deploy/jboss-web.deployer/conf/web.xml
which would be adopted by all applications deployed. We've used this to configure context params, servlets, and default tag files.
We have dozens of apps deployed in war files, and this a very handy tool.
How is this accomplished in JBoss 7.1.1? I've googled and searched but can't seem to find the solution.
You could try web fragments (part of Servlet API 3.x). You'll be able to apply the same set of filters, mappings, listeners, variables to each web app's context using one META-INF/web-fragment.xml file (inside some WEB-INF/lib/my-common-context.jar, so it'd be easily managed as a simple dependency).
I'm very new to web applications. I've been told that JBOSS 7.1.1 has an in-built JAAS system which can be enabled on my JBOSS configuration quite simply. However I'm having trouble trying to get this running, namely most internet searching I went through has just ended up with older versions of JBoss.
Does anyone have a step-by-step guide on how to implement a simple JAAS authentication screen on my WAR file in JBoss 7.1.1? Prefarbly using its h2 database. Thanks :)
Also - my machine has trouble with Eclipse, so I can't use any of Eclipse EE's nifty server running mechanisms.
Finally got it. For those of you in the future:
You need your own standard login/logout pages in jsp/html/whatever. You put that in your web.xml constraints. Then you add an xml file called "Jboss-web" and type in your security domain (the default AS 7 is called 'other'). Then lastly add users and roles using adduser.bat in config folder.
I've got a mule-standalone server with an application I'm working on. Many of the services this application uses will be moved out of the Mule container into a JBoss cluster in the future. Because of this, I'm keeping a strong separation between the mule flows, and the Web Services. However, as of right now, I need to deploy the War file on the same server as my Mule application.
It seems like Mule should be able to run my War within it. Does anyone know if this is possible? I'm OK with adding a War into the Mule deployable zip for the time being, but would also like to deploy the war separately.
Mule ESB is not a standard Java EE container so it won't be hable to handle directly WAR files. In fact mule applications have the following structure:
/
\- classes // application-specific resources(e.g. logging config, properties)
|- lib // application-specific jars
|- mule-config.xml // Main Mule configuration file, also monitored for changes
|- mule-deploy.properties // Application deployment descriptor (optional)
|- mule-app.properties // custom properties to be added to the registry instance used by the application (optional)
as better explained here:
http://www.mulesoft.org/documentation/display/MULE3USER/Application+Format
What you can do is leverage the mule jetty connector to expose your web application. Your connector configuration will look like the following:
<jetty:connector name="jettyConnector">
<jetty:webapps directory="${app.home}/webapps" port="8083"/>
</jetty:connector>
and you will be putting your war files into the webapps folder. You can use the bookstore example as a reference:
http://www.mulesoft.org/documentation/display/MULE3EXAMPLES/Bookstore+Example
I have an EAR with a WAR that I'm deploying on GlassFish 3.1
Currently, the application runs at localhost:8080/myapp/index.jsf
I want it to run on localhost:8080/index.jsf
To accomplish this, I changed the application.xml in the EAR from contextRoot "myapp" to contextRoot="/"
When I deploy my EAR using the GlassFish admin UI, it gives me a deployment error, then when I try to browse to the admin UI, it shows me the default GlassFish home page. To recover I have to undeploy my EAR using asadmin from the command line and then do a restart-domain to restart the server.
My theory is that my application and the GlassFish admin UI are both running on root "/".
QUESTION: What is the correct way to deploy my web app in root of GlassFish 3.1? Or is this bad practice?
Thanks!
Rob
Rob,
If your deploying from the command line you can use an argument to asadmin to choose the context root. This has never given me the issue you describe.
$ASADMIN deploy --contextroot "/" your.war
Your other option is to under the Virtual Server settings to choose a default web module, but personally I prefer just setting one application to /.
Kevin
The easisest way is having a glassfish-web.xml.
This is my configuration which is located at my WEB-INF directory.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<context-root>/myapplication</context-root>
</glassfish-web-app>
As a note, you should consider to use war instead of ear. Glassfish 3.x which is reference implementation for the JavaEE6 has a feature to use war with EJB's. That is to say you can easily use your war with your ejb without ear bundle. It will not only decrease your application size significantly but also lets you to have a good practice in terms of class loading issues, memory footprint etc...