Wednesday, March 25, 2009

Famous Art Deco Product



Continuous Integration with Hudson: great. I find really nice .... operate To Hudson, there are a lot of different installation and configuration options: Stand Alone, in a web server (Tomcat, JBoss, Glassfish), with a front "dazzled" Apache, etc.
This is a small explanation on how I Hudson set have. I

the current development snapshot on the same VM operators like Hudson, I opted for the standalone version


of Hudson. I hope this way side effects between the development server (in this case JBoss) to reduce and Hudson. In the joint operation on JBoss PermGen example, I received error messages / OutOfMemory exceptions which I could then assign it not clean (too resource-intensive activities or a Hudson memory leaks in the application?).

   requirements 




OS debian etch
JAVA is installed and create the PATH

 own user   



i041: ~ # mkdir / data
i041: ~ # mkdir / data / hudson
i041: ~ # addgroup Hudson
Adding group `Hudson '(GID

1002) ...

 Done.  i041: ~ # useradd g- 1002 
-d / data / hudson-s / bin / bash hudson
i041: ~ # chown Hudson: hudson / data / hudson /



When the user system (useradd) must be taken be taken that the GID (option-g) corresponds to the GID of the group system.
if necessary. now some settings from the Favourites copy to get the job then "beautiful" is done.



i041: ~ # cp / data / jboss / .bashrc / data / hudson /.
i041: ~ # chown-R Hudson: hudson / data / hudson

The following activities should be undertaken as Hudson User

hudson @ i041: ~ $



Hudson directory and startup scripts



hudson @ i041 setup: ~ $ mkdir bin

hudson @ i041: ~ $ mkdir lib

hudson @ i041: ~ $ mkdir log hudson @ i041: ~ $ cp / tmp / hudson.war lib /
script run.sh systems



hudson @ i041: ~ / bin $ run.sh nano


##################### # # # #
CURRENT_USER=`whoami`
if [ $CURRENT_USER != "hudson" ]; then

echo "Run only valid as hudson user!... (not as $CURRENT_USER)"

exit -1; fi

export HUDSON_HOME=/data/Hudson
export PATH="/usr/share/apache-ant/latest/bin:$PATH" export FINDBUGS_HOME=$HUDSON_HOME/externals/findbugs-1.3.8
HTTP_PORT=8280
AJP13_PORT=8209 CONTROL_PORT=-1 LOGFILE=$HUDSON_HOME/log/hudson.log

nohup java -jar $HUDSON_HOME/lib/hudson.war \
--httpPort=$HTTP_PORT \

--ajp13Port=$AJP13_PORT \

--controlPort=$CONTROL_PORT \
> $LOGFILE 2>&1&

#########################



Skript shutdown.sh anlagen

hudson@i041:~/bin$ nano run.sh

#########################
#stop per kill. see
http://winstone.sourceforge.net/#security

CURRENT_USER=`whoami`

if [ $CURRENT_USER != "hudson" ]; then echo "Shutdown only valid as hudson user!... (not as $CURRENT_USER)" exit -1;
fi
pid=`ps x awk '{print $ 1}' `; kill $ pid





#########################


hudson @ i041: ~ / bin $ chmod u + x run.sh

hudson @ i041: ~ / bin $ chmod u + x shutdown.sh

The Hudson server can now

run.sh start and shutdown with
.
be sh stopped. Thus, the Hudson does not come with the JBoss server on the same VM to preserve the Web ports are modified accordingly (see variable
HTTP_PORT
and
AJP13_PORT
). In the $
HUDSON_HOME / log is the log file mentioned. If the server does not boots (for example, is possibly the Web port already in use) this file should be checked at all costs!


[TODO: FindBugs integration]




Tuesday, March 24, 2009

Mario Salieri кино





to ask a sequence by JPA is known to be not so simple - JPA 1.0 only supports sequences in the oxygenation of IDs (@ id, @ GeneratedValue). One way to still get a unique value from a sequence is naturally by
JPA Native Query
(see, for example
http://stackoverflow.com/questions/277630/hibernate-jpa-sequence-non-id
)

After a short googling here gets lots of hits such as the following look (for an Oracle sequence):


Query query = em.createNativeQuery ("select seq.nextval from dual"); long next number =
new Long (((Number)

getSingleResult

query (). .) longValue ());



Unfortunately, this does not work (at least for me ...
L
)


It often relies on what the error message: ORA
-00 287: sequence number not allowed here

The reason for this is because Hibernate (JPA on JBoss), from which
getSingleResult
builds the following statement:



select * from (select profilenumber.nextval from dual) where rownum \u0026lt;= 1

And unfortunately this is not a valid SQL statement, since a sequence in the WHERE clause occurs ...
With the following Java code gives the desired result:

Query query = em.createNativeQuery ("select seq.nextval from dual"); (query.getResultList () get (0)

toString ()..);
Here is the unnecessary Select clip to the actual sequence query in SQL omitted.


  

Wednesday, March 18, 2009

Paint Thinner Recycler



Often you work with technical problems or situation that should not be in the program flow, with runtime exceptions (unchecked exceptions). Some general information around the topic are presented in the following article nicely: http://www.roseindia.net/java/exceptions/exception.shtml .
Unchecked Exceptions must therefore can not be intercepted in the Struts Action. The Struts Framework processes in this case, the exception.

Struts in order to catch exceptions may generally be in the struts.xml set a global exception mapping. It can then be set as a global result:

\u0026lt;global-results> \u0026lt;result name="
error

"> / WEB-INF/web/jsp/error.jsp \u0026lt;/ result>

\u0026lt;/ global-results> \u0026lt; global-exception-mappings >
\u0026lt;exception-mapping exception="
java.lang.Exception
"result="error"/>

\u0026lt; ; /

global-exception-mappings

>   

The error.jsp can then print an error message, for example, as follows:


...

 \u0026lt;h1> ERROR \u0026lt;/ h1>  \u0026lt;s:actionerror/> 
\u0026lt;p> \u0026lt;s:property value="%{ exception.message} "/> \u0026lt;/ p> ;
\u0026lt;hr/>
\u0026lt;h3> Technical Details \u0026lt;/ h3>
\u0026lt;p>

\u0026lt;font style="font-size: 9px; color:gray">

\u0026lt;s: property value = "% {
exception stack}

"/>

\u0026lt;/ font is>
\u0026lt;/ p>

...

The exception then represented only in the client (browser). But it is important of course, the error message in document log files to operate then a root cause analysis.
make this centrally To be able to offer the global

error.jsp

. With the following commands Strack trace using log4j is logged.


.. .

 \u0026lt;% @ page import = "org.apache.log4j.Logger"%>  s \u0026lt;: set name = "StackTrace  
"value = '% {} exception stack " scope = "page" />
\u0026lt;%
String StackTrace = (String) pageContext.getAttribute (
StackTrace "); Logger.getLogger (
this . getClass ()) error (stack trace). %>
...
exception stack in variable on the value stack, the Struts Framework purely written the stack trace already The rest of the code should be substantially self-explanatory
..


Sunday, March 8, 2009

Justin Timberlake Suit Gq

swan song a lateral thinker

Now I have not written anything for some time already in my blog. There was just nothing to stop that would have moved me enough to pick it here. The winter time is flat but the rest of us pigeon fanciers. But in the "pigeon" 9.10 am today but then I stumbled on something that has me excited enough to have to get rid of it here.



I must start by saying that I have since I started again with pigeon breeding, have read many articles, books and reports blow to our hobby. Lot of it was of moderate to poor quality or low made me doubt whether the statements that were made there. But there was / is also very good, that's worth to be read. And some of what I count this comes from ad Schaerlaeckens.

I liked the pragmatism and the logical consistency with which he treats the content of his texts. Also expressed his words, a very experienced and is extremely successful pigeon breeder, which I have always accepted that he was self-critical enough to face himself and his observations in question to the truths behind it to get a little more on the ropes. I like that is no breeder statements solely on the construct of "I am successful with pigeons, so I'm right about everything, what I say about pigeons" are based. had


Sure, Ad Schaerlaeckens seems always had a strong will and a good self-consciousness to have, but he would not have such topics as "Dim" and "exposure" Apply one of the first, if he were not constantly open to new ideas for change and for improvement. It is also clear in many of his texts that he observed other successful breeders very carefully at what and how they do it. Does so only someone who is open, something to take from these other breeders.

But in the Bt 9.10 on page 365 I find this section:

" to get the younger one is a little known but there is a generation of mostly thirties who increasingly takes power, strangely, is promoting this.. The decrease was mahr small minority, namely because, by urge their validity and their professional attitude, the gap between the tip and the rest have increased.
I personally do not believe that the decline can be stopped to ... Nevertheless, one can experience much joy in pigeon racing, but then they must thirties remain in the track "


He will not read certain, but I want him to say the following:

My dear ad are, now you obviously old become. You will forget, because you forget that you ever had a "professional attitude" to the sport, and it would surprise me if you would have understood at the time an older breeders would have accused you of just that, and even worse, which derives from the fact that you are hurting the sport of pigeon racing with it. The will to win but have also had one, or do I see this wrong?
And Earn money with pigeons but it has also always existed. Together had not bought Huyskens-Van Riel, with some financial burden their original dust? Someone has, after all this money? And how was that for Karel Schellens? A seller just made the price to pay a buyer ready. Today, the buyers come from all over the world. Some of these might throw more money on the table as before. But how exactly this should make the sport down?

course knows I do not know what has led you in detail on this finding, but also the 10th Top auction with hundreds of thousands of euros in sales in one year, I think, has nothing to do with the "future" to do the pigeon sport. Each one can, no must participate in something. Eg I prefer to not participate. Your argument seems like a rather primitive looking for culprits that you might not to shame. It may even envy at your successes are not.

But many more displays your resignation about the fact that there are no options left would be the decline of the pigeon sport reside, and your last sentence, how old you have become apparent:
"Nevertheless, one can experience even more joy on the pigeon racing, But then the thirties in the track remain .
only change anything unless we take old yet. It is already over, and at least as long as we are still there, we would not have to adjust to new! So I interpreted this what are you give of yourself!

The world is constantly changing. And so did the pigeon sport. He has roughly 200 years, survived two world wars, changing national boundaries, a united Europe, and much more. But it is precisely at the modern times, with their wealth and their amount of leisure time, and despite the increasing need, to find back to nature is to go based on the pigeon racing?

That, my ad is incorrect. For this reason, sport is if at some stage he will not adapt to the changes over time. Necessary flexibility in the travel events that could make the sport of family-friendly find, for example, remains limited. Especially in Germany there is a lack of initiatives to reduce the cost of the sport and really do sound for the modern, urban environment: offer, for example the elimination of systematic advantages that large stocks of some major championships. And specific advertising and marketing efforts for our sport, there are not nearly as well. But in today's flood of supply activities must be carefully and actively to . Make

The trigger for this impasse is that people who hold such views resigned, like you, present here the majority of breeders (is it a question of the age pyramid?).

I can only hope that the "Generation of the Thirties" (say the forties or to otherwise it would be too few) are actually as soon as possible "the power" takes over, as you write. And that they left the old track, which could be siding soon. The sooner the better.


the picture: "Old man" by Rembrandt

Saturday, March 7, 2009

After Wisdom Teeth Removal Taste



The title is likely to put it rather unfortunate, which is why I again explain the initial situation a little more detail:

   

Ausganslage


The JBoss (version 4.2.3) is an EAR application (MyApp.ear). Included in her some Libs, an EJB jar file (MyAppEJB.jar) and a web application WAR (MyAppWeb.war) are. The web application knows the EJB jar (in the manifesto published) and communicates with the EJBs using local calls.


working order to keep the user can configure a method within a stateless session bean (SLSB) with a more "normal" configuration class, which is also in MyAppEJB.jar. The helper class called "Config" has a

static method with a configuration file is read. This happened with Using the Apache API Commons Configuration (Configuration configuration = new
PropertiesConfiguration (filePath)
). The configuration file is within MyAppEJB.jar in the directory META-INF (filePath = "META-INF/config.properties)

should (no files are loaded from the file system volume EJB spec or it will not use any classes from java.io be. The file could be in a clustered environment on different nodes look different. After this the file but still not fixed / changed in the EAR or EJB archive is, this is actually wrong. More on this later).

Where does here everything!


Now another web application exists outside of the EARs (The WebApp is a maintenance application that should also be deployed separately). The Maintenance WebApp but also communicate with EJBs in the application described above. Since both applications are on the same server communication takes place via the local interface (JNDI).


problem

   
If, after the server started the maintenance webapp first EJB calls method in turn calls the helper class called "Config" and thus initializes it comes to the following error message:
...
Caused by:
org.apache.commons.configuration.ConfigurationException
: Can not locate configuration source META-INF/config.properties ...


The order is relevant in this case, because the configuration is initialized only when you first access the class. Until one has located the "order problem," it looks stupid as look as if the whole thing goes sometimes, sometimes not ... stupid thing!

background PropertiesConfiguration tried if it will find nowhere else to read the file from the classpath. In this case, the MyAppEJB JAR archive at META-INF, which is so far correctly.


However, as are accessed on a file within a JAR file?


thread.

CurrentThread

(). GetContextClassLoader.getResource (filePath)

And so it makes Apache Common Configuration API .

After it is a local call, the whole call stack is logically the same thread and thus also the

WAR classloader
as

context class loader.


Local access through a Web application within the enterprise archive (EAR)
A call to on MyAppWeb, located within MyApp.ear, it works, the VM searches the classpath for

filePath (= META-INF/config.properties)

. This is always first in

Parent class loader

searched (this occurs recursively). In the following this process in more detail:
The request startup still in the web of MyAppWeb thread (the thread name is for example about: http-127.0.0.1-8080-5, while the WAR classloader is used Name = "WebappClassLoader"). The search is now only in the parent class loader searched recursively:
WAR classloader
à
EJB classloader

à

Application Server class loader
à

system class loader

à Extension Class Loader à
bootstrap class loader

The search therefore begins in the bootstrap class loader - but here is the file "META-INF/config.properties" not found . Play then so on to the EJB class loader. Here, the class loader Resource Search find and return the desired file as a URL.

The configuration can be loaded

!

Local access through an "independent" web application outside of the Enterprise Archives
Here is the same above, at a local call you are in the same thread. The class path is again searched recursively. This looks here like this:

WAR classloader à Application Server Class Loader
à

system class loader

à Extension Class Loader à bootstrap class loader

In any of the searched classloaders resources is the file "META-INF/config.properties" found. The file is indeed in MyAppEJB.jar that will be searched at all here. The configuration

can not be loaded!

Classes "Config" is supported by the AppServer or EJB initialized with its own class loader (

org.jboss.mx.loading.UnifiedClassLoader3 @ 1be513c ). However, the class loader from the current thread ( thread. CurrentThread (). GetContextClassLoader
) is still the WAR class loader (

WebappClassLoader

) is.
Troubleshooting
The problem can be circumvented in several ways:

The Apache Commons Configuration
also provides a way to configure the DB read (
database configuration

) , so that absolutely no configuration in the form of property files is no longer necessary.


The problem can of course also be circumvented, in which one makes sure that the configuration is initialized after the start of the server always

first application of the EAR is
(works, but according to Spec not really clean ...)


The Maintenance application accesses per remote access to the EJBs. This ensures that not the Maintenance thread / class loader tries to load the configuration file.
to initialize PropertiesConfiguration are not you the relative path (META-INF/config.properties) but the same URL within the EJB

Archives

( new PropertiesConfiguration (CONFIG class
. getResource ("/ META-INF/config.properties" ));

)

In this project, I chose the pragmatic approach and opted for the latter variant