Start Default container Unexpected RuntimeException

40 views
Skip to first unread message

Dennis Tait

unread,
Aug 14, 2013, 6:56:25 AM8/14/13
to users...@googlegroups.com
Hi,

I have been using jabox-0.6.0-jetty-console.war started from the command line for quite a months on a development project but I have an error which I cannot find a solution. Jabox starts ok but when I try to start start the Default container I get a runtime exception.

I have seen this jabox error in the past and my solution was to re-install jabox but this is drastic as I loose all my data and configurations so do not want to go down that path.

Can anyone help with the following error.

Unexpected RuntimeException

Last cause: null
WicketMessage: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at [Form [Component id = deleteForm]] on component [Form [Component id = deleteForm]] threw an exception

Stacktrace

Root cause:

java.lang.NullPointerException
at java.lang.String.replace(String.java:2207)
at org.jabox.utils.SettingsModifier.parseInputStream(SettingsModifier.java:20)
at org.jabox.utils.MavenSettingsManager.writeCustomSettings(MavenSettingsManager.java:40)
at org.jabox.utils.MavenSettingsManager.writeCustomSettings(MavenSettingsManager.java:21)
at org.jabox.model.Container.start(Container.java:139)
at org.jabox.webapp.menubuttons.StartContainerButton.onSubmit(StartContainerButton.java:60)
at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1140)
at org.apache.wicket.markup.html.form.Form.process(Form.java:804)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:728)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:670)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:180)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:166)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:712)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1326)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:921)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:784)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:223)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:46)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:545)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:43)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
at java.lang.Thread.run(Thread.java:662)

Complete stack:

org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at [Form [Component id = deleteForm]] on component [Form [Component id = deleteForm]] threw an exception
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:270)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:180)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:166)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:712)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:180)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:166)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:712)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)

display page view


Kind regards

Dennis


Dennis Tait

unread,
Aug 16, 2013, 7:20:07 AM8/16/13
to users...@googlegroups.com
Hi all,

I've fixed the problem by changing the code to ignore nulls while parsing the inputStream. See following code extract changes in bold).

The fix works but I'm I have not gone deeper to find out why the nulls appeared when they were not there before!!

Maybe someone can look at my fix and debug the real issue and update jabox. 

Jabox.log
 INFO [org.jabox.webapp.menubuttons.StartContainerButton] Starting container: Default
 INFO [org.jabox.model.Container] Starting Servlet Container
 INFO [org.jabox.utils.SettingsModifier]  pair.getValue() = null
 INFO [org.jabox.utils.SettingsModifier]  pair.getValue() = null
 INFO [org.jabox.utils.SettingsModifier]  pair.getValue() = null


package org.jabox.utils;

import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.util.Map;
import java.util.Map.Entry;

import org.apache.wicket.util.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SettingsModifier {
 private static final Logger LOGGER = LoggerFactory
       .getLogger(SettingsModifier.class);

    public static String parseInputStream(final InputStream is,
            Map<String, String> values) throws IOException {
        StringWriter writer = new StringWriter();
        IOUtils.copy(is, writer);
        String theString = writer.toString();
        String replace = theString;
        for (Entry<String, String> pair : values.entrySet()) {
        if (pair.getValue()!=null)
                replace = replace.replace(pair.getKey(), pair.getValue());
            LOGGER.info(" pair.getValue() = " + pair.getValue());
        }
        return replace;
    }

}

NJoy :)
Dennis

Dimitris Kapanidis

unread,
Aug 16, 2013, 9:21:24 AM8/16/13
to users...@googlegroups.com

Hi,

I'll check it to see what the problem may be.

If you put on the logs the pair.getKey() I might be able to pin point it easier.

By first view It seems your maven settings is not loaded correctly.

Cheers

--
You received this message because you are subscribed to the Google Groups "users-jabox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to users-jabox...@googlegroups.com.
To post to this group, send email to users...@googlegroups.com.
Visit this group at http://groups.google.com/group/users-jabox.
For more options, visit https://groups.google.com/groups/opt_out.

Dennis Tait

unread,
Aug 23, 2013, 10:16:15 AM8/23/13
to users...@googlegroups.com
HI,

I think you are correct about the maven settings.xml, I do have a settings.xml for maven configured, there is also a settings.xml in the source tree of jabox.

I will post the output of pair.getKey() as soon as I can.

Kind regards
Dennis

Spiddy

unread,
Aug 26, 2013, 2:04:14 AM8/26/13
to users...@googlegroups.com
The values injected in the settings.xml are the following:

        values.put("${repo.url}", dc.getRms().getRepositoryURL());
        values.put("${repo.username}", dc.getRms().getUsername());
        values.put("${repo.password}", dc.getRms().getPassword());

(RMS is the repository management system, by default Nexus, but can also be SCP or Artifactory)

I managed to reproduce it with Artifactory, Is that what you use? (although it could happen with other RMS types also) 

The problem is the following:
- During container launch, Jabox creates the ~/jabox/.m2/settings.xml that uses for maven (If it already exists it skips this part for not messing existing files).
- In this settings.xml it injects the values from the RMS (in order to be able to deploy stuff with maven to the RMS)
- Not all RMS have usernames or passwords.
- Some RMS don't have URL as obligatory field (although they should).

In general this step should not fail (all validations should be done before). If there are nulls they should be put as empty values (e.g. empty username). I tweaked your solution in order to replace keys with empty strings instead of not replacing them at all:

        for (Entry<String, String> pair : values.entrySet()) {
            if (pair.getValue()==null) {
                pair.setValue("");
            }
            replace = replace.replace(pair.getKey(), pair.getValue());
            LOGGER.debug("Settings.xml variable: {}={}", pair.getKey(), pair.getValue());
        }

With previous versions, in order to continue just create manually the ~/.jabox/.m2/settings.xml and it will continue without issues. 

Dennis Tait

unread,
Aug 28, 2013, 8:36:51 AM8/28/13
to users...@googlegroups.com
Hi,

Thanks for looking into this issue, explaining how it works and releasing a fix.

I am using a standalone Artifactory on a different server as the artifact repository rather than Nexus or SCP.

Kind regards
Dennis
Reply all
Reply to author
Forward
0 new messages