<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Developers, Developers, Developers! &#187; Java EE 6</title>
	<atom:link href="http://maksim.sorokin.dk/it/tag/java-ee-6/feed/" rel="self" type="application/rss+xml" />
	<link>http://maksim.sorokin.dk/it</link>
	<description>Maksim Sorokin IT Blog</description>
	<lastBuildDate>Sun, 05 Feb 2012 19:37:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>[PACKT] Java EE 6 with GlassFish 3 Application Server</title>
		<link>http://maksim.sorokin.dk/it/2010/08/28/packt-java-ee-6-with-glassfish-3-application-server-2/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/28/packt-java-ee-6-with-glassfish-3-application-server-2/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 10:33:08 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[GlassFish]]></category>
		<category><![CDATA[Java EE 6]]></category>
		<category><![CDATA[PACKT]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=366</guid>
		<description><![CDATA[Java EE 6 with GlassFish 3 Application Server is another nice book from PACKT publishing. It covers GlassFish administration. Then it talks about Java web technologies -- servlets, JSP, JSP STL, JSF. Also discusses database connections, Java Messaging Service, security of applications (you can find more about it in GlassFish Security book). The books also [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://maksim.sorokin.dk/it/wp-content/uploads/2010/08/java-ee-6-with-glassfish-3-application-server.jpg" alt="" width="300" height="225" class="alignleft size-full wp-image-367" /><a href="http://www.packtpub.com/java-ee-6-applications-with-glassfish-3-application-server/book?utm_source=maksim.sorokin.dk&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_004037">Java EE 6 with GlassFish 3 Application Server</a> is another nice book from PACKT publishing.</p>
<p>It covers GlassFish administration. Then it talks about Java web technologies -- servlets, JSP, JSP STL, JSF. Also discusses database connections, Java Messaging Service, security of applications (you can find more about it in <a href="http://maksim.sorokin.dk/it/2010/07/25/glassfish-security-packt/">GlassFish Security</a> book). The books also talks about EJBs and new possibilities in Java EE 6 -- contexts and dependency injection. In the last part it discusses JAX-WS and JAX-RS web services. And everything is accompanied with information how to do that with GlassFish application server.</p>
<p>I would very much recommend it to novice Java EE developers or just to developers, who want to have a glance on Java EE web technologies, JMS, Java EE 6 dependency injection, web services and how all that is configured in GlassFish application server. I would say, it is a crash course into Java EE.</p>
<p>The book is not covering each section is deep detail. But gives a broad view on different Java EE possibilities.</p>
<p>The book is full of working examples! What I very much like about it, is that it not only talks about the latest Java EE 6 technologies. But also briefly covers how application can be configured in order to work with older standards.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/28/packt-java-ee-6-with-glassfish-3-application-server-2/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>[PACKT] Java EE 6 with GlassFish 3 Application Server</title>
		<link>http://maksim.sorokin.dk/it/2010/08/12/packt-java-ee-6-with-glassfish-3-application-server/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/12/packt-java-ee-6-with-glassfish-3-application-server/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 20:58:50 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[GlassFish]]></category>
		<category><![CDATA[Java EE 6]]></category>
		<category><![CDATA[PACKT]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=321</guid>
		<description><![CDATA[Just received my new PACKT book Java EE 6 with GlassFish 3 Application Server. From the table of contents I conclude that this book gives quite broad view on Java EE technologies and how to use them with GlassFish v3 application server. Although it is not covering some particular technology very detailed. First chapter is [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://maksim.sorokin.dk/it/wp-content/uploads/2010/08/Java_ee_with_GlassFish_v3.png" alt="" width="125" height="152" class="alignleft size-full wp-image-322" /> Just received my new PACKT book <a href="http://www.packtpub.com/java-ee-6-applications-with-glassfish-3-application-server/book?utm_source=maksim.sorokin.dk&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_004037">Java EE 6 with GlassFish 3 Application Server</a>.</p>
<p>From the table of contents I conclude that this book gives quite broad view on Java EE technologies and how to use them with GlassFish v3 application server. Although it is not covering some particular technology very detailed.</p>
<p>First chapter is about GlassFish -- how to setup it and configure. The following ones are about Java web technologies: servlets, JavaServer Pages, JSP Standard Tag Library, JavaServer Faces. Next, books talks about Java Messaging Service and security. Last chapter are the most interesting, in my opinion: Enterprise JavaBeans, Contexts and Dependency Injection and Web Services.</p>
<p>Anxious to read it!</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/12/packt-java-ee-6-with-glassfish-3-application-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GlassFish Security [PACKT]</title>
		<link>http://maksim.sorokin.dk/it/2010/07/25/glassfish-security-packt/</link>
		<comments>http://maksim.sorokin.dk/it/2010/07/25/glassfish-security-packt/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 17:39:37 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[GlassFish]]></category>
		<category><![CDATA[Java EE 6]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=299</guid>
		<description><![CDATA[GlassFish Security by PACKT is lying on my table. What I can say about it? Pretty nice book about security. I still wonder, why it has name "GlassFish" in the title. It covers a lot of interesting topics about Java EE security and talks about other software, which can help to secure Java applications, such [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-300" src="http://maksim.sorokin.dk/it/wp-content/uploads/2010/07/GlassFish_Security.jpg" alt="" width="300" height="225" /> <a href="https://www.packtpub.com/glassfish-security-with-java-ee/book">GlassFish Security by PACKT</a> is lying on my table. What I can say about it? Pretty nice book about security. I still wonder, why it has name "GlassFish" in the title. It covers a lot of interesting topics about Java EE security and talks about other software, which can help to secure Java applications, such as <a href="http://www.opends.org/">OpenDS</a> or <a href="https://opensso.dev.java.net/">OpenSSO</a>.</p>
<p>So if you are just about to design or develop complex Java EE application, I would recommend to take a look into this book to at least grasp the ideas about security management. Beside this, book also covers topics of easy security policies migration, which also may be somewhat interesting in our changing world.</p>
<p>And again, thanks PACKT for publishing yet another wonderful book!</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/07/25/glassfish-security-packt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A New Book About GlassFish Security</title>
		<link>http://maksim.sorokin.dk/it/2010/05/20/a-new-book-about-glassfish-security/</link>
		<comments>http://maksim.sorokin.dk/it/2010/05/20/a-new-book-about-glassfish-security/#comments</comments>
		<pubDate>Thu, 20 May 2010 11:05:21 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[GlassFish]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java EE 6]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=195</guid>
		<description><![CDATA[I was granted a book from Packt about GlassFish Security. And that is something we want to improve in our products! The book is about security in Java EE with EJB, Application Client modules and all the friends. Security in GlassFish is a central point of this book. And what is more, there are plenty [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://maksim.sorokin.dk/it/wp-content/uploads/2010/05/glassfish_security_cover.png"><img class="alignleft size-full wp-image-196" src="http://maksim.sorokin.dk/it/wp-content/uploads/2010/05/glassfish_security_cover.png" alt="GlassFish Security Cover" width="125" height="152" /></a></p>
<p>I was granted a <a href="http://www.packtpub.com/glassfish-security-with-java-ee/book?utm_source=maksim.sorokin.dk&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_003418">book</a> from <a href="http://www.packtpub.com/">Packt</a> about GlassFish Security. And that is something we want to improve in our products!</p>
<p>The book is about security in Java EE with EJB, Application Client modules and all the friends. Security in GlassFish is a central point of this book. And what is more, there are plenty of real world code and configuration samples. More information about the book can be found on <a href="http://www.packtpub.com/glassfish-security-with-java-ee/book?utm_source=maksim.sorokin.dk&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_003418">dedicated page on Packt website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/05/20/a-new-book-about-glassfish-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exception Launching Application in GlassFish v3</title>
		<link>http://maksim.sorokin.dk/it/2010/04/16/exception-launching-application-in-glassfish-v3/</link>
		<comments>http://maksim.sorokin.dk/it/2010/04/16/exception-launching-application-in-glassfish-v3/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 16:39:20 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[GlassFish]]></category>
		<category><![CDATA[Java EE 6]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=138</guid>
		<description><![CDATA[You have probably seen this nasty exception if you tried launching applications in GlassFish v3: java.lang.NullPointerException at org.glassfish.appclient.client.acc.ACCLogger$1.run(ACCLogger.java:149) at java.security.AccessController.doPrivileged(Native Method) at org.glassfish.appclient.client.acc.ACCLogger.reviseLogger(ACCLogger.java:146) at org.glassfish.appclient.client.acc.ACCLogger.init(ACCLogger.java:93) at org.glassfish.appclient.client.acc.ACCLogger.(ACCLogger.java:80) at org.glassfish.appclient.client.AppClientFacade.createBuilder(AppClientFacade.java:360) at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:247) at org.glassfish.appclient.client.JWSAppClientContainerMain.main(JWSAppClientContainerMain.java:83) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.doLaunchApp(Unknown Source) at [...]]]></description>
			<content:encoded><![CDATA[<p>You have probably seen this nasty exception if you tried launching applications in GlassFish v3:</p>
<pre class="brush: plain; title: ;">
java.lang.NullPointerException
	at org.glassfish.appclient.client.acc.ACCLogger$1.run(ACCLogger.java:149)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.glassfish.appclient.client.acc.ACCLogger.reviseLogger(ACCLogger.java:146)
	at org.glassfish.appclient.client.acc.ACCLogger.init(ACCLogger.java:93)
	at org.glassfish.appclient.client.acc.ACCLogger.(ACCLogger.java:80)
	at org.glassfish.appclient.client.AppClientFacade.createBuilder(AppClientFacade.java:360)
	at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:247)
	at org.glassfish.appclient.client.JWSAppClientContainerMain.main(JWSAppClientContainerMain.java:83)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.javaws.Launcher.executeApplication(Unknown Source)
	at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
	at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
	at com.sun.javaws.Launcher.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)</pre>
<p>You are not alone! <span id="more-138"></span>We have rewritten one of our products using Java EE 6 features. And since we had to use GlassFish v3 in order to run this application, we had to migrate other applications too. And then this nasty bug was discovered...</p>
<p>Bug on official GlassFish website:<br />
<a href="https://glassfish.java.net/issues/long_list.cgi?issuelist=11494">https://glassfish.java.net/issues/long_list.cgi?issuelist=11494</a></p>
<p>It is fixed in night builds. So currently we just sticked to a specific version of night build in order to have applications working. According to information on the internet (for example <a href="http://blog.eisele.net/2010/03/glassfish-product-roadmap-updates.html">http://blog.eisele.net/2010/03/glassfish-product-roadmap-updates.html</a>) release of GlassFish v3.0.1 will be only this summer.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/04/16/exception-launching-application-in-glassfish-v3/feed/</wfw:commentRss>
		<slash:comments>78</slash:comments>
		</item>
		<item>
		<title>Compound Key In JPA</title>
		<link>http://maksim.sorokin.dk/it/2010/03/26/compound-key-in-jpa/</link>
		<comments>http://maksim.sorokin.dk/it/2010/03/26/compound-key-in-jpa/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 17:08:05 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java EE 6]]></category>
		<category><![CDATA[JPA]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=120</guid>
		<description><![CDATA[Sometimes one needs a compound key for specifying @Entity. TopLink website says that one should provide multiple @Id and @IdClass for a composite primary key. But it actually works without specifing @IdClass too. For example if we have a Pencil with a composite key consisting of color and thickness: import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes one needs a compound key for specifying <a href="http://java.sun.com/javaee/6/docs/api/"><code>@Entity</code></a>. TopLink website <a href="http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Id">says</a> that one should provide multiple <code>@Id</code> and </code>@IdClass</code> for a composite primary key. But it actually works without specifing <code>@IdClass</code> too.<br />
<span id="more-120"></span></p>
<p>For example if we have a Pencil with a composite key consisting of <code>color</code> and <code>thickness</code>:</p>
<pre class="brush: java; title: ;">
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = &quot;pencils&quot;)
public class Pencil {

  @Id
  @Column(name = &quot;color&quot;)
  private String color;

  @Id
  @Column(name = &quot;thickness&quot;)
  private String thickness;

  ...
</pre>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/03/26/compound-key-in-jpa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why We Shouldn&#8217;t Abbreviate &#8220;Java EE 6&#8243;</title>
		<link>http://maksim.sorokin.dk/it/2010/03/05/why-we-shouldnt-abbreviate-java-ee-6/</link>
		<comments>http://maksim.sorokin.dk/it/2010/03/05/why-we-shouldnt-abbreviate-java-ee-6/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 21:54:12 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[convention]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java EE 6]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=86</guid>
		<description><![CDATA[Prior to today I used "JEE6" abbreviation to mean "Java EE 6". Now I have changed all "JEE6" occurrences to "Java EE 6". The reason is that I received an email from Bill Shannon -- Java EE specification lead, who kindly asked me to use "Java EE" instead of "JEE". He provided following sources for [...]]]></description>
			<content:encoded><![CDATA[<p>Prior to today I used "JEE6" abbreviation to mean "Java EE 6". Now I have changed all "JEE6" occurrences to "Java EE 6".</p>
<p>The reason is that I received an email from Bill Shannon -- Java EE specification lead, who kindly asked me to use "Java EE" instead of "JEE". He provided following sources for Java naming:</p>
<ul>
<li><a href="http://www.java.com/en/about/brand/naming.jsp">http://www.java.com/en/about/brand/naming.jsp</a></li>
<li><a href="http://www.theserverside.com/news/thread.tss?thread_id=35561">http://www.theserverside.com/news/thread.tss?thread_id=35561</a></li>
</ul>
<p>I really respect his opinion and appreciate his feedback. So from now on I will use "Java EE" to mean "Java EE".</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/03/05/why-we-shouldnt-abbreviate-java-ee-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java EE 6 Injection With Dynamic Parameter</title>
		<link>http://maksim.sorokin.dk/it/2010/02/19/java-ee-6-injection-with-dynamic-parameter/</link>
		<comments>http://maksim.sorokin.dk/it/2010/02/19/java-ee-6-injection-with-dynamic-parameter/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 18:08:40 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[injection]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java EE 6]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=66</guid>
		<description><![CDATA[Say, you want to inject an object using @javax.inject.Inject. And you would like to pass additional dynamic parameter upon initialization. You can do the following trick. For instance you want to inject and object which depends on some input. In current case let it be Pencil object, which needs to be initialized with color. public [...]]]></description>
			<content:encoded><![CDATA[<p>Say, you want to inject an object using <code>@javax.inject.Inject</code>. And you would like to pass additional dynamic parameter upon initialization. You can do the following trick. <span id="more-66"></span></p>
<p>For instance you want to inject and object which depends on some input. In current case let it be <code>Pencil</code> object, which needs to be initialized with color.</p>
<pre class="brush: java; title: ;">
public class Pencil {
  private Color color;

  void init(Color color) {
    this.color = color;
  }

  public void draw() {
    //
  }
}
</pre>
<p>In this case when you inject the Pencil, you have to call <code>init(Color)</code> explicitly, which is kind off error-prone. What you can do is create a <code>PencilProducer</code> which would create <code>Pencil</code> objects with desired color.</p>
<pre class="brush: java; title: ;">
public class PencilProducer {
  @Inject private Instance pencilInstance;

  public Pencil produce(Colour color) {
    Pencil pencil = pencilInstance.get();
    pencil.init(color);
    return pencil;
  }
}
</pre>
<p>In this case <code>PencilProducer</code> will create new <code>Pencil</code> object every time it is called. And in the application you simply inject <code>PencilProducer</code> and call <code>produce</code> method when needed.</p>
<p>This may seem to be too straight and dirty, but hey -- no <code>new</code> keyword!</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/02/19/java-ee-6-injection-with-dynamic-parameter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java EE 6 EJB Integration Testing</title>
		<link>http://maksim.sorokin.dk/it/2010/02/10/java-ee-6-ejb-integration-testing/</link>
		<comments>http://maksim.sorokin.dk/it/2010/02/10/java-ee-6-ejb-integration-testing/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 18:52:11 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[EJB]]></category>
		<category><![CDATA[Integration Testing]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java EE 6]]></category>
		<category><![CDATA[Singleton]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=56</guid>
		<description><![CDATA[Testing EJBs in a container! Say, you have a @Singleton package example; import java.util.Properties; import javax.annotation.PostConstruct; import javax.ejb.Singleton; @Singleton public class AppParamsLoader { private Properties props = null; @PostConstruct void init() { props = loadProperties(); } public String getParam(String paramKey) { return props.getProperty(paramKey); } void loadProperties() { // .. } } You can use EJBContainer [...]]]></description>
			<content:encoded><![CDATA[<p>Testing EJBs in a container!<br />
<span id="more-56"></span></p>
<p>Say, you have a @Singleton</p>
<pre class="brush: java; title: ;">
package example;

import java.util.Properties;

import javax.annotation.PostConstruct;
import javax.ejb.Singleton;

@Singleton
public class AppParamsLoader {

  private Properties props = null;

  @PostConstruct
  void init() {
    props = loadProperties();
  }

  public String getParam(String paramKey) {
    return props.getProperty(paramKey);
  }

  void loadProperties() {
    // ..
  }
}
</pre>
<p>You can use <code>EJBContainer</code> for your integration testing:</p>
<pre class="brush: java; title: ;">package example;

import javax.ejb.embeddable.EJBContainer;
import javax.naming.Context;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

public class AppParamsLoaderTest {

  private static EJBContainer container;
  private static Context namingContext;

  private static AppParamsLoader appParamsLoader;

  @BeforeClass
  public static void setUp() throws Exception {
    container = EJBContainer.createEJBContainer();
    namingContext = container.getContext();
    appParamsLoader = (AppParamsLoader) namingContext.lookup(&quot;java:global/classes/AppParamsLoader&quot;);
  }

  @AfterClass
  public static void tearDown() throws Exception {
    container.close();
  }

  @Test
  public void testAppParamsLoader() {
    // ..
  }
}
</pre>
<p>There is a way to initialize the container through maven:<br />
<a href="http://blogs.sun.com/alexismp/entry/glassfish_embedded_and_javadb_embedded">http://blogs.sun.com/alexismp/entry/glassfish_embedded_and_javadb_embedded</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/02/10/java-ee-6-ejb-integration-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

