JBOSS EAP 6.4 dependency - jboss6.x

We are deploying multiple Maven application wars in Jboss EAP 6.4. All Maven applications have some common jars. We want to put the common dependencies in Jboss server.
How can I achieve this?

You have to create a custom module. http://michaelrice.com/2015/01/how-to-develop-a-custom-module-for-jboss-eap-6x-as-7
And then set the dependencies in a file (WEB-INF/jboss-deployment-structure.xml) in each WAR you will deploy.
If you have JBoss EAP subscription you can get more complete documentation: https://access.redhat.com/solutions/195403

Make sure you have the list of custom jar and jar which already exists in Jboss EAP6 as this can cause issue while deploying because of multiple jars
Next Create a deployment structure then set the dependencies in a file (WEB-INF/jboss-deployment-structure.xml) (Add this to your multiple project )
Make sure to exclude dependencies causing multiples by defining in the above file.
check if you need any submodule in config files of JBOSS EAP (you can comment it, if you are not using).
Deploy your project and check if any dependencies causing issue and update it accordingly.

Related

Apache Karaf Deploying .War File

My purpose is to run a JSF application on OSGI Framework. So, I am trying to deploy a WAR file to a servlet container for OSGi web applications, called PAX-WEB. I have a proper working JSF implementation working on WildFly 8.0 application server. I succesfully created OSGi-ified WAR file from this application. When I try to deploy it into PAX-WEB using Maven the following error occurs:
missing requirement: javax.servlet.annotation
I have these JARs in /lib folder of my application: jsf-api-2.1.7, jsf-impl-2.1.7, jsp-api-2.1, jstl-1.2. When I add javax.servlet-api-3.0.1.jar to my WAR file and re-deploy it, this time the following error occurs:
javax.faces.webapp.FacesServlet cannot be cast to javax.servlet.Servlet
With this error, I can run my JSF page, but it is not displaying JSF tags.
You're mixing two issues here.
One, your framework setup is missing the servlet classes. So in that case I propose to use the pax-web-jetty-bundle. It's an uber bundle and also contains and exports the servlet classes. In that case make sure you don't have the servlet jars in your framework setup available. Btw. taking a look at the samples and Integration tests of Pax Web itself helps already to understand which libraries are needed.
The second issue you are facing is an issue of adding the servlet classes to the war, this is per OSGi and servlet spec forbidden to do.
So without any further knowledge of your scenario you might be better of with using the Apache Karaf server (it uses Pax Web), cause there all infrastructure bundles are already included and known to work together.
One more thing, you get more and better feedback at the ops4j mailinglist.

Simple calender Liferay hook gives compiler errors

first intro: I try to get a hook running on a new Liferay 6.1.2 GA3. Previously I was using the portlet plugin mechanism only.
I try to get a simple calendar hook running and get compiler errors, such as "CalEvent cannot be resolved as a type".
My feeling is that I am missing the entire Liferay libraries in the hook, but the included libraries look complete to me (in order of build path priority):
- ear libraries
- Java JDK 6
- Liferay Hook Plugin API
- Liferay V6.1 CE (Tomcat 7)
- Web App Libraries
The libraries got automatically selected when creating the project as a hook. Any ideas?
com.liferay.portlet.calendar.model.CalEvent is in portal-service.jar. This should be on the classpath of your hook and Liferay IDE/DevStudio typically adds this library when you create a new hook. If it's not there, add it. You'll find it on the global classpath of your tomcat installation, e.g. ${liferay.home}/tomcat/lib/ext - assuming that you develop on tomcat.
If you need to add this file to the project, make sure it doesn't get packaged in the plugin's WEB-INF/lib folder - it needs to be picked up from the global classpath when deployed.
You do get the errors during development time (e.g. in IDE), not when you're deploying, right?
Or is it as simple as a forgotten "organize imports"?

Why are some RichFaces artifacts not in Maven Central?

In order to get the RichFaces Validator artifact org.richfaces.ui.validator:richfaces-ui-validator-ui (4.2.2 Final) in my build, I had to add https://repository.jboss.org/nexus/content/repositories/releases as repository in my POM.
I went that way after my build complained it couldn't find that artifact and a search for 'richfaces' in Maven Central did not return the "complete set" of RichFaces artifacts.
Just curious if anyone knows how RichFaces artifacts are chosen for inclusion in Maven Central.
Short answer: if you need this, you're probably doing something wrong. Maven Central should have all the dependencies required to create an app with RichFaces.
I was trying to add the ui-validator component separately (which is not deployed to Maven central) under the mistaken assumption that I needed it explicitly identified as a dependency. Including it caused me a considerable amount of pain (multiple csv.xml files in deployment).
In the end, I realized that the ui-components dependency (which is installed on Maven Central) bundles up the validation dependency (and many others).
In the end, I wasn't getting the components I was looking for anyway. I thought I needed the rich:ajaxValidator, but that was only because I was attempting to use code from the 3.x RichFaces Showcase in a 4.x app (and that tag was removed in 4.x).

jboss7 + same log4j configuration for different apps

I want to deploy some different applications using one jboss (jboss as 7). Can anyone make it clear for me if its possible to set one log4j configuration (log4j.xml) for multiple wars and ears or i'll have to put a copy of configuration into each archive?
Or maybe someone can suggest a differeng logging engine, more native to jboss7?
log4j configuration is always global to runtime. ie. A JBoss instance can't have multiple log4j configuration. log4j can be initialized or reinitialized with a single config file. it can be a simple properties file or a XML incompliance with log4j.dtd packaged with log4j*.jar. start the jboss instance with -Dlog4j.configuration=/anypath/log4jconfig.xml
I do not believe there is a way to configure log4j globally. JBoss AS7 uses JBoss Logging for it's log provider. You can configure the logging subsystem is in the standalone.xml or the domain.xml depending on if you're running in standalone or domain mode.
The documentation is not greatest unfortunately, but if you install the jboss-as-logging_1_1.xsd in your IDE you can get auto-complete. All the schemas are located in the docs/schema under the installed directory.

Classloading conflicts with apache commons classes for app deployed to WAS 6.1

I have an app that uses apache-commons-collections v3.2.1. When I deploy the war file using the WAS 6.1 Integrated Solutions Console I get errors because the commons-collections.jar file in isclite.ear gets loaded before the one that I bundle with my .war file. The problem is that my application requires v3.0.0+ of commons collections. The one in isclite.ear is version 2.1.
So, can I deploy into WAS 6.1 without involving isclite? Can I just drop a war file into a directory somewhere? Is there an option I can select in the process of deploying through the admin interface to skip or remove the isclite.ear dependency?
Thanks.
I had a very similar problem with ColdFusion where a jar in the server was a different version than the one that was needed by my application. I had to call a non-delegating loader (one that doesn't ask the parent to first load the class before loading the requested jar). The loader I used is open source. You can find out about it at
http://groups.google.com/group/javaloader-dev

Resources