Search
Calendar
April 2024
S M T W T F S
« Sep    
 123456
78910111213
14151617181920
21222324252627
282930  
Your widget title
Archives

Archive for the ‘en-US’ Category

PostHeaderIcon “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

PostHeaderIcon 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:

<property name="foo" value="boo"/>

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:

<property name="foo" value="boo"/>

with:

<property name="jnlp.foo" value="boo"/>

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.

PostHeaderIcon 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.lang.Exception: Timeout scanning annotations

Unlike, with a standalone instance of Jetty, the WAR is successfully deployed.

Complete stacktrace

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)

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

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"));

Fix

As a quick fix, on launching Maven, add the option -Dorg.eclipse.jetty.annotations.maxWait=120 (set a higher value if needed):

mvn jetty:run -Dorg.eclipse.jetty.annotations.maxWait=120

You can also set this property directly in jetty-*.xml configuration files, for webapp or even for a complete server.

PostHeaderIcon (long tweet) How to display / modify Oracle XDB port?

Oracle XDB port runs by default on port 8080… which is quite an issue for Java web developpers, because of the collision with default port used by servlet engines such as Tomcat and Jetty.

To display Oracle XDB port, run:

select  DBMS_XDB.GETHTTPPORT from dual;

To change it (for instance to set it on port 9090), run

exec DBMS_XDB.SETHTTPPORT(9090);

PostHeaderIcon (long tweet) Could not find backup for factory javax.faces.context.FacesContextFactory.

Case

On deploying a JSF 2.2 / Primefaces 5 application on Jetty 9, I got the following error:

java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.

The issue seems linked to Jetty, since I could not reproduce the issue on Tomcat 8.

Quickfix

In the web.xml, add the following block:

    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>