Adam Bien's Weblog

REST TX, Clustering, Dead SOAP, Timers, Microservices vs. Monolith, Principal Propagation or Questions for the 12th Airhacks

Last chance to ask questions. We will discuss them at 2nd March, 6.PM. CET: http://www.ustream.tv/channel/adambien:

  1. HTTP Session Replication and Clustering discussion Piotrek
  2. I have a question for you :) You may even queue it up for an upcoming stream, but I’m really curious! You stated that SOAP (support?) could even be removed from the API.I just got into the SOAP world a few months ago, came from a REST background, and I am really confident that it still has it’s place. The type safety, and the tools that Java gives us are really great. Why do people hate it so much nowadays? Plus in the finance sector they are relying on it really heavily still, so it’s a good thing to be familiar with either way IMHO. noherczeg
  3. Can two ejb modules communicate with each other through local interfaces in the same app server or JVM? (…) Viktor Citaku
  4. What’s the most effective/elegant way of implementing single-table multi-tenancy (with discriminator column) in JPA2/2.1 without using provider specific (like that of EclipseLink 2.5) [Mátyás B.]
  5. Example scenario: a J2EE app utilizing single-table multi-tenancy that would allow users to sign-in using either Facebook, Google, Paypal, etc. as well as using native accounts (username/pw in the application’s DB itself) while using the HTML UI of the App. Its REST Resources would need a ‘token’ to authenticate. App server: GF 4.1
  6. Do we need to propagate the security context (Subject/Principals) to EJBs if using a form-based authentication? Isn’t it better (and almost easier) to use custom annotations and interceptors to implement a “permission” based security (as opposed to the container’s role based security)? Octopus (https://bitbucket.org/contribute-bitbucket/javaeesecurityfirst) comes to my mind.
  7. Would a JASPIC ServerAuthenticationModule (SAM) fit this scenario? How to tell SAM which authentication method to start based on the user’s choice? Similarly, how to tell JASPIC that the REST resources need a completely different ‘SAM’? ratcashdev
  8. Single timer event of a EJB timers in a distributed application [Tibor D.]
  9. What do you think about gradle? What about use gradle instead of maven? Can you talk a little bit about this subject? @Brunos_Santos
  10. With Java 8 and streams I do not really get how the exception handling should work when composing several functions? (Michael G.)
  11. “I’ve added beans.xml, but I read somewhere we don’t need it in JavaEE 7? The error is gone even if the file is empty!!” PoslovniAdresar
  12. “Can we set scheduler time from some property file so that we don’t need to
    recompile for changing time? Also, while executing scheduler, can I set next execution time at runtime?” Valsaraj
  13. Can we get @scheduler configurations details from properties file? like sec,min… Ravi
  14. (...) In one of your past presentations, I believe I remember you saying that being monolithic is your friend, vs nowadays there’s a lot of discussion around microservices. Can the ideas of “monolithic is your friend” and microservices still peacefully co-exist in your mind? John Hogan
  15. REST is stateless:

    Some are claiming, that you should not even keep any client state on the server (no session, nothing).

    Does this not imply, that Java EE server sessions should not be generated for requests at all?

    How would you do that with stateful session beans then? I guess, they are completely out of scope for REST?

    Does this mean, that each request should contain a reference or concrete information about eg. user credentials or client state if the server needs that information? Is that not producing a huge communication overhead in some scenarios?
  16. How would you implement a user authentication with a UI based on a pure RESTful API? With tokens? How to pass and maintain tokens and invalidate “sessions” without keeping client state on the server? Would that not also be a potential performance problem, as the token (and thus, every single API request needing authorization) would normally always have to be sent over HTTPS to avoid being intercepted and risk identity theft?
  17. How would you maintain transactions over several REST API calls? Is that at all possible with REST? Or would it simply be maintained completely on client side until final submission? (I have read eg. this resource https://jcalcote.wordpress.com/2009/08/06/restful-transactions/, but I am not fully convinced by the solution, or maybe miss some points) [heppa](https://gist.github.com/heppa
  18. @Entity

    @PrimaryKey(validation=IdValidation.NONE, columns={@column(name=“a”), @column(name=“b”, @column(name=“c”)})

    public class MyView implements Serializable ……

    If I run the query (as JUnit test) then I will receive the following error message:

    Exception [EclipseLink–6044] (Eclipse Persistence Services - 2.5.1. …..

    org.eclipse.persistence.exceptions.QueryException Exception Description: The primary key read from the row [row omitted here] during the execution of the query was detected to be null. Primary keys must not contain null. jhoryna
  19. How would you structure your web application to keep one code base for several customers each with their own customizations? haisi

See also the airhacks archives airhacks.tv for past shows and subscribe to the airhacksnews.com.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


NEW Special Events: From HTML 5 over Java EE App Building and NoSQL / Distributed Computing to Microservices

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

Rulz: EntityManager Provider for Integration Tests

I used EntityManager initialization for an integration test as a possible use case for JUnit Rule during the recent Continuous Java EE 7 Testing, Deployment and Code Quality workshop:



import static com.airhacks.rulz.em.EntityManagerProvider.persistenceUnit;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import static org.junit.Assert.assertNotNull;
import org.junit.Rule;
import org.junit.Test;


public class WorkshopTest {

    @Rule
    public EntityManagerProvider emProvider = persistenceUnit("it");

    @Test
    public void crud() {
        EntityManager em = emProvider.em();
        assertNotNull(em);
        EntityTransaction tx = emProvider.tx();
        assertNotNull(tx);
        tx.begin();
        em.merge(new Workshop("Testing", "test what matters));
        tx.commit();
    }
}

I noticed, the code is reusable, so I extracted the rule and created the open source project: Rulz and pushed the library into maven central:


<dependency>
    <groupId>com.airhacks.rulz</groupId>
    <artifactId>em</artifactId>
	<version>[RECENT_VERSION]</version>
    <scope>test</scope>
</dependency>

A JUnit Rule is an alternative to inheritance, which I used so far: BCE Archetype.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


NEW Special Events: From HTML 5 over Java EE App Building and NoSQL / Distributed Computing to Microservices

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

A Java EE 7 Startup: TipiCamp

Interview with Christoph Gapp, an entrepreneur, passionate Java developer, airhacks alumni and the man behind tipi.camp

What is your background? Could you briefly introduce yourself?

I am a trained computer scientist and have been working for about 15 years as a freelance Java developer. I also belong to the core team of an established reservation system.

What is tipi.camp?

tipi.camp is an intuitive, efficient and affordable management and reservation system for campsites. The application is cloud based. We currently have clients in Germany, USA and Australia.

You attended the regular airhacks at Munich airport. Shortly after the workshops you started tipi.camp and hired me to answer some questions. Where you got the idea? How tipi.camp started?

I gained a lot of great input in the workshop and I was inspired to implement an application afterwards. Simple exercises were not enough for me. The idea for the camping project came during my last vacation and so that's why I thought that now is a great time to start.

Did you had the chance to chat with other attendees during the airhacks? If yes, what was the most interesting project / problem / situation in the workshops?

I found my colleague's project to be very interesting: Stock market software independently buys shares dependent on current weather data -- the sudden onset of winter temporarily puts a damper on Lufthansa's shares. The demand for road salt on the other hand helps K+S shares.

The main problem that my discussion partner experienced was because of exaggerated architecture in their own software.

How much code have you deleted after the airhacks workshop?

I take every opportunity to revise and delete. I'm not sure how much I deleted, but it was quite a bit of code -- at least 30%!?

Which technologies, servers, libraries are you using in tipi.camp?

Java 8, EE7 with Wildfly. Primefaces and some Jakarta Commons. The Wildfly runs with Docker and deployment is done using Jenkins.

How many developers are currently working on tipi.camp?

1

You are using the Entity Control Boundary pattern. What is the experience with that?

This keeps projects of any size very clear. Anyone can immediately navigate quickly in the source. I use always this pattern now.

You told me "Java EE's productivity is dangerous". What did you exactly meant by that?

The Java world has greatly changed in recent years and has become much easier and better. With the possibilities of Java EE 7 and some pragmatism you can focus entirely on business logic and put products faster on the market. Utilizing features from application servers is of course an incredible market advantage. Those capable of adapting fast will survive -- this is especially true for the software market.

What are the challenges you are currently facing?

Ongoing projects to migrate to EE 7. Exciting but should not be underestimated.

Are you providing support to your customers? How challenging is it?

The support effort is surprisingly low, although the software is heavily used ;) The user interface is intuitive and common use cases are covered with tutorial videos.

Monitoring is based on CDI observer / events, any meaningful potential problems can be identified before the customer writes an email.

What about the performance? Is Java EE fast enough?

The application is currently running on a low-cost standard server and is still very, very fast. The beans for JSF are all ViewScoped or RequestScoped, and the EJB's stateless -- this makes the memory requirements very manageable.

You migrated from GlassFish to Wildfly. Was the migration painful? How much time did you spend for the migration?

The migration from the sourcecode surprisingly easy -- I needed just 1 day for minimal modifications. The Wildfly is easy to manage, I needed 2 days for selftraining with free tutorials. That was all.

Do you have any secret ideas for new startups?

Yes

Will you choose Java EE for the realization of your ideas again?

Definitely yes. Java EE is a free to use startup-igniter.

Christoph thank you for the interview!

Also checkout: http://www.tipi.camp/site/index.xhtml#blog, twitter: @TipiDotCamp and demo.campground.website


NEW Special Events: From HTML 5 over Java EE App Building and NoSQL / Distributed Computing to Microservices

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

hellsockets: The Java EE 7 WebSocket Stress Generator

During the recent airhacks workshops an attendee asked me a question about websocket stress testing tools.

You could create an own generator with jmeter.apache.org, but the websocket protocol is not directly supported.

The first, experimental, version of hellsockets is available. It is based on the built-in Java EE 7 websocket client and porcupine.

Hellsocket is a 23kB WAR which can be installed as drop-in on a Java EE 7 server and was tested on GlassFish / Payara 4.1 and WildFly 8.2. Stress tests can be initiated and the statistics are available via: HTTP/REST.

Feedback is highly appreciated.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


NEW Special Events: From HTML 5 over Java EE App Building and NoSQL / Distributed Computing to Microservices

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

Headlands "Payara" Release Is Available

Headlands exposes JCache API via REST and uses hazelcast.org as default JCache implementation.

The Payara server also comes with JCache support and with built-in Hazelcast. The recent Headlands release is also available without hazelcast and jcache libraries. The WAR headlands.war is skinnier and comes with 56 kB.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


NEW Special Events: From HTML 5 over Java EE App Building and NoSQL / Distributed Computing to Microservices

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

"Can not execute..." sonar-maven-plugin error and solution

The error after execution of mvn sonar:sonar: "Can not execute SonarQube analysis: Please update sonar-maven-plugin to at least version 2.3" can be fixed by forcing maven to use the recent version in pom.xml


<build>
	<pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>sonar-maven-plugin</artifactId>
				<version>2.5</version>
			</plugin>
		</plugins>
	</pluginManagement>
</build>

The error happens after upgrade to: Sonar 5.0. The Sonar 5.0 requires a >2.3 recent version of the sonar-maven-plugin which does not come as default.


NEW Special Events: From HTML 5 over Java EE App Building and NoSQL / Distributed Computing to Microservices

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

Note On Polyglot Programming

Polyglot programming is the idea to use in a single project (application or script) multiple programming languages at the same time. "Use the right language for the job" is often referred as the main driver behind this movement. Productivity increase is the overarching goal, justified by disjoined qualities of special purpose programming languages.

In "best case" you would use one programming language for the data access, another one for data transformation and a completely different language for efficient message passing between the processes. On top of this mix you will have to use SQL, CQL, JPA-QL (...), CSS (Sass / Less), JavaScript / JSON, HTML and probably some native languages for the UI technology anyway.

Now lets assume the project survives the development, is successful and is going to be maintained for several years.

  1. How many developers are able to master several languages at the same time to maintain the system efficiently?
  2. How much time are you going to spend in meetings to discuss what the best language for the job actually is?
  3. How likely is it, that all the chosen languages remain popular and well maintained through the lifecycle of the application?
  4. How many IDEs are you going to need to maintain the whole system?
  5. How easy it is to create a Continuous Integration pipeline for all the languages, but one system at the same time
  6. Did the complexity really decreased and the maintainability increased?
  7. How interoperable are theses languages?
  8. What about debugging, profiling, bug fixing? Is a language mix in the same callstack easier to tackle?

What's funny: "Polyglot Programming" seems to be a nice topic for a conference session, at the same time most "real world" projects try to be the opposite. nodejs is often chosen by JavaScript frontend developers as backend framework, because it is JavaScript. Isomorphic is even hotter and completely contradicts the idea of "polyglot" programming.

GWT on the other hand, is still popular among Java backend developers, because they can build the frontend ...in Java.

Usually not the technology, rather than annoying client's requirements are the productivity break :-)

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


NEW Special Events: From HTML 5 over Java EE App Building and NoSQL / Distributed Computing to Microservices

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

Afterburner.fx 1.6.2 Is Available

Version v.1.6.2 of the "opinionated un-framework for Java FX Applications" afterburner.fx released.

This release incorporates improvements from the community (thanks to JanGerritsen, aliebelt, rajmahendra) and fixes a bug which ignored a custom injection context passed to a view via constructor (thanks to jeanvc).


NEW Special Events: From HTML 5 over Java EE App Building and NoSQL / Distributed Computing to Microservices

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

Oracle And IBM Are Moving In Opposite Directions

Oracle positioned OC4J, than WebLogic as the "strategic" application server. With the acquisition of Sun, Oracle also acquired GlassFish. GlassFish is well adopted, open source and came with commercial support. The open source and commercially supported GlassFish products were effectively identical. GlassFish was and is a reference implementation for Java EE. The combination of Reference Implementation (and so well documented cutting edge technology) and commercial support made GlassFish the "Killer Application Server".

GlassFish was popular among developers and was used in most Java EE 5 and Java EE 6 green field projects. Also many projects migrated from flagship application servers directly to GlassFish.

In fact many startups and projects used GlassFish as their main server. Surprisingly, GlassFish commercial support was not very well advertised (and pushed by the presales) and so unsurprisingly the commercial support was also not widely requested by the customers.

In 2013 year Oracle cancelled the commercial support for GlassFish, but GlassFish still remains at the same time reference implementation and is going to be actively developed.

IBM focussed on WebSphere as the strategic server and the lesser known Community Edition (effectively Geronimo) was meant as an entry level "developer" edition.

Interestingly IBM also withdraw recently the commercial support for WebSphere CE and Geronimo, but at the same time introduced commercially supported WLP.

WLP is a "lightweight" version of IBM WebSphere--the WebSphere Liberty Profile. WLP boots extremely fast, is easy and uncomplicated to install, and the deployments are quick. WLP compares to WebSphere, as GlassFish compared to WebLogic. WLP is neither opensource nor Reference Implementation for Java EE, however it is commercially supported by IBM. In fact you can either choose the fully loaded WebSphere, or WLP. WLP already partially supports Java EE 7.

Seems like Oracle and IBM swapped their strategies. Oracle focusses on WLS, and IBM offers both solutions at the same time, as Oracle did before.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


NEW Special Events: From HTML 5 over Java EE App Building and NoSQL / Distributed Computing to Microservices

Newsletter: airhacksnews.com

A book about rethinking Java EE Patterns

realworldpatterns.com
...the last 150 posts
...the last 10 comments
License