Global web.xml conf in JBoss 7 - jboss7.x

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).

Related

How do I use run-modes with context-aware configurations in AEM

We have a multi-tenancy website. We are trying to use social share components where the url needs to be shared. Since we have a dispatcher configured, we are picking up the domain from a context aware configuration. How do we use different domains for environments based on run-modes
I have tried to use different ca-config folder for each environment but this is not ideal.
Sling context aware configurations don't work on run modes. For your current requirement you should be using Externalizer service which works basis sling maps, request origin and OSGI configs based on what method you choose.
https://helpx.adobe.com/in/experience-manager/6-3/sites/developing/using/externalizer.html
https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/Externalizer.html
You can use Day CQ Link Externalizer which is available in the OSGI configurations, http://localhost:4502/system/console/configMgr.
It is an OSGI service that allows you to programmatic-ally transform a resource path into an external and absolute URL. You can configure this configuration for different run modes
You can also use a 2-step approach. 1st you create a Run-Mode dependent OSGi config. 2nd you use the built-in Override via OSGi configuration.
See here: https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html#override-via-osgi-configuration

How to reference apache cxf library from apache web server

When I deploy my apache cxf web service using eclipse I have to include the apache cxf library in the Web Deployment Assembly in order for it to work when I deploy it on my production apache web server. This is a problem because it makes the war file very large because the cxf library is included. If I exclude the library the war file is much smaller but the web service does not work when it is deployed on the live server even though the apache cxf library is on the live server.
My assumption is I need some kind of classpath reference so the live server can see the apache cxf installation but I am not familiar with how to do this as I am new to apache.
Thanks, Jesse
Put the cxf jars on folder tomcat/lib.
Ok, this workaround worked for me:
We can set the CXF lib path on the common.loader variable which is in $CATALINA_HOME/conf/catalina.properties file. You can add (after the comma) something like this:
common.loader=....,/path/to/cxf/home/lib/*.jar
I couldn't find a way to set an enviroment variable on tomcat in order to have something like: ${cxf.home}/lib/*.jar. I tried to put -Dcxf.home=$CXF_HOME in several places in catalina.sh but it never picked it up :( - hope someone can help on this later.
Restart tomcat and it will take cxf jars

Implementing a JAAS page to a WAR file on JBOSS AS 7.1.1

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.

Deploy War into Mule Standalone server

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

Axis2 and Spring3 integration

I have an Web application developed using Spring3. Some functions of Web app needs to be exposed as Web services also.
Web app is deployed in the Tomcat Server as a .war file.
I have gone through Axis2 and Spring integration in the site http://axis.apache.org/axis2/java/core/docs/spring.html. What I am unclear is how the final structure looks like. Need clarifiaction on the below points,
1) What should be the directory structure of my final app for "With ServletContext" as well as "Without ServletContext" ?
2)The .aar file also should be placed in WEB-INF/lib directory? If so how does axis2 recognize this as service as it has compulsion on the directory structure like .aar file and inside it META-INF which contains services.xml. and the classes at the same level as META-INF folder.
I am not sure if I am going wrong in getting the whole picture. Any guidelines or a good tutorial would be highly helpful.