Archive for the ‘en-US’ Category
[DevoxxUS2017] 55 New Features in JDK 9: A Comprehensive Overview
At DevoxxUS2017, Simon Ritter, Deputy CTO at Azul Systems, delivered a detailed exploration of the 55 new features in JDK 9, with a particular focus on modularity through Project Jigsaw. Simon, a veteran Java evangelist, provided a whirlwind tour of the enhancements, categorizing them into features, standards, JVM internals, specialized updates, and housekeeping changes. His presentation equipped developers with the knowledge to leverage JDK 9’s advancements effectively. This post examines the key themes of Simon’s talk, highlighting how these features enhance Java’s flexibility, performance, and maintainability.
Modularity and Project Jigsaw
The cornerstone of JDK 9 is Project Jigsaw, which introduces modularity to the Java platform. Simon explained that the traditional rt.jar file, containing over 4,500 classes, has been replaced with 94 modular components in the jmods directory. This restructuring encapsulates private APIs, such as sun.misc.Unsafe, to improve security and maintainability, though it poses compatibility challenges for libraries relying on these APIs. To mitigate this, Simon highlighted options like the --add-exports
and --add-opens
flags, as well as a “big kill switch” (--permit-illegal-access
) to disable modularity for legacy applications. The jlink tool further enhances modularity by creating custom runtimes with only the necessary modules, optimizing deployment for specific applications.
Enhanced APIs and Developer Productivity
JDK 9 introduces several API improvements to streamline development. Simon showcased factory methods for collections, allowing developers to create immutable collections with concise syntax, such as List.of()
or Set.of()
. The Streams API has been enhanced with methods like takeWhile
, dropWhile
, and ofNullable
, improving expressiveness in data processing. Additionally, the introduction of jshell, an interactive REPL, enables rapid prototyping and experimentation. These enhancements reduce boilerplate code and enhance developer productivity, making Java more intuitive and efficient for modern application development.
JVM Internals and Performance
Simon delved into JVM enhancements, including improvements to the G1 garbage collector, which is now the default in JDK 9. The G1 collector offers better performance for large heaps, addressing limitations of the Concurrent Mark Sweep collector. Other internal improvements include a new process API for accessing operating system process details and a directive file for controlling JIT compiler behavior. These changes enhance runtime efficiency and provide developers with greater control over JVM performance, ensuring Java remains competitive for high-performance applications.
Housekeeping and Deprecations
JDK 9 includes significant housekeeping changes to streamline the platform. Simon highlighted the new version string format, adopting semantic versioning (major.minor.security.patch) for clearer identification. The directory structure has been flattened, eliminating the JRE subdirectory and tools.jar, with configuration files centralized in the conf directory. Deprecated APIs, such as the applet API and certain garbage collection options, have been removed to reduce maintenance overhead. These changes simplify the JDK’s structure, improving maintainability while requiring developers to test applications for compatibility.
Standards and Specialized Features
Simon also covered updates to standards and specialized features. The HTTP/2 client, introduced as an incubator module, allows developers to test and provide feedback before it becomes standard. Other standards updates include support for Unicode 8.0 and the deprecation of SHA-1 certificates for enhanced security. Specialized features, such as the annotations pipeline and parser API, improve the handling of complex annotations and programmatic interactions with the compiler. These updates ensure Java aligns with modern standards while offering flexibility for specialized use cases.
Links:
(long tweet) When ‘filter’ does not work with Primefaces’ datatable
Abstract
Sometimes, the filter
function in Primefaces <p:datatable/>
does not work when the field on which filtering is operated typed as an enum
.
Explanation
Actually, in order to filter, Primefaces relies on a direct '='
comparison. The hack to fix this issue is to force Primefaces to compare on the enum name, and not by a reference check.
Quick fix
In the enum class, add the following block:
[java]public String getName(){ return name(); }[/java]
Have the datatable declaration to look like:
[xml]<p:dataTable id="castorsDT" var="castor" value="#{managedCastorListManagedBean.initiatedCastors}" widgetVar="castorsTable" filteredValue="#{managedCastorListManagedBean.filteredCastors}">
[/xml]
Declare the enum-filtered column lke this:
[xml]<p:column sortBy="#{castor.castorWorkflowStatus}" filterable="true" filterBy="#{castor.castorWorkflowStatus.name}" filterMatchMode="in">
<f:facet name="filter">
<p:selectCheckboxMenu label="#{messages[‘status’]}" onchange="PF(‘castorsTable’).filter()">
<f:selectItems value="#{transverseManagedBean.allCastorWorkflowStatuses}" var="cws" itemLabel="#{cws.name}" itemValue="#{cws.name}"/>
</p:selectCheckboxMenu>
</f:facet>
</p:column>[/xml]
Notice how the filtering
attribute is declared:
[xml]filterable="true" filterBy="#{castor.castorWorkflowStatus.name}" filterMatchMode="in"[/xml]
In other terms, the comparison is forced the rely on equals()
of class String
, through the calls to getName()
and name()
.
Jonathan LALOU recommends… Stephane TORTAJADA
I wrote the following notice on Stephane TORTAJADA‘s profile on LinkedIn:
I had reported to Stephane for one year. I recommend Stephane for his management, that is based on a few principles:
* understand personally technical and functional problems
* allow team mates to make errors, in order to learn from them
* protect team mates from external aggressions and impediments
* escalating up and down the relevant information
Jonathan LALOU recommends… Ahmed CHAARI
I wrote the following notice on Ahmed CHAARI‘s profile on LinkedIn:
Ahmed has shown his ability to absorb and learn complex technologies, as well as improve his skills in a short time and a not-so-easy environment. This is why I consider Ahmed as a software engineer to recommend for any Java-focused team.
Jonathan LALOU recommands… Sidney COHEN
I wrote the following notice on Sidney COHEN‘s profile on LinkedIn:
Sidney has a deep knowledge of the technologies he uses, such as Tibco systems. In several occasions, he was able to liaise with the key people of the right teams, perform the good actions and deliver the best solutions to various issues. Moreover, he has learnt complex Java technologies in a short time.
I recommend Sidney as a good worker and a friendly team mate
Jonathan LALOU recommands… Yann BLAZART
I wrote the following notice on Yann BLAZART‘s profile on LinkedIn:
Yann has a wide knowledge in technologies, specifications and implementations of JEE. He has shown his ability to propose and implement technical solutions to various technical and functional issues and subjects. Besides, by helping his colleagues, he succeeded in raising the general level of the team. All this is why I recommend Yann as a Java developer and architect.
[DevoxxFR 2016] The Blockchain in Detail
The blockchain emerged as a revolutionary technology, capturing significant attention with its potential to reshape industries and redefine trust. At Devoxx France 2016, Benoît Lafontaine and Yann Rouillard delivered a comprehensive university session delving into the intricacies of this much-hyped technology, moving beyond the buzzwords to explore its technical underpinnings, evolutions, and practical implications. Their detailed exposition covered the foundational principles of Bitcoin, the expanded capabilities introduced by platforms like Ethereum, the concept and implementation of smart contracts, various use cases, and the broader societal questions raised by distributed ledger technologies.
Demystifying the Blockchain: The Foundation of Bitcoin
To truly grasp the essence of blockchain, one must first understand its initial and most prominent implementation: Bitcoin. More than just a digital currency, Bitcoin introduced a novel distributed ledger technology that enables secure, transparent, and tamper-resistant record-keeping without relying on a central authority. The core of Bitcoin’s technical functioning lies in its chain of blocks. Each block contains a list of verified transactions, a timestamp, and a reference (cryptographic hash) to the preceding block, creating an immutable historical record.
The lifecycle of a Bitcoin transaction begins when a user initiates a transfer of value. This transaction is broadcast to the Bitcoin network. Nodes on the network validate the transaction based on a set of rules, ensuring the sender has sufficient funds and the transaction is correctly formatted. Once validated, the transaction is added to a pool of unconfirmed transactions.
The process of adding new blocks to the chain is handled by miners through a mechanism called Proof-of-Work (PoW). Miners compete to solve a complex computational puzzle, which essentially involves finding a number (a “nonce”) such that when added to the block data and hashed, the resulting hash meets certain criteria (e.g., starts with a specific number of zeros). This hashing process is computationally intensive but easy to verify. The first miner to find a valid nonce and create a new block broadcasts it to the network. Other nodes verify the block’s validity, including the PoW, and if correct, add it to their copy of the blockchain. This block then becomes the latest link in the chain.
Cryptography plays a vital role in ensuring the security and integrity of Bitcoin. Hashing algorithms (like SHA-256 used in Bitcoin) produce a unique fixed-size string (the hash) from input data. Even a minor change in the input data results in a completely different hash. This property is used to link blocks and verify data integrity. Digital signatures, based on public-key cryptography, are used to authorize transactions. Each user has a pair of keys: a private key (kept secret) used to sign a transaction and a public key (shared freely) used by others to verify the signature, ensuring that only the owner of the funds can authorize their transfer.
One of the fundamental challenges in a distributed system like Bitcoin is reaching consensus among participants on the correct state of the ledger, especially in the presence of potentially malicious actors. Proof-of-Work is Bitcoin’s consensus mechanism. By requiring significant computational effort to create a new block, it makes it economically infeasible for a malicious party to alter past transactions. To successfully tamper with a block, an attacker would need to redo the PoW for that block and all subsequent blocks faster than the rest of the network combined. This leads to the concept of the 51% attack, where if an entity controls more than 51% of the network’s total mining power, they could potentially manipulate transactions. However, the sheer scale of the Bitcoin network’s hashing power makes achieving a 51% attack incredibly difficult and prohibitively expensive.
Beyond Bitcoin: Exploring Ethereum and Smart Contracts
While Bitcoin demonstrated the power of a decentralized ledger for peer-to-peer currency transactions, its scripting language is intentionally limited, primarily designed for simple payment logic. The next wave of blockchain innovation arrived with platforms like Ethereum, which expanded the potential of blockchain technology far beyond just cryptocurrencies. Ethereum introduced the concept of a decentralized world computer capable of executing code, paving the way for a wide range of decentralized applications.
Ethereum’s core innovation is the Ethereum Virtual Machine (EVM), a Turing-complete virtual machine that can execute code deployed on the Ethereum blockchain. This code comes in the form of smart contracts. A smart contract is essentially a program stored on the blockchain that automatically executes predefined actions when specific conditions are met. Unlike traditional contracts, which are interpreted and enforced by legal systems, smart contracts are self-executing and enforced by the code itself, running on the decentralized and immutable ledger.
The primary language for writing smart contracts on Ethereum is Solidity, a high-level, contract-oriented language. Solidity’s syntax is influenced by languages like C++, Python, and JavaScript. Benoît and Yann provided examples of Solidity code, illustrating how to define state variables, functions, and events within a contract. These contracts can represent anything from simple tokens and voting mechanisms to complex financial agreements and decentralized autonomous organizations.
Deploying a smart contract involves compiling the Solidity code into EVM bytecode and then sending a transaction to the Ethereum network containing this bytecode. Once deployed, the contract resides at a specific address on the blockchain and its functions can be invoked by other users or contracts through transactions. The execution of smart contract functions requires gas, a unit of computation on the Ethereum network, paid for in Ether (ETH), Ethereum’s native cryptocurrency. This gas mechanism incentivizes efficient code and prevents denial-of-service attacks. The ability to write and deploy arbitrary code on a decentralized and immutable ledger opened up a vast landscape of possibilities for creating decentralized applications (DApps).
Alternative Consensus Mechanisms and Decentralized Autonomous Organizations
While Proof-of-Work (PoW) has proven effective for Bitcoin’s security, its energy consumption is a significant concern. This has led to research and development into alternative consensus mechanisms. Proof-of-Stake (PoS) is a prominent alternative where the right to create new blocks and validate transactions is determined by the amount of cryptocurrency a validator holds and is willing to “stake” as collateral. In PoS, validators are chosen to create blocks based on their stake size and other factors, rather than computational power. If a validator attempts to validate fraudulent transactions, they risk losing their staked amount. PoS is generally considered more energy-efficient than PoW. At the time of the talk, Ethereum was planning a transition from PoW to a PoS consensus mechanism called Casper, a transition that has since been completed.
The capabilities of smart contracts extend to enabling entirely new forms of organization. A Decentralized Autonomous Organization (DAO) is an organization whose rules and decision-making processes are encoded directly into smart contracts on a blockchain. Once deployed, a DAO operates autonomously according to its pre-programmed rules, without the need for central management. Funding, governance, and operations are all managed through the smart contracts and the participation of token holders who vote on proposals. The talk touched upon the concept of DAOs and their potential to create more transparent and democratic organizational structures. However, the early history of DAOs also includes cautionary tales, such as “The DAO” hack in 2016, which highlighted the critical importance of rigorous security auditing for smart contracts managing significant assets.
Real-World Applications and Societal Impact
The potential applications of blockchain technology span numerous industries beyond finance. Benoît and Yann explored various use cases that were being studied or already implemented in 2016. In finance, beyond cryptocurrencies, blockchain can streamline cross-border payments, facilitate peer-to-peer lending, and improve trade finance. In supply chain management, it can provide transparent and verifiable tracking of goods from origin to destination. For identity management, blockchain could enable self-sovereign identity solutions, giving individuals more control over their personal data. Other potential applications discussed included decentralized marketplaces, intellectual property management, voting systems, and even decentralized energy grids.
The advantages offered by blockchain technology, such as transparency (for public blockchains), immutability, security through cryptography, and disintermediation (removing the need for central authorities), make it attractive for scenarios where trust and verification are paramount. However, challenges remain, including scalability limitations of some blockchains, regulatory uncertainty, the difficulty of correcting errors on an immutable ledger, and the complexity of developing and securing smart contracts.
Beyond the technical and practical applications, blockchain introduces profound social implications. It challenges existing power structures by enabling decentralization and disintermediation. It raises questions about governance in decentralized networks, the legal status of smart contracts, and the impact on privacy in a transparent ledger. The technology empowers individuals with greater control over their assets and data but also requires a higher degree of individual responsibility. The discussion during the session underscored that blockchain is not just a technical innovation but also a socio-technical one with the potential to reshape how we organize and interact in the digital age.
In conclusion, the Devoxx France 2016 session on the blockchain provided a timely and detailed exploration of this burgeoning technology. By dissecting the mechanics of Bitcoin, presenting the advancements brought by Ethereum and smart contracts, discussing alternative consensus models and DAOs, and examining a variety of use cases and societal impacts, Benoît Lafontaine and Yann Rouillard offered attendees a clearer understanding of what lay beyond the hype and why this technology warranted serious attention from developers and businesses alike. The session emphasized that while challenges existed, the potential for blockchain to drive innovation across numerous sectors was undeniable.
Links:
- Benoît Lafontaine’s Blog Post on OCTO Talks!
- OCTO Technologies official website
- Bitcoin official website
- Ethereum official website
- Solidity official website
- The DAO hack explanation
Hashtags: #Blockchain #Bitcoin #Ethereum #SmartContracts #ProofOfWork #ProofOfStake #DAO #Cryptocurrency #Decentralization #DistributedLedger #FinTech #Web3 #Solidity #EVM #OCTOTechnologies #BenoitLafontaine #YannRouillard #DevoxxFR
“Android Application Development with Maven” by Patroklos Papapetrou and Jonathan Lalou, was published by Packt
Abstract
I am glad and proud to announce the publication of “Android Application Development with Maven”, on March 15th 2015, by Packt.
Direct link: https://www.packtpub.com/apache-maven-dependency-management/book
Alternate locations: Amazon.com, Amazon.co.uk, Barnes & Noble.
On this occasion, I’d like to thank all Packt team for allowing me achieving this project.
What you will learn from this book
- Integrate Maven with your favorite Android IDE
- Install and configure Maven with your local development environment
- Create the proper Maven structure for both standalone Android applications or applications that are part of a bigger project
- Run unit tests using popular frameworks such as Robolectric and collect coverage information using Maven plugins
- Configure a variety of different tools such as Robotium, Spoon, and Selendroid to run integration tests
- Handle dependencies and different versions of the same application
- Manage and automate the release process of your application inside/outside Google Play
- Discover new tools such as Eclipse, IntelliJ IDEA/Android Studio, and NetBeans, which perfectly integrate with Maven and boost your productivity
In Detail
Android is an open source operating system used for smartphones and tablet computers. The Android market is one of the biggest and fastest growing platforms for application developers, with over a million apps uploaded every day.
Right from the beginning, this book will cover how to set up your Maven development environment and integrate it with your favorite IDE. By sequentially working through the steps in each chapter, you will quickly master the plugins you need for every phase of the Android development process. You will learn how to use Maven to manage and build your project and dependencies, automate your Android application testing plans, and develop and maintain several versions of your application in parallel. Most significantly, you will learn how to integrate your project into a complete factory.
Approach
Learn how to use and configure Maven to support all phases of the development of an Android application
Who this book is for
Android Application Development with Maven is intended for Android developers or devops engineers who want to use Maven to effectively develop quality Android applications. It would be helpful, but not necessary, if you have some previous experience with Maven.
Table of content
- 1: Beginning with the Basics
- 2: Starting the Development Phase
- 3: Unit Testing
- 4: Integration Testing
- 5: Android Flavors
- 6: Release Life Cycle and Continuous Integration
- 7: Other Tools and Plugins
System properties are ignored by Java WebStart with JRE 7
Abstract
On migrating an application deployed through Java WebStart from JRE 6 to JRE 7 (1.7.0_71 ; the problem is present since 1.7.0_4X), system properties are ignored.
As a reminder, system properties are declared in JNLP file as:
[xml]<property name="foo" value="boo"/>[/xml]
They are equivalent to execute JRE with -D
arguments, such as -Dfoo=boo
for the XML block above.
Launching the JNLP file with javaws file.jnlp -Dfoo=boo
or even javaws file.jnlp -J-Dfoo=boo
does not fix the issue.
Quick fix
Rename all system properties, so that they are prefixed with jnlp.
.
Eg, replace:
[xml]<property name="foo" value="boo"/>[/xml]
with:
[xml]<property name="jnlp.foo" value="boo"/>[/xml]
Do not forget to update any part of the code calling these properties!
For a sadistic reason I still ignore, properties that are not prefixed with jnlp.
are no more considered by Java WebStart included in JRE 7.
Jetty / Timeout scanning annotations
Case
My application consists in a WAR I deploy on Tomcat or Jetty during the development phase. I execute Eclipse Jetty either in standalone, or via Maven Jetty plugin – most of the time.
On updating and deploying the application on my laptop (which is not my primary development machine), I get the following error with Maven:
[java]java.lang.Exception: Timeout scanning annotations[/java]
Unlike, with a standalone instance of Jetty, the WAR is successfully deployed.
Complete stacktrace
[java]2014-09-08 22:28:50.669:INFO:oeja.AnnotationConfiguration:main: Scanned 1 container path jars, 87 WEB-INF/lib jars, 1 WEB-INF/classes dirs in 65922ms for context o.e.j.m.p.JettyWebAppContext@13bb109{/,[file:/D:/JLALOU/development/forfait-XXX-XXX/XXX-web/src/main/webapp/, jar:file:/C:/Users/jlalou/.m2/repository/org/primefaces/extensions/primefaces-extensions/2.0.0/primefaces-extensions-2.0.0.jar!/META-INF/resources/, jar:file:/C:/Users/jlalou/.m2/repository/org/primefaces/themes/bootstrap/1.0.10/bootstrap-1.0.10.jar!/META-INF/resources/, jar:file:/C:/Users/jlalou/.m2/repository/org/primefaces/primefaces/5.0/primefaces-5.0.jar!/META-INF/resources/, jar:file:/C:/Users/jlalou/.m2/repository/com/sun/faces/jsf-impl/2.2.6/jsf-impl-2.2.6.jar!/META-INF/resources/],STARTING}{file:/D:/JLALOU/development/forfait-XXX-XXX/XXX-web/src/main/webapp/}
2014-09-08 22:28:50.670:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.m.p.JettyWebAppContext@13bb109{/,[file:/D:/JLALOU/development/forfait-XXX-XXX/XXX-web/src/main/webapp/, jar:file:/C:/Users/jlalou/.m2/repository/org/primefaces/extensions/primefaces-extensions/2.0.0/primefaces-extensions-2.0.0.jar!/META-INF/resources/, jar:file:/C:/Users/jlalou/.m2/repository/org/primefaces/themes/bootstrap/1.0.10/bootstrap-1.0.10.jar!/META-INF/resources/, jar:file:/C:/Users/jlalou/.m2/repository/org/primefaces/primefaces/5.0/primefaces-5.0.jar!/META-INF/resources/, jar:file:/C:/Users/jlalou/.m2/repository/com/sun/faces/jsf-impl/2.2.6/jsf-impl-2.2.6.jar!/META-INF/resources/],STARTING}{file:/D:/JLALOU/development/forfait-XXX-XXX/XXX-web/src/main/webapp/}
java.lang.Exception: Timeout scanning annotations
at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:571)
at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:441)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:466)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:745)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:282)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:117)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:99)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:154)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:117)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:99)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:117)
at org.eclipse.jetty.server.Server.start(Server.java:358)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:99)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.server.Server.doStart(Server.java:325)
at org.eclipse.jetty.maven.plugin.JettyServer.doStart(JettyServer.java:68)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:564)
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:360)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute(JettyRunMojo.java:168)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)[/java]
Explanation
Since the release of 9.1 branch, Jetty server limits the scan time for annotations at 60 seconds, by default.
The exception is raised here: source
[java]boolean timeout = !latch.await(getMaxScanWait(context), TimeUnit.SECONDS);
if (LOG.isDebugEnabled())
{
for (ParserTask p:_parserTasks)
LOG.debug("Scanned {} in {}ms", p.getResource(), TimeUnit.MILLISECONDS.convert(p.getStatistic().getElapsed(), TimeUnit.NANOSECONDS));
LOG.debug("Scanned {} container path jars, {} WEB-INF/lib jars, {} WEB-INF/classes dirs in {}ms for context {}",
_containerPathStats.getTotal(), _webInfLibStats.getTotal(), _webInfClassesStats.getTotal(),
(TimeUnit.MILLISECONDS.convert(System.nanoTime()-start, TimeUnit.NANOSECONDS)),
context);
}
if (timeout)
me.add(new Exception("Timeout scanning annotations"));[/java]
Fix
As a quick fix, on launching Maven, add the option -Dorg.eclipse.jetty.annotations.maxWait=120
(set a higher value if needed):
[java]mvn jetty:run -Dorg.eclipse.jetty.annotations.maxWait=120[/java]
You can also set this property directly in jetty-*.xml
configuration files, for webapp or even for a complete server.