<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-298317578972711181</id><updated>2011-07-31T02:41:00.135-07:00</updated><category term='ibatis'/><category term='xa'/><category term='hibernate'/><category term='idea'/><category term='reflection'/><category term='postgresql'/><category term='scala'/><category term='jdbc'/><category term='java'/><category term='workflow'/><category term='seam'/><category term='jbpm'/><category term='type inference'/><category term='intellij'/><category term='bijection'/><category term='jaas'/><category term='outjection'/><category term='oracle'/><category term='private'/><category term='itil'/><category term='testng'/><category term='easymock'/><category term='jpa'/><category term='dao'/><category term='jboss'/><category term='unit testing'/><category term='jta'/><category term='injection'/><category term='j2ee'/><category term='liftweb'/><title type='text'>Jo's ramblings</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-298317578972711181.post-1545637373695053316</id><published>2009-08-03T12:13:00.000-07:00</published><updated>2009-08-03T12:23:17.594-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='intellij'/><category scheme='http://www.blogger.com/atom/ns#' term='idea'/><category scheme='http://www.blogger.com/atom/ns#' term='liftweb'/><category scheme='http://www.blogger.com/atom/ns#' term='type inference'/><category scheme='http://www.blogger.com/atom/ns#' term='scala'/><title type='text'>scala imports and implicit conversions</title><content type='html'>Scala import statements can be tricky I noticed today&lt;br /&gt;&lt;br /&gt;Consider following line:&lt;br /&gt;&lt;pre&gt;val entries = Menu(Loc("Home", "/", "Home")) :: Nil;&lt;/pre&gt;&lt;br /&gt;looks fine, and Intellij agrees, but maven scala plugin complains:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[WARNING] D:\projects\maternal\src\main\scala\bootstrap\liftweb\Boot.scala:17: error: type mismatch;&lt;br /&gt;[WARNING]  found   : java.lang.String("/")&lt;br /&gt;[WARNING]  required: net.liftweb.sitemap.Loc.Link&lt;br /&gt;[WARNING]     val entries = Menu(Loc("Home", "/", "Home")) :: Nil;&lt;br /&gt;[WARNING]                                    ^&lt;br /&gt;[WARNING] one error found&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;as import entries i have&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import net.liftweb.http._&lt;br /&gt;import net.liftweb.sitemap._&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;which should be sufficient one would think. &lt;br /&gt;&lt;br /&gt;however, following statement is needed to import the implicit conversions from a string to a Loc.Link object.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import net.liftweb.sitemap.Loc._&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;IntelliJ marks this import as 'unused', so it was kind of confusing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/298317578972711181-1545637373695053316?l=jogeraerts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/1545637373695053316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=298317578972711181&amp;postID=1545637373695053316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/1545637373695053316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/1545637373695053316'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/2009/08/scala-imports-and-implicit-conversions.html' title='scala imports and implicit conversions'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-298317578972711181.post-3426973125935713214</id><published>2007-11-05T01:51:00.000-08:00</published><updated>2007-11-05T02:01:15.453-08:00</updated><title type='text'>jvm parameters while doing j2ee development</title><content type='html'>When doing j2ee development you redeploy a lot of war/ear archives. When using standard jvm settings this will result in OutOfMemory condtions and the famous PermGen space Exception.&lt;br /&gt;&lt;br /&gt;I use following parameters for my jvm:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled &lt;br /&gt;-XX:MaxPermSize=128m -Xms1024m -Xmx1024m -Dsun.rmi.dgc.client.gcInterval=3600000 &lt;br /&gt;-Dsun.rmi.dgc.server.gcInterval=3600000&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;See &lt;a href="http://my.opera.com/karmazilla/blog/2007/03/13/good-riddance-permgen-outofmemoryerror"&gt; here&lt;/a&gt; for more information for a detailed explanation about some of these parameters ( especially for the Concurrent Mark Sweep garbage collector an permgen space issues.&lt;br /&gt;&lt;br /&gt;You might want to set -Xms and -Xmx a little bit lower if you dont have that much ram available.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/298317578972711181-3426973125935713214?l=jogeraerts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/3426973125935713214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=298317578972711181&amp;postID=3426973125935713214' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/3426973125935713214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/3426973125935713214'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/2007/11/jvm-parameters-while-doing-j2ee.html' title='jvm parameters while doing j2ee development'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-298317578972711181.post-546083303663330954</id><published>2007-10-26T07:20:00.000-07:00</published><updated>2007-11-03T00:36:27.443-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jbpm'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='seam'/><category scheme='http://www.blogger.com/atom/ns#' term='workflow'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>jboss seam and jbpm async nodes</title><content type='html'>In a jboss seam project i wanted to use async nodes in a jbpm workflow. You can add "async=true" to any node in you jbpm process definition. This makes the workflow continue in the background so your user interface does not have to wait for the complete workflow to complete.&lt;br /&gt;&lt;br /&gt;I accomplished this by starting the JbpmThreadServlet by adding in the web.xml:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; &amp;lt;!-- Jpbpm Thread listener which will do async continuations &amp;amp; Timer --&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;servlet&amp;gt;&lt;br /&gt;     &amp;lt;servlet-name&amp;gt;JbpmThreadsServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;     &amp;lt;servlet-class&amp;gt;org.jbpm.web.JbpmThreadsServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;     &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt; &amp;lt;/servlet&amp;gt;&lt;br /&gt; &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;     &amp;lt;servlet-name&amp;gt;JbpmThreadsServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;     &amp;lt;url-pattern&amp;gt;/jbpmthreads&amp;lt;/url-pattern&amp;gt;&lt;br /&gt; &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;When your web application starts, jbpm will spawn off a thread that will continue your workflow. This thread is also being used for sending out email notifications of task nodes.&lt;br /&gt;&lt;br /&gt;A problem that rises here is that your action handlers don't have access to the seam contexts. To solve this problem I made a abstract action handler which will startup the seam lifecycle from a such an actionHandler if it does not exist. This code comes from the seam 2.0.0 framework which actually support this. I haven't tried it out still.&lt;br /&gt;&lt;br /&gt;The code for the actionHandler is:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;import org.jboss.seam.contexts.Contexts;&lt;br /&gt;import org.jboss.seam.contexts.Lifecycle;&lt;br /&gt;import org.jboss.seam.core.BusinessProcess;&lt;br /&gt;import org.jbpm.graph.def.ActionHandler;&lt;br /&gt;import org.jbpm.graph.exe.ExecutionContext;&lt;br /&gt;import org.jbpm.taskmgmt.exe.TaskInstance;&lt;br /&gt;&lt;br /&gt;public abstract class SeamContextualActionHandler implements ActionHandler {&lt;br /&gt;&lt;br /&gt;        abstract public void executeInSeam(ExecutionContext context)&lt;br /&gt;                        throws Exception;&lt;br /&gt;&lt;br /&gt;        public void execute(final ExecutionContext context) throws Exception {&lt;br /&gt;&lt;br /&gt;                try {&lt;br /&gt;                        if (Contexts.isEventContextActive()&lt;br /&gt;                                        || Contexts.isApplicationContextActive()) //not sure about the second bit (only needed at init time!)&lt;br /&gt;                        {&lt;br /&gt;&lt;br /&gt;                        } else {&lt;br /&gt;                                Lifecycle.beginCall();&lt;br /&gt;                                try {&lt;br /&gt;                                        initProcessAndTask(context);&lt;br /&gt;                                        executeInSeam(context);&lt;br /&gt;                                } finally {&lt;br /&gt;                                        Lifecycle.endCall();&lt;br /&gt;                                }&lt;br /&gt;                        }&lt;br /&gt;                } catch (RuntimeException re) {&lt;br /&gt;                        throw re;&lt;br /&gt;                } catch (Exception e) {&lt;br /&gt;                        throw new RuntimeException(e);&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private static void initProcessAndTask(ExecutionContext context) {&lt;br /&gt;                BusinessProcess businessProcess = BusinessProcess.instance();&lt;br /&gt;                businessProcess.setProcessId(context.getProcessInstance().getId());&lt;br /&gt;                TaskInstance taskInstance = context.getTaskInstance();&lt;br /&gt;                if (taskInstance != null) {&lt;br /&gt;                        businessProcess.setTaskId(taskInstance.getId());&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Your actionHandlers should extend this class and implement the executeInSeam() method instead of the execute method from the ActionHandler interface.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/298317578972711181-546083303663330954?l=jogeraerts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/546083303663330954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=298317578972711181&amp;postID=546083303663330954' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/546083303663330954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/546083303663330954'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/2007/10/jboss-seam-and-jbpm-async-nodes.html' title='jboss seam and jbpm async nodes'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-298317578972711181.post-6656670139935843865</id><published>2007-10-19T22:54:00.000-07:00</published><updated>2007-10-19T23:19:09.111-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='seam'/><category scheme='http://www.blogger.com/atom/ns#' term='jaas'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>Jboss Seam Jaas authentication and jbpm Actors</title><content type='html'>The Identity component in Seam is a pretty handy thing. You can authenticate users by providing your own Authentication method or you can use JAAS. At my company we prefer JAAS. However there is a catch. When you also use jbpm, you should be able to populate the Actor component. But because we use JAAS there is no direct way to execute some custom code.&lt;br /&gt;&lt;br /&gt;Fortunatly the seam developers provide a event model. Several components can emit events which our code can Listen on. It is very simple. You can simply add the @Observer annotation to a method with the correct event.&lt;br /&gt;&lt;br /&gt;Now for populating the Actor  component, we are going to write a Observer that listens to the "org.jboss.seam.postAuthenticate" event. You can read about these events in the &lt;a href="http://docs.jboss.com/seam/1.2.1.GA/reference/en/html/events.html#d0e3962"&gt;seam documentation&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The next problem is that the JAAS API completely sucks. It is easy to find out if the users is in a specific role, but finding all the roles a user has is not possible. Fortunatly i found &lt;a href="http://www.jboss.com/index.html?module=bb&amp;amp;op=viewtopic&amp;amp;t=114215&amp;amp;start=0"&gt;some code&lt;/a&gt; on the seam forums from a clever guy that allows me to do it. The drawback is that you make your code container specific. But for the moment being it serves me well.&lt;br /&gt;&lt;br /&gt;So my authentication handler looks like this now:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import java.util.Enumeration;&lt;br /&gt;import java.util.Iterator;&lt;br /&gt;&lt;br /&gt;import javax.security.auth.Subject;&lt;br /&gt;&lt;br /&gt;import org.jboss.seam.annotations.In;&lt;br /&gt;import org.jboss.seam.annotations.Logger;&lt;br /&gt;import org.jboss.seam.annotations.Name;&lt;br /&gt;import org.jboss.seam.annotations.Observer;&lt;br /&gt;import org.jboss.seam.core.Actor;&lt;br /&gt;import org.jboss.seam.log.Log;&lt;br /&gt;import org.jboss.seam.security.Identity;&lt;br /&gt;import org.jboss.security.SimpleGroup;&lt;br /&gt;import org.jboss.security.SimplePrincipal;&lt;br /&gt;&lt;br /&gt;@Name("postAuthenticationHandler")&lt;br /&gt;public class PostAuthenticationHandler {&lt;br /&gt;&lt;br /&gt;   @Logger&lt;br /&gt;   Log log;&lt;br /&gt;&lt;br /&gt;   @In&lt;br /&gt;   Identity identity;&lt;br /&gt;&lt;br /&gt;   @In&lt;br /&gt;   Actor actor;&lt;br /&gt;&lt;br /&gt;   @SuppressWarnings("unchecked")&lt;br /&gt;   @Observer("org.jboss.seam.postAuthenticate")&lt;br /&gt;   public void doPostAuthenticate() {&lt;br /&gt;       log.info("Entering doPostAuthenticate...");&lt;br /&gt;       actor.setId(identity.getUsername());&lt;br /&gt;       Subject subject = identity.getSubject();&lt;br /&gt;&lt;br /&gt;       Iterator principleItr = subject.getPrincipals().iterator();&lt;br /&gt;       while (principleItr.hasNext()) {&lt;br /&gt;           Object principle = principleItr.next();&lt;br /&gt;           if (principle instanceof SimpleGroup) {&lt;br /&gt;               SimpleGroup simpleGroup = (SimpleGroup) principle;&lt;br /&gt;               Enumeration simpleGroupMembers = simpleGroup.members();&lt;br /&gt;               while (simpleGroupMembers.hasMoreElements()) {&lt;br /&gt;                   Object o =  simpleGroupMembers.nextElement();&lt;br /&gt;                   SimplePrincipal aPrincipal = (SimplePrincipal) o;&lt;br /&gt;                   log.info ("User " + identity.getUsername() + " is a member of group " + aPrincipal.getName());&lt;br /&gt;                   actor.getGroupActorIds().add(aPrincipal.getName());&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So first we inject the Actor/Identity components.  Also notice the @Observer annotation which causes this method to be invoked when the postAuthenticate event is raised.&lt;br /&gt;&lt;br /&gt;In the method itself we will get the JAAS subject from the identity component. This Subject class is some kind of container which contains all authentication specific attributes for this users called Principals. Now we can iterate over these Principals and extract the roles from it and insert them into the Actor component. As you see we cast the principle to a SimpleGroup which is a jboss specific implementation. So deploying this code on something other than jboss or even on another version of jboss than version 4.0.5.GA will break this code. But i found no other way to get to this information otherwise.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/298317578972711181-6656670139935843865?l=jogeraerts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/6656670139935843865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=298317578972711181&amp;postID=6656670139935843865' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/6656670139935843865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/6656670139935843865'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/2007/10/jboss-seam-jaas-authentication-and-jbpm.html' title='Jboss Seam Jaas authentication and jbpm Actors'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-298317578972711181.post-1026316338818355490</id><published>2007-10-15T00:30:00.000-07:00</published><updated>2007-10-15T00:39:21.724-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><category scheme='http://www.blogger.com/atom/ns#' term='jdbc'/><title type='text'>postgresql and jdbc/hibernate batch updates</title><content type='html'>A thing I always forget is to turn of batch updates when using postgresql db. Postgresql is a nice open source SQL database. It is less known then mysql but it offers true ACID semantics. Anyway, it is my favorite choice for RDBMS. But you need to turn off batch updates if you are using hibernate or JPA ( which is also implemented by hibernate ). So make sure you turn it off with the property&lt;br /&gt;&lt;br /&gt;hibernate.jdbc.batch_size and set the value to 0.&lt;br /&gt;&lt;br /&gt;Otherwise you get an exception sounding like:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;09:00:46,017 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session&lt;br /&gt;org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update&lt;br /&gt; at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)&lt;br /&gt; at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)&lt;br /&gt; at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)&lt;br /&gt; at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)&lt;br /&gt; at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)&lt;br /&gt; at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)&lt;br /&gt; at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)&lt;br /&gt; at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)&lt;br /&gt; at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)&lt;br /&gt; at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)&lt;br /&gt; at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)&lt;br /&gt; at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)&lt;br /&gt; at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)&lt;br /&gt; at org.jboss.tm.TxManager.commit(TxManager.java:240)&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/298317578972711181-1026316338818355490?l=jogeraerts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/1026316338818355490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=298317578972711181&amp;postID=1026316338818355490' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/1026316338818355490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/1026316338818355490'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/2007/10/postgresql-and-jdbchibernate-batch.html' title='postgresql and jdbc/hibernate batch updates'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-298317578972711181.post-5399302502403053434</id><published>2007-10-12T12:18:00.000-07:00</published><updated>2007-10-12T12:35:58.093-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reflection'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='unit testing'/><category scheme='http://www.blogger.com/atom/ns#' term='testng'/><category scheme='http://www.blogger.com/atom/ns#' term='easymock'/><category scheme='http://www.blogger.com/atom/ns#' term='private'/><title type='text'>accessing private fields</title><content type='html'>Today I learned again something new from the java reflection API. You can set private fields in a class. This comes in handy when you want to write a Unit test for a class that depends om some external services or classes;&lt;br /&gt;&lt;br /&gt;Lets say we have:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class ClassUnderTest  {&lt;br /&gt;&lt;br /&gt;   private OtherClass otherClass;&lt;br /&gt;&lt;br /&gt;   public doSomethingWithOtherClass() {&lt;br /&gt;&lt;br /&gt;           otherClass.someFunction()&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;When we want to test this class we might want to Mock the OtherClass because we are not interested in the functionality of the otherClass. Our testcase has no direct access to the otherClass field so we need to use some magic to do so.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class MyTestCase {&lt;br /&gt;   @Test&lt;br /&gt;   public void testDoSomethingWithOtherClass {&lt;br /&gt;       Field otherClassField = ClassUnderTest.class.getDeclaredField("otherClass"); (1)&lt;br /&gt;       otherClassField.setAccessible(true); (2)&lt;br /&gt;&lt;br /&gt;      ClassUnderTest classUnderTest = new ClassUnderTest();&lt;br /&gt;       OtherClass otherClass = createMock(OtherClass.class);&lt;br /&gt;       otherClass.someFunction();&lt;br /&gt;       otherClassField.set(classUnderTest,otherClass); (3)&lt;br /&gt;       replay(otherClass)&lt;br /&gt;       classUnderTest.doSomethingWithOtherClass();&lt;br /&gt;       verify(otherClass);&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;(1) We use the reflection api to fetch the private Field of the ClassUnderTest&lt;br /&gt;(2) We make it accessible&lt;br /&gt;(3) We set the value on a instance of ClassUnderTest&lt;br /&gt;&lt;br /&gt;And we're set.&lt;br /&gt;&lt;br /&gt;createMock() replay() and verify() are functions from EasyMock which is a verify nice framework for creating Mock objects. You should certainly take a look at it if you don't know it yet. @Test is a annotation from testng unit test framework.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/298317578972711181-5399302502403053434?l=jogeraerts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/5399302502403053434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=298317578972711181&amp;postID=5399302502403053434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/5399302502403053434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/5399302502403053434'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/2007/10/accessing-private-fields.html' title='accessing private fields'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-298317578972711181.post-2158726819647388590</id><published>2007-10-03T12:49:00.000-07:00</published><updated>2007-10-03T12:58:21.106-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='itil'/><title type='text'>Itil open books</title><content type='html'>I stumbled this evening on a interesting site: &lt;a href="http://www.itlibrary.org/"&gt;http://www.itlibrary.org/&lt;/a&gt; For the real ITIL books you have to pay lots of money, but here you will find a free view on all itil processes. Another thing that catched my attention was the faq. I want to quote a little piece of this faq I find personally extremely important:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;div class="QWNormal"&gt;ITIL books emphasise that organisations that have succeeded in implementing ITIL have one important thing in common - a strong 'Executive Sponsor'. This means a senior manager - ideally on the Board of Directors, the Corporate Information Officer or some similarly important role - is passionate about ITIL being implemented. When conflicts arise (as they do), the Sponsor will champion the cause, making sure the ITIL project has the funding and the authority to succeed.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/blockquote&gt;This is the most important thing for a successfull implementation i think.&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/298317578972711181-2158726819647388590?l=jogeraerts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/2158726819647388590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=298317578972711181&amp;postID=2158726819647388590' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/2158726819647388590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/2158726819647388590'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/2007/10/itil-open-books.html' title='Itil open books'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-298317578972711181.post-6563790690091845602</id><published>2007-10-02T01:15:00.000-07:00</published><updated>2007-10-02T05:54:59.006-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='injection'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='bijection'/><category scheme='http://www.blogger.com/atom/ns#' term='seam'/><category scheme='http://www.blogger.com/atom/ns#' term='outjection'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><title type='text'>jboss seam and jbpm in a message driven bean hell</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Last friday i was struggling with the bijection stuff of jboss seam. Bijection allows you to inject and outject variables to the several contexts jboss seam offers.&lt;br /&gt;&lt;br /&gt;What i am trying to do is to create a jbpm process from a message driven bean and 'outject' some variables to the business context. I want to inject these same variables in a action handler when the business process enters a node. But things go wrong here. Actually things go already wrong when creating the jbpm process.  I found a bugreport on the jboss bug tracking system that creating a jbpm process within a message driven bean does not work, so i suspect saving these variables to it has also something to do with it.&lt;br /&gt;&lt;br /&gt;My code is very simple:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;@CreateProcess(definition="inkless")&lt;br /&gt;public void onMessage(Message m){&lt;br /&gt;  //some Message Parsing goes here&lt;br /&gt;}&lt;/blockquote&gt;But i get lots of transaction related exeptions here. I found the following jira issue:&lt;br /&gt;&lt;a href="http://jira.jboss.org/jira/browse/JBSEAM-798"&gt;http://jira.jboss.org/jira/browse/JBSEAM-798&lt;/a&gt; and related forum thread at &lt;a href="http://www.jboss.com/index.html?module=bb&amp;amp;op=viewtopic&amp;amp;t=101047"&gt;http://www.jboss.com/index.html?module=bb&amp;amp;op=viewtopic&amp;amp;t=101047&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I think my next step will be to check out jboss seam 2.0.0 CR1.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/298317578972711181-6563790690091845602?l=jogeraerts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/6563790690091845602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=298317578972711181&amp;postID=6563790690091845602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/6563790690091845602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/6563790690091845602'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/2007/10/jboss-seam-business-context-variables.html' title='jboss seam and jbpm in a message driven bean hell'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-298317578972711181.post-6507749195531269980</id><published>2007-09-12T00:59:00.000-07:00</published><updated>2007-09-12T01:42:39.624-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jpa'/><category scheme='http://www.blogger.com/atom/ns#' term='ibatis'/><category scheme='http://www.blogger.com/atom/ns#' term='jta'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='xa'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><category scheme='http://www.blogger.com/atom/ns#' term='jboss'/><category scheme='http://www.blogger.com/atom/ns#' term='dao'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Could not enlist in transaction on entering meta-aware object!</title><content type='html'>This errormessage provided by the Jboss j2ee server gave me a major headance. In a project we are using 2 datasources:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;an oracle datasource being used by iBatis DAO layer&lt;/li&gt;&lt;li&gt;a postgresql datasource being used by JPA DAO layer&lt;/li&gt;&lt;/ul&gt;After invoking both DAO layers I got this nice SystemException by the JTA transactionmanager.&lt;br /&gt;&lt;br /&gt;Investigation showed me ( a few hours later ) that the oracle datasource is not XA by default. You have to configure it to use the XADataSource. You can find a example in the jboss distribution in docs/examples/jca/oracle-xa-ds.xml&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/298317578972711181-6507749195531269980?l=jogeraerts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jogeraerts.blogspot.com/feeds/6507749195531269980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=298317578972711181&amp;postID=6507749195531269980' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/6507749195531269980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/298317578972711181/posts/default/6507749195531269980'/><link rel='alternate' type='text/html' href='http://jogeraerts.blogspot.com/2007/09/could-not-enlist-in-transaction-on.html' title='Could not enlist in transaction on entering meta-aware object!'/><author><name>Jo</name><uri>http://www.blogger.com/profile/04644443657634141603</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
