theonedev/onedev · error · org.apache.wicket.WicketRuntimeException

Error accessing member: {fieldName} of class: {className}

Error message

Error accessing member: {fieldName} of class: {className}

What it means

GuiceProxyTargetLocator.newGuiceKey() rebuilds the Guice Key for a proxied injected member from serialized class/field names; if resolving the class or its declared field fails, it wraps the exception in a WicketRuntimeException. This typically means the serialized injection point no longer matches the deployed classes.

Source

Thrown at server-core/src/main/java/org/apache/wicket/guice/GuiceProxyTargetLocator.java:99

				return null;
			}
		}

		return injector.getInstance(key);
	}

	private Key<?> newGuiceKey()
	{
		final Type type;
		try
		{
			Class<?> clazz = WicketObjects.resolveClass(className);
			final Field field = clazz.getDeclaredField(fieldName);
			type = field.getGenericType();
		}
		catch (Exception e)
		{
			throw new WicketRuntimeException("Error accessing member: " + fieldName +
				" of class: " + className, e);
		}

		// using TypeLiteral to retrieve the key gives us automatic support for
		// Providers and other injectable TypeLiterals
		if (bindingAnnotation == null)
		{
			return Key.get(TypeLiteral.get(type));
		}
		else
		{
			return Key.get(TypeLiteral.get(type), bindingAnnotation);
		}
	}

	public boolean isSingletonScope()
	{
		if (isSingletonCache == null)

View on GitHub (pinned to d44925c47c)

Solutions

  1. Invalidate sessions/page stores after redeploying changed classes (secondary exception to keep clean)
  2. Restore the field/class names matching the serialized page, or keep a serialVersionUID-compatible migration path
  3. Check the cause chain: ClassNotFoundException vs NoSuchFieldException tells you which side mismatched
  4. Restart server and clear the page store / disk-based page manager data directory

Example fix

// before
@Inject private UserService userService; // renamed in new deploy, old session still references old field
// after
// keep field name stable across deploys, or bump serialVersionUID and clear the page store on upgrade
Defensive patterns

Strategy: try-catch

Try / catch

try {
    deserializePage(session, pageId);
} catch (WicketRuntimeException e) {
    if (e.getCause() instanceof ClassNotFoundException || e.getCause() instanceof NoSuchFieldException) {
        session.invalidate(); // force fresh pages after refactor/redeploy
    }
}

Prevention

When it happens

Trigger: Deserializing a page/ компонent whose proxy target references a field renamed or removed from its class; WicketObjects.resolveClass(className) throwing ClassNotFoundException; getDeclaredField(fieldName) throwing NoSuchFieldException after refactoring.

Common situations: Deploying new jar versions while old serialized pages exist in the session/page store; renaming an @Inject-ed field without invalidating sessions; class moved to another package across versions.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/43fe73f1fcf9c091. Report an issue: GitHub.