You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Leangen <wi...@leangen.net> on 2007/08/21 11:03:34 UTC

NullPointerException when resolving a class

I am trying to upgrade to wicket 1.3. I was running 1.2.6 with no
problems.

When trying to resolve the class for this markup:
bundleresource://88/com/company/package/MyClass$WelcomeLabel.html

in MarkupResourceStream, the method:

  public Class getMarkupClass()
  {
      return Classes.resolveClass(markupClassName);
  }

is returning null. In other words, for some reason, it's not finding the
class.

The class isn't changed, so I'm suspecting it may be related to some new
way paths are being handled, or something. I'm not sure.


Any ideas how I can solve this?

The problem is happening here (I unchained the huge lines in an attempt
to debug):

In org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader:

	private Markup checkForMarkupInheritance(final MarkupContainer
container, final Markup markup,
			final boolean enforceReload)
	{
		// Check if markup contains <wicket:extend> which tells us that
		// we need to read the inherited markup as well.
		int extendIndex = requiresBaseMarkup(markup);
		if (extendIndex == -1)
		{
			// return a MarkupStream for the markup
			return markup;
		}

		// get the base markup
		final IMarkupSettings markupSettings =
Application.get().getMarkupSettings();
		final IMarkupCache markupCache = markupSettings.getMarkupCache();

		final MarkupResourceData markupResourceData =
markup.getMarkupResourceData();
		final MarkupResourceStream resource =
markupResourceData.getResource();

*********** here *************
		final Class markupClass = resource.getMarkupClass();
*********** here *************
		final Markup baseMarkup = markupCache.getMarkup(container,
markupClass.getSuperclass(),
				enforceReload);

		if (baseMarkup == Markup.NO_MARKUP)
		{
			throw new MarkupNotFoundException(
					"Base markup of inherited markup not found. Component class: " +
							markup.getMarkupResourceData().getResource().getContainerInfo()
									.getContainerClass().getName() +
							" Enable debug messages for
org.apache.wicket.util.resource.Resource to get a list of all filenames
tried.");
		}

		// Merge base and derived markup
		return new MergedMarkup(markup, baseMarkup, extendIndex);
	}



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: NullPointerException when resolving a class

Posted by David Leangen <wi...@leangen.net>.
Thank you for following up.

I've been trying to update Pax Wicket (OSGi adapter for Wicket) for use
with the Wicket 1.3 branch. It is not trivial at all for me, who is not
so familiar with either Wicket or Pax Wicket internals.

However, I seem to have most of the work done, except that the way class
loaders works is very different. I'm no longer sure if it's a Wicket
thing or not, but on the other hand, I don't see why it would suddenly
change.

It _seems_ (have not yet had time to fully check) that any class within
the bundle where the Application was instantiated is available, while
any class in a different bundle is not available. Although this is
causing classloading to fail, it seems to be a proper OSGi behaviour.

So, either the Pax Wicket classloader is wrong, or for some reason a
classresolver is missing from the picture.


I have run out of time ATM to work on this, so I've passed it on to the
Pax Wicket team. However, they seem to be busy with other work right
now.


In conclusion: I'll have to get back to you on this. :-)


Cheers,
Dave




On Mon, 2007-08-27 at 23:13 -0700, Eelco Hillenius wrote:
> > I am trying to upgrade to wicket 1.3. I was running 1.2.6 with no
> > problems.
> >
> > When trying to resolve the class for this markup:
> > bundleresource://88/com/company/package/MyClass$WelcomeLabel.html
> >
> > in MarkupResourceStream, the method:
> >
> >   public Class getMarkupClass()
> >   {
> >       return Classes.resolveClass(markupClassName);
> >   }
> >
> > is returning null. In other words, for some reason, it's not finding the
> > class.
> 
> Does this problem persist for the latest snapshot? And if so, can you
> describe what is special about your case? I'm using panels for
> internal classes all the time without any problems.
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: NullPointerException when resolving a class

Posted by Eelco Hillenius <ee...@gmail.com>.
> I am trying to upgrade to wicket 1.3. I was running 1.2.6 with no
> problems.
>
> When trying to resolve the class for this markup:
> bundleresource://88/com/company/package/MyClass$WelcomeLabel.html
>
> in MarkupResourceStream, the method:
>
>   public Class getMarkupClass()
>   {
>       return Classes.resolveClass(markupClassName);
>   }
>
> is returning null. In other words, for some reason, it's not finding the
> class.

Does this problem persist for the latest snapshot? And if so, can you
describe what is special about your case? I'm using panels for
internal classes all the time without any problems.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org