jboss SAR instead of /tomcat/shared (alfresco for example) - configuration

Hey all,
I'm curious if you can use a jboss SAR to hold all the xml, class files, and even lib files that, if you were using tomcat, were traditionally in the /shared/classes, shared/lib locations into a SAR.
The intent is that instead of messing around in the jboss/conf/ directory to simply deploy an 'appconfig.sar' beside your actual app.war/app.ear.
Example usecase is Alfresco shared/classes/*..
thanks for any feedback!

I would say this depends on your JBoss version and the ClassLoadingConfiguration you're using. I can work, but then it can just as easily break in the next version of JBoss. JBoss 7 is very strict for example.
In general I would not rely on the specific behavior of a specific JBoss version and package my dependencies with my application. If you want to share dependencies between several .war then consider having then all in in an .ear and the dependencies in .ear/lib.

Related

How to enforce module boundaries in Java <= 8

I want to modularize a monolithic application by using Java modules (introduced by Project Jigsaw).
Unfortunately I'm currently stuck to use Java 8. I would like to build those modules (jar files) anyway, but without the feature of using a module-info.java file for declaring the dependencies and the exported API.
Some weeks ago I stumbled upon an API/framework which allows to define nearly the same things that you can do in a module-info.java file. It could be used in JUnit tests in order to enforce module's not to use the internal's of another module and that module's only can access modules they explicitly depend on.
Of course you do not have any assistence from the compiler or the IDE, but you can enforce the access by JUnit. Unfortunately I do not find the project which provides the API any more.
Can anyone help?
Btw. if there is another good approach beside a unit test, please let me know, too!
https://www.archunit.org/ is what I have been looking for.

WIX InstallUtil/InstallUtilLib and Configuration File Deployment why is InstallUtil bad?

I often find the quote "InstallUtil.exe" is an ugly pattern or "Don't use InstallUtil.exe" and that I should use native WIX or Installation package patterns and I still don't understood why.
I stepped away from using InstallUtil to install a .NET service as I finally learnt that writing registry keys for such an action should be an un-install-able action - and I've come to terms with this as correct.
As I've been working through my WIX installer for a relatively complex product, I have found myself in need of creating or updating SQL Server databases, creating or updating IIS Applications and finally updating or creating configuration files.
Each of my components (features) are optional, but they all share the same configuration file. As my product uses unity, its important to note that this library contains strong support for reading/updating/removing components from the Unity Configuration block, therefore it seems fairly smart to me that I should take advantages of these blocks via Installation Components (i.e. InstallUtil) to create or update my configuration file at installation time.
Just to be clear here, my installer does not natively contain a configuration file for my application: at installation time, the installer has no idea as to the shape of it as its based on the features selected. Surely I should be embedding this knowledge into each of the modules that are to be deployed and not in the remit of the installer which is now a completely independent project? Wouldn't this break O-O principals even if we are talking about installation?
I'd really appreciate some guidance as to whether this is good practise or not? Am I reading 'InstallUtil' is bad for installing services, or is it that using 'InstallUtil' is bad full-stop? If so, what are my options for smart updating of configuration files?
The main reason for avoiding InstallUtil is that it runs outside of the installation transaction, so Windows Installer cannot keep track of what it's done.
I have used InstallUtil on a few occasions, when I just couldn't get Wix to do what I needed and didn't have time to write a custom action. In this case I called the InstallUtilLib version as I feel this is a cleaner approach.
I used the this blog as a guide as to how to achieve this.

How to configure properly IntelliJ IDEA for deployment of JBoss Seam project?

I would like to use IntelliJ IDEA for development of JBoss Seam project. seam-gen is creating the project stub, however the stub is not complete. In particular it is not clear how to deploy such project.
First of all I had to define manually web project facelet and add libraries to its deployment definition.
The other problem was persistence.xml file. In the Seam generated project it does not exists, since Ant is using one of the persistence-dev.xml, persistence-prod.xml, persistence-test.xml files, changing its name, depending on deployment type (which is ok). Obviously I can create persistence.xml by hand, but it goes againts Seam way of development.
Finally I decided to use directly ant, which is not partucularly comfortable.
All these tweaks made me think that I am doing something wrong from the IntelliJ IDEA point of view.
What is the efficient way of configuring IntelliJ for usage with JBoss Seam (deployment, in particular)?
I am using JBoss Seam 2.1.1, Intellij 8.1.4, JBoss 4.3.3
facet
I don't think you have to create any facet manually, as long as i remember IDEA always did it automatically for me...
persistence.xml
If IDEA didn't grab automatically persistence-dev.xml, you can tell her to use this file and not care that it's name will change after deployment...
artifact
You can still build your app using ant and create an analogical artifact in IDEA in the same location (for example exploded-archives/Project.war) - just leave "Build on make" unchecked (you want to build this artifact with ant)...
deployment
now, when you create new run configuration for the jboss as, in the deployment tab you can choose your artifact... just as if it was built by IDEA

Defining a runtime environment

I need to define a runtime environment for my development. The first idea is of course not to reinvent the wheel. I downloaded macports, used easy_install, tried fink. I always had problems. Right now, for example, I am not able to compile scipy because the MacPorts installer wants to download and install gcc43, but this does not compile on Snow Leopard. A bug is open for this issue, but I am basically tied to them for my runtime to be usable.
A technique I learned some time ago, was to write a makefile to download and build the runtime/libs with clearly specified versions of libraries and utilities. This predates the MacPorts/fink/apt approach, but you have much more control on it, although you have to do everything by hand. Of course, this can become a nightmare on its own if the runtime grows, but if you find a problem, you can use patch and fix the issue on the downloaded package, then build it.
I have multiple questions:
What is your technique to prepare a well-defined runtime/library collection for your development?
Does MacPorts/fink/whatever allows me the same flexibility of rehacking if something goes wrong ?
Considering my makefile solution, when my software is finally out for download, what are your suggestions about solving the potential troubles between my development environment and the actual platform on my user's machines ?
Edit: What I don't understand in particular is that other projects don't give me hints. For example, I just downloaded scipy, a complex library with lots of dependencies. Developers must have all the deps setup before working on it. Despite this, there's nothing in the svn that creates this environment.
Edit: Added a bounty to the question. I think this is an important issue and it deserves to get more answers. I will consider best those answers with real world examples with particular attention towards any arisen issues and their solution.
Additional questions to inspire for the Bounty:
Do you perform testing on your environment (to check proper installation, e.g. on an integration machine) ?
How do you include your environment at shipping time ? If it's C, do you statically link it, or ship the dynamic library, tinkering the LD_LIBRARY_PATH before running the executable? What about the same issue for python, perl, and other ?
Do you stick to the runtime, or update it as time passes? Do you download "trunk" packages of your dependency libraries or a fixed version?
How do you deal with situations like: library foo needs python 2.5, but you need to develop in python 2.4 because library bar does not work with python 2.5 ?
We use a CMake script that generates Makefiles that download (mainly through SVN)/configure/build all our dependencies. Why CMake? Multiplatform. This works quite well, and we support invocation of scons/autopain/cmake. As we build on several platforms (Windows, MacOSX, a bunch of Linux variants) we also support different compile flags etc based on the operating system. Typically a library has a default configuration, and if we encounter a system that needs special configuration the configuration is replaced with a specialized configuration. This works quite well. We did not really find any ready solution that would fit our purpose.
That being said, it is a PITA to get it up and running - there's a lot of knobs to turn when you need to support several operating systems. I don't think it will become a maintainance-nightmare as the dependencies are quite fixed (libraries are upgraded regularly, but we rarely introduce new one).
virtualenv is good, but it can't do magic - e.g. if you want use a library that just MUST have Python 2.4 and another one that absolutely NEEDS 2.5 instead, you're out of luck. Nor can virtualenv (or any other tool) help when there's a brand new release of an OS and half the tools &c just don't support it yet, as you mentioned for Snow Leopard: some problems are just impossible to solve (two libraries with absolutely conflicting needs within the same build), others just require patience (until all tools you need are ported to the new OS's release, you just need to stick with the previous OS release).

What configuration of JBoss should we used - web, standard, default?

We develop web application and we are going to deploy it on JBoss.
Now we use JSF, Facelets, Webflow, JMX, Spring.
We are going to use JMS(ActiveMQ).
Maybe in the future we will use EJB3. But for near future we will not use it.
What configuration of JBoss would be better to use - web, standard, default?
And why?
Go for the smallest config that does what you need. The "web" configuration seems to have everything you need, including ejb3 support.
Remember, the configurations in the distribution are just examples. It's perfectly acceptable to create custom server configs by copying the deployers and libs around to produce a config that does exactly what you need.
I've never found the need to use anything other than default, sometimes removing some of the config. And that's included JMS, EJB, Spring, Webflow, etc.
I you are using JBoss AS 5.1.X, I recommend this book: http://www.amazon.com/JBoss-AS-Development-Marchioni-Francesco/dp/1847196829
On page 31 there is a detailed explanation about the five provided configurations.