Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6013375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:32:22+00:00 2026-05-23T02:32:22+00:00

This is my code, package com.mywicketapp; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List;

  • 0

This is my code,

package com.mywicketapp;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
import org.apache.wicket.util.string.Strings;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.extensions.ajax.markup
   .html.autocomplete.AutoCompleteTextField;

public class  HomePage extends WebPage
{
  public HomePage()
  {
  Form form = new Form("form");
  add(form);

  final AutoCompleteTextField field = 
  new AutoCompleteTextField("auto", new Model(""))
  {
  protected Iterator getChoices(String input)
  {
  if (Strings.isEmpty(input))
 {
 return Collections.EMPTY_LIST.iterator();
  }

  List choices = new ArrayList(10);

 Locale[] locales = Locale.getAvailableLocales();

 for (int i = 0; i < locales.length; i++)
 {
  final Locale locale = locales[i];
  final String country = locale.getDisplayCountry();

if (country.toUpperCase().startsWith(input.toUpperCase()))
 {
  choices.add(country);
  if (choices.size() == 10)
 {
  break;
  }
 }
 }
 return choices.iterator();
 }
  };
  form.add(field);

final Label label = new 
 Label("selectedValue", field.getModel());
  label.setOutputMarkupId(true);
 form.add(label);
 field.add(new AjaxFormSubmitBehavior(form, "onchange")
 {
  protected void onSubmit(AjaxRequestTarget target)
  {
 target.addComponent(label);
 }

  @Override
 protected void onError(AjaxRequestTarget target)
 {
  }
  });
  }
}

This is my application code:

package com.mywicketapp;

import org.apache.wicket.protocol.http.WebApplication;

/**
 * Application object for your web application. If you want to run this application without deploying, run the Start class.
 * 
 * @see com.mywicketapp.Start#main(String[])
 */
public class WicketApplication extends WebApplication
{    
    /**
     * Constructor
     */
    public WicketApplication()
    {
    }

    /**
     * @see org.apache.wicket.Application#getHomePage()
     */
    public Class<HomePage> getHomePage(){
          return HomePage.class;  
          }

}

Some html:

<html>
  <head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
  The textfield below will autocomplete country names
  <br><hr>
  <form wicket:id="form">
 Selected value is: <span wicket:id="selectedValue"></span>
 <br/>
  Country: <input type="text" wicket:id="auto" size="20"/>
 </form>
  </body>
</html>

And the error:

- log                        - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
>>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP
INFO  - log                        - jetty-6.1.25
INFO  - log                        - NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
WARN  - log                        - failed wicket.mywicketapp: java.lang.ClassCastException: wicket.extensions.Initializer cannot be cast to org.apache.wicket.IInitializer
ERROR - log                        - Failed startup of context org.mortbay.jetty.webapp.WebAppContext@66e7b3f2{/,src/main/webapp}
java.lang.ClassCastException: wicket.extensions.Initializer cannot be cast to org.apache.wicket.IInitializer
    at org.apache.wicket.Application.addInitializer(Application.java:864)
    at org.apache.wicket.Application.load(Application.java:938)
    at org.apache.wicket.Application.initializeComponents(Application.java:715)
    at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:732)
    at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:224)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at com.mywicketapp.Start.main(Start.java:43)
INFO  - log                        - Started SelectChannelConnector@0.0.0.0:8080
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:32:23+00:00Added an answer on May 23, 2026 at 2:32 am

    Looks to me like you have a version incompatibility problem… Check to make sure that the version of wicket-extensions that you’re using is compatible with your wicket version. The wicket.extensions.Initializer that’s getting loaded and causing the exception is surely getting loaded up by your AutoCompleteTextField.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the code: package com.elfapp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log;
aka, what is wrong with this code:- package com.mez.appofjaq; import com.mez.appofjaq.RssParser.RssFeed; import android.app.Activity; import
So, why does this code: package org.popoffka.apicross; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public
Here's my code: package com.eggproject_hu.WPECommerceAdminSales.client; import java.lang.Boolean; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Window; public class AblakVillogo
This piece of code is from Adobe docs : package { import flash.display.Loader; import
This is the code: package com.XXX; public final class Foo { private Foo() {
My code: package com.example.linkingpage; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent;
To be specific, I was trying this code: package hello; public class Hello {
We have some code kicking around that uses this old internal Sun package for
I have a EJB defined as this: package com.foo; @Stateless (mappedName=HelloWorld) public class HelloWorldBean

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.