Recent Posts
Archives

Archive for the ‘en-US’ Category

PostHeaderIcon (long tweet) Virtual Box / PAE processor

Case

On booting ChromeOS Vanilla within Virtual Box, I got the following error:
[java]This kernel requires the following features not present on the CPU: pae
Unable to boot – please use a kernel appropriate for your CPU.[/java]

(Actually, the problem occured with ChromeOS but may have appened with another system)

Quick Fix

In Virtual Box, select the VM > Settings > Processor > check “Enable PAE/NX”.

PostHeaderIcon [DevoxxBE2012] 7 Things: How to Make Good Teams Great

Sven Peters, an Atlassian ambassador with over a decade in Java EE development and team leadership, shared strategies for elevating competent teams to exceptional levels. Sven, passionate about clean code and developer motivation, drew from Atlassian’s experiences to outline seven practices fostering innovation and productivity while sustaining focus on quality products.

He opened by challenging assumptions about agile methodologies, observing that some self-proclaimed agile teams underperform, while certain traditional ones excel. Sven emphasized that true greatness transcends labels, requiring deliberate actions to boost morale and efficiency.

Atlassian, known for tools like Jira and Confluence, exemplifies these principles through an open culture that values feedback and experimentation. Sven warned that while inspiring, these methods must adapt to individual contexts, with readiness to iterate based on outcomes.

Enhancing Focus and Flow

Sven advocated protecting developers’ concentration, introducing “do not disturb” periods where interruptions halt, allowing deep work. At Atlassian, engineers signal availability with signs, reducing context switches that hinder productivity.

He stressed feeding intellectual curiosity via learning opportunities, such as internal talks or external conferences. These sessions, often during lunch, cover diverse topics, sparking ideas and cross-team collaboration.

Appreciating efforts, even minor ones, builds positivity. Sven described Atlassian’s kudos system, where peers publicly recognize contributions, reinforcing a supportive environment.

Automating Insights and User Empathy

To streamline oversight, Sven recommended automated reports aggregating metrics like code commits and bug fixes. These dashboards provide quick overviews without manual effort, freeing time for creative tasks.

“Dogfooding”—using one’s own products internally—bridges gaps between creators and users. At Atlassian, this uncovers issues early, fostering empathy and better designs. Sven shared how it led to improvements in their tools.

Sparking Innovation Through Dedicated Time

Special days, like “ShipIt” events, tackle backlog items in focused bursts. Atlassian’s 24-hour hackathons encourage wild ideas, with voting and implementation for winners, injecting fun and progress.

Experimentation time, such as 20% personal projects, drives breakthroughs. Sven recounted how this birthed features like Jira’s rapid boards, enhancing products while empowering staff.

He rated these practices’ feasibility and impact, urging measured trials to gauge effectiveness.

Adapting and Measuring Success

Sven concluded by encouraging experimentation, acknowledging failures as learning opportunities. Atlassian’s disbanded innovation team taught that distributed creativity works better.

He advised time-boxing initiatives, tracking results, and customizing approaches. Being distinctive in practices attracts and retains talent in a competitive field.

Sven’s insights, rooted in real-world application, offer a blueprint for transforming solid teams into outstanding ones through intentional, adaptive strategies.

Links:

PostHeaderIcon [DevoxxFR2012] — Rev:2, Add twitter handle

ALTER TABLE speaker ADD COLUMN twitter varchar(255);


These scripts run automatically on startup, supporting continuous delivery.

## RESTful API Development
James Ward constructs JSON endpoints:

public class ApiController extends Controller {
public Result speakers() {
List speakers = Speaker.find.all();
return ok(Json.toJson(speakers));
}
}


Play’s `Json.toJson` uses Jackson for serialization, with configuration in `application.conf`:

play.modules.enabled += “play.modules.reactivemongo.ReactiveMongoModule”


## Form Handling and Validation
Nicolas demonstrates form binding:

public class FormsController extends Controller {
static Form speakerForm = Form.form(Speaker.class);

public Result create() {
    Form<Speaker> filled = speakerForm.bindFromRequest();
    if (filled.hasErrors()) {
        return badRequest(views.html.create.render(filled));
    } else {
        Speaker speaker = filled.get();
        speaker.save();
        return redirect(routes.Application.index());
    }
}

}


HTML forms use Play’s template engine:

@form(routes.FormsController.create()) {
@inputText(speakerForm(“name”), ‘_label -> “Name”)
@inputText(speakerForm(“twitter”), ‘_label -> “Twitter”)

}


## Frontend Development with HTML5 and JavaScript
Guillaume Bort integrates Twitter Bootstrap and jQuery for responsive design, demonstrating real-time features with WebSockets:

public class StreamController extends Controller {
public WebSocket updates() {
return WebSocket.whenReady((in, out) -> {
// Push updates
});
}
}


## Cloud Deployment to Heroku
James Ward executes deployment:

heroku create devoxx-play-demo
git push heroku master
heroku addons:create heroku-postgresql


Play’s `Procfile` declares the startup command:

web: target/universal/stage/bin/conference-app -Dhttp.port=${PORT}
“`

Implications for Modern Web Development

The presenters conclude that Play 2.0’s integrated toolchain and cloud-ready architecture dramatically accelerate development cycles while producing applications that scale effortlessly in elastic environments.

Links:

PostHeaderIcon [DevoxxFR2012] Java on Amazon Web Services: Building Scalable, Resilient Applications in the Cloud

Lecturer

Carlos Conde operates as a Solutions Architect within Amazon Web Services’ European team, where he partners with enterprises to design, migrate, and optimize Java applications on the AWS platform. His technical journey began over a decade ago when he founded IWorks, a company focused on Java web development atop legacy mainframe systems, followed by co-founding Newaxe, which delivered a Java-based ERP monitoring and management platform. After years as an independent consultant helping Fortune 500 companies modernize their stacks, Carlos joined AWS to bring cloud-native principles to the broader Java community. His expertise spans the full application lifecycle—from initial architecture through production operations—with a particular emphasis on cost optimization, high availability, and security.

Abstract

Carlos Conde provides an exhaustive guide to developing, deploying, and operating Java applications on Amazon Web Services, demonstrating how the platform’s breadth of services enables developers to build systems that are simultaneously scalable, resilient, and cost-effective. He introduces AWS Elastic Beanstalk as a fully managed Platform as a Service solution that abstracts infrastructure complexity, the AWS SDK for Java for programmatic service access, and the AWS Toolkit for Eclipse for seamless IDE integration. Through detailed live demonstrations and real-world case studies from companies like Viadeo and Netflix, Conde explores deployment strategies, database patterns, content delivery, monitoring, and disaster recovery. The presentation addresses hybrid cloud scenarios, data sovereignty requirements under European regulations, and advanced cost management techniques, concluding with a vision of serverless Java and containerized workloads that redefine operational excellence.

The AWS Java Ecosystem: Tools for Every Stage of Development

Carlos Conde opens by mapping the AWS service landscape to the Java developer’s workflow. At the foundation lies Amazon EC2, offering virtual servers with pre-built Java AMIs (Amazon Machine Images) that include OpenJDK, Tomcat, and Spring Boot. For developers seeking higher abstraction, AWS Elastic Beanstalk provides a PaaS experience where applications are deployed via simple commands:

eb init -p java-8 my-java-app
eb create production-env --instance_type t3.medium
eb deploy

Behind the scenes, Beanstalk provisions EC2 instances, Elastic Load Balancers, Auto Scaling groups, and CloudWatch alarms, while allowing full customization through .ebextensions configuration files. Conde demonstrates deploying a Spring Boot application that automatically scales from 2 to 10 instances based on CPU utilization, with zero-downtime blue/green deployments.

The AWS SDK for Java serves as the programmatic bridge to over 200 AWS services. Conde writes a service that stores user profiles in Amazon DynamoDB:

AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
    .withRegion(Regions.EU_WEST_3)
    .build();

Map<String, AttributeValue> item = new HashMap<>();
item.put("userId", AttributeValue.builder().s(userId).build());
item.put("email", AttributeValue.builder().s(email).build());
item.put("createdAt", AttributeValue.builder().n(Long.toString(timestamp)).build());

PutItemRequest request = PutItemRequest.builder()
    .tableName("Users")
    .item(item)
    .build();
client.putItem(request);

DynamoDB’s single-digit millisecond latency and automatic scaling make it ideal for high-throughput workloads. For relational data, Amazon RDS offers managed PostgreSQL, MySQL, or Oracle with automated backups, patching, and multi-AZ replication.

Content Delivery and Global Reach

For static assets, Conde integrates Amazon S3 with CloudFront:

AmazonS3 s3 = AmazonS3ClientBuilder.standard().build();
s3.putObject(PutObjectRequest.builder()
    .bucket("my-app-assets")
    .key("css/style.css")
    .acl(ObjectCannedACL.PublicRead)
    .build(), RequestBody.fromFile(Paths.get("style.css")));

CloudFront’s 200+ edge locations cache content close to users, reducing latency from 180ms to 30ms for European customers. He demonstrates invalidating cache after deployments using the AWS CLI.

Cost Optimization Strategies

Conde presents a multi-layered approach to cost control. Reserved Instances provide up to 75% savings for predictable workloads, while Savings Plans offer flexibility across EC2, Lambda, and Fargate. For batch processing, Spot Instances deliver 90% discounts:

RunInstancesRequest request = RunInstancesRequest.builder()
    .instanceMarketOptions(InstanceMarketOptionsRequest.builder()
        .marketType(MarketType.SPOT)
        .spotOptions(SpotInstanceRequest.builder()
            .spotPrice("0.10")
            .instanceInterruptionBehavior(InstanceInterruptionBehavior.TERMINATE)
            .build())
        .build())
    .build();

He uses AWS Cost Explorer to visualize spending and set budget alerts.

High Availability and Disaster Recovery

Conde designs a multi-AZ architecture with RDS read replicas, ElastiCache for Redis caching, and S3 cross-region replication. He demonstrates failover using Route 53 health checks that automatically reroute traffic if a region fails.

Security and Compliance

Security is baked into every layer. AWS Identity and Access Management (IAM) enforces least-privilege access, while AWS KMS manages encryption keys. Conde enables S3 server-side encryption and RDS TDE (Transparent Data Encryption) with a single click.

Hybrid and Sovereign Cloud Deployments

For European data residency, Conde deploys entirely within the Paris region (eu-west-3). For hybrid scenarios, AWS Direct Connect establishes dedicated network connections to on-premises data centers, and AWS Outposts brings AWS services into private facilities.

Monitoring, Logging, and Observability

Amazon CloudWatch collects metrics, logs, and events. Conde instruments a Spring Boot application with Micrometer:

@Timed(value = "order.processing.time", description = "Time taken to process order")
public Order processOrder(OrderRequest request) {
    // Business logic
}

AWS X-Ray traces requests across services, identifying latency bottlenecks.

Real-World Case Studies

Conde shares Viadeo’s migration of their social platform to AWS, achieving 99.99% availability and reducing infrastructure costs by 60%. Netflix’s global streaming architecture leverages AWS for transcoding, personalization, and content delivery at petabyte scale.

The Future of Java on AWS

Conde previews AWS Lambda for serverless Java, AWS Fargate for containerized workloads without server management, and AWS Graviton2 processors offering 40% better price-performance for Java applications.

Implications for Java Enterprises

Carlos Conde concludes that AWS transforms Java development from infrastructure-constrained to innovation-focused. By leveraging managed services, developers build faster, operate more reliably, and scale globally—all while maintaining strict control over costs and compliance.

Links:

PostHeaderIcon (long tweet) A story of return in try/catch/finally

A short reminder: in a try/catch/finally section, the block in the finally is always executed. “Always” means “even if a return statement is reached in the try or catch“.

A short piece of code shows more than a long speech. The following JUnit test ends with no error:
[java]package com.stepinfo.poc.cartography;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;

/**
* Created with IntelliJ IDEA 12 "Leda" CE
* User: Jonathan LALOU
* Date: 08/Apr/13
* Time: 22:41
*/
public class TestTryCatchFinally {

public static final String TRY = "try";
public static final String CATCH = "catch";
public static final String FINALLY = "finally";

private String tryVersusFinally() {
try {
return TRY;
} catch (Exception e) {
return CATCH;
} finally {
return FINALLY;
}
}

private String catchVersusFinally() {
try {
throw new RuntimeException();
} catch (Exception e) {
return CATCH;
} finally {
return FINALLY;
}
}

@Test
public void testTryFinally() {
assertNotSame(TRY, tryVersusFinally());
assertEquals(FINALLY, tryVersusFinally());
}

@Test
public void testCatchFinally() {
assertNotSame(CATCH, tryVersusFinally());
assertEquals(FINALLY, catchVersusFinally());
}
}
[/java]

PostHeaderIcon (long tweet) java.lang.SecurityException: Prohibited package name

Case

Here is a case of stupid error. I started up a new project in IntelliJ IDEA, laying on a Maven archetype. On launching the first unit test, I got the following error:
[java]Cannot instantiate test(s): java.lang.SecurityException: Prohibited package name: java.lalou.jonathan.multiposts[/java]

Quick fix

As you may have noticed, the package name was prefixed with java.… which is prohibited by the JDK. An immediate fix is to restore a package name not starting with java..

The code in the JDK is explicit: the exception with such a message is raised in a unique occasion:
[java] if ((name != null) && name.startsWith("java.")) {
throw new SecurityException
("Prohibited package name: " +
name.substring(0, name.lastIndexOf(‘.’)));
}
[/java]

PostHeaderIcon [DevoxxFR2012] Manipulation of Bytecode: Let’s Democratize the Black Magics!

Lecturer

Frédéric Le Mouël holds the position of associate professor at INSA Lyon within the Telecommunications Department and CITI Lab, while also serving as a member of the INRIA Amazones research team. His academic background includes a PhD from University of Rennes 1 focused on adaptive middleware for mobile computing environments. Frederic’s research spans component-oriented architectures, service-oriented computing, and dynamic adaptation mechanisms, with particular interest in bytecode manipulation as an enabling technology for runtime adaptation. The JooFlux project, which he presents, represents a culmination of these research threads.

Abstract

Frédéric Le Mouël challenges the perception of bytecode manipulation as an esoteric practice reserved for framework authors and programming language implementers, demonstrating its practical utility across the software development spectrum from application development to system instrumentation. The presentation systematically demystifies Java bytecode and the JVM’s execution model before examining multiple manipulation tools including ASM, AspectJ, Byteman, and the innovative JooFlux framework. Through live demonstrations and architectural analyses, Le Mouël illustrates how bytecode transformation enables aspect-oriented programming, runtime monitoring, adaptive systems, and performance optimization without source code modification. The session concludes with philosophical reflections on the power and responsibility accompanying low-level JVM access.

Java Bytecode Fundamentals

Java bytecode serves as the intermediate representation executed by the JVM, compiled from Java source through javac. Le Mouël examines the stack-based execution model:

// Source
public int add(int a, int b) {
    return a + b;
}

// Bytecode
0: iload_1
1: iload_2
2: iadd
3: ireturn

Each instruction operates on the operand stack, with local variables accessed through indexed loads and stores. The JVM’s verification process ensures type safety before execution.

ASM: The Foundation of Bytecode Manipulation

ASM provides a low-level API for generating and transforming class files. Le Mouël demonstrates method instrumentation:

public class AddTraceTransformer extends ClassVisitor {
    public MethodVisitor visitMethod(int access, String name, 
                                   String desc, String signature, String[] exceptions) {
        MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
        if ("process".equals(name)) {
            return new AddTraceAdapter(mv);
        }
        return mv;
    }
}

class AddTraceAdapter extends MethodVisitor {
    public void visitCode() {
        mv.visitCode();
        mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
        mv.visitLdcInsn("Entering method");
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V");
    }
}

This transformation inserts tracing without modifying source code.

AspectJ: High-Level AOP Through Weaving

AspectJ compiles aspects into bytecode transformations. Le Mouël shows transaction management:

@Aspect
public class TransactionAspect {
    @Around("execution(* com.bank.*.*(..))")
    public Object manageTransaction(ProceedingJoinPoint pjp) throws Throwable {
        beginTransaction();
        try {
            Object result = pjp.proceed();
            commitTransaction();
            return result;
        } catch (Throwable t) {
            rollbackTransaction();
            throw t;
        }
    }
}

The AspectJ weaver transforms target classes at compile-time or load-time.

Byteman: Runtime Rule Injection

Byteman enables dynamic rule injection into running JVMs:

RULE Trace method entry
CLASS com.example.Service
METHOD process
AT ENTRY
IF true
DO traceln("Entering process")
ENDRULE

Le Mouël demonstrates hot-patching production systems for debugging.

JooFlux: Research Framework for Dynamic Adaptation

JooFlux introduces a registry-based approach to bytecode manipulation:

JooFlux.register(new Interceptor() {
    public void intercept(Call call) {
        if (call.getMethodName().equals("process")) {
            System.out.println("Intercepted: " + call.getArguments());
            call.proceed();
        }
    }
});

The framework maintains original bytecode for potential restoration.

Links:

PostHeaderIcon [DevoxxBE2012] Putting Kotlin to the Test

During DevoxxBE2012, Hadi Hariri, a developer and technical evangelist at JetBrains, presented an in-depth evaluation of Kotlin, a then-emerging programming language designed by his company. Hadi, with his background in software architecture and web development, aimed to assess whether Kotlin could address common pitfalls in existing languages while serving as a versatile tool for various development needs. He began by providing context on Kotlin’s origins, noting its static typing, object-oriented nature, and targets for JVM bytecode and JavaScript compilation. Licensed under Apache 2.0, it was at milestone M3, with expectations for further releases leading to beta.

Hadi explained the motivation behind Kotlin: after years of building IDEs in Java, JetBrains sought a more efficient alternative without the complexities of languages like Scala. He highlighted Kotlin’s focus on practicality, aiming to reduce boilerplate and enhance productivity. Through live coding, Hadi demonstrated building a real-world application, showcasing how Kotlin simplifies syntax and integrates seamlessly with Java.

One key aspect was Kotlin’s concise class definitions, where properties and constructors merge into a single line, eliminating redundant getters and setters. Hadi illustrated this with examples, contrasting it with verbose Java equivalents. He also touched on null safety, where the language enforces checks to prevent null pointer exceptions, a frequent issue in other systems.

As the session progressed, Hadi explored functional programming elements, such as higher-order functions and lambdas, which allow for expressive code without excessive ceremony. He built components of an application, like data models and services, to test interoperability and performance.

Syntax Innovations and Productivity Gains

Hadi delved into Kotlin’s syntax, emphasizing features like extension functions that add methods to existing classes without inheritance. This promotes cleaner code and reusability. He showed how to extend standard library classes, making operations more intuitive.

Data classes were another highlight, automatically providing equals, hashCode, and toString methods, ideal for immutable objects. Hadi used these in his demo app to handle entities efficiently.

Pattern matching via ‘when’ expressions offered a more powerful alternative to switch statements, supporting complex conditions. Hadi integrated this into control flows, demonstrating reduced branching logic.

Smart casts automatically handle type checks, minimizing explicit casts. In his application, this streamlined interactions with mixed-type collections.

Interoperability and Platform Targets

A core strength, as Hadi pointed out, is Kotlin’s full compatibility with Java. Code can call Java libraries directly, and vice versa, facilitating gradual adoption. He compiled mixed projects, showing no performance overhead.

Targeting JavaScript, Kotlin compiles to efficient code for web fronts, sharing logic between server and client. Hadi previewed this, noting potential for unified development stacks.

He addressed modules and versioning, still in progress, but promising better organization than Java packages.

Functional and Advanced Constructs

Hadi introduced traits, similar to interfaces but with implementations, enabling mixin-like behavior. He used them to compose behaviors in his app.

Delegated properties handled lazy initialization and observables, useful for UI bindings or caching.

Coroutines, though nascent, hinted at simplified asynchronous programming.

In Q&A, Hadi clarified comparisons to Ceylon and Scala, noting Kotlin’s balance of comprehensibility and power. He discussed potential .NET targeting, driven by demand.

Real-World Application Demo

Throughout, Hadi built a sample app, testing features in context. He covered error handling, collections, and concurrency, proving Kotlin’s robustness.

He encouraged trying Kotlin via IntelliJ’s community edition, which supports it natively.

Hadi’s presentation positioned Kotlin as a promising contender, fixing expensive language flaws while maintaining industrial applicability.

Links:

PostHeaderIcon Maven: How to use jars in a lib/ folder?

Case

I have to work on an “old-school” project: without Maven (and even without integration within Eclipse). The JARs depended on by the application are located in a lib/ folder. Besides, I cannot add JARs to company repository.
How to integrate Maven with this lib/ folder?

Solution

First of all, you have to enable the support of Maven within IntelliJ IDEA: select the project > right click > add framework support > select Maven.

Create a pom.xml and complete the main information.
Identify the JARs which are relatively common (eg those available in http://repo1.maven.org/maven2/), and add them as dependencies.

Now, you still have to deal with “uncommon” JARs

Quick and (very) dirty

The quickest way is to add the JARs as dependencies, declared with scope system, eg:
[xml]<dependency>
<groupId>unknownGroupId</groupId>
<artifactId>someArtifactId</artifactId>
<version>someVersion</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/foo.jar</systemPath>
</dependency>[/xml]

The main drawback of this dirty solution is that when you generate your archive, the JARs depended on with scope system will not be exported… Quiet a limitation, isn’t it?

(A bit) Slower and (far) cleaner

You have to declare a “remote repository”, of which URL is local, such as:
[xml]<repository>
<id>pseudoRemoteRepo</id>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<url>file://${project.basedir}/lib</url>
</repository>[/xml]

Then, declare the dependencies like:
[xml]<dependency>
<groupId>UNKNOWN</groupId>
<artifactId>foo</artifactId>
<version>UNKNOWN</version>
</dependency>[/xml]
Move and/or rename the JARs, for instance from lib/foo.jar folder to the actual one, such as lib/UNKNOWN/foo/foo-UNKNOWN.jar.

Now it should be OK ;-).
In my case I prefered to add Maven Assembly plugin with the goal jar-with-dependencies, to be sure to build a unique JAR with complete exploded dependencies.

PostHeaderIcon [DevoxxFR2012] Nagios checks via NRPE

package “nagios-nrpe-server”
“`

He demonstrates real-time dashboards that correlate application metrics with infrastructure health, enabling rapid incident response and informed scaling decisions.

Economic and Organizational Impact: Beyond Technical Excellence

Bertrand Paquet concludes with a quantitative analysis of the pipeline’s impact: deployment frequency increased from weekly to multiple times daily, mean time to recovery decreased from hours to minutes, and infrastructure costs became predictable and scalable. He argues that these technical achievements enable organizational agility—new features can be tested in production with real users within hours of conception, creating tight feedback loops that drive product excellence.

Links: