You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Matt Benson (JIRA)" <ji...@apache.org> on 2018/10/17 17:58:00 UTC
[jira] [Closed] (BVAL-135) Using bval-guice in OSGi
[ https://issues.apache.org/jira/browse/BVAL-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Benson closed BVAL-135.
----------------------------
Resolution: Won't Fix
guice module was removed
> Using bval-guice in OSGi
> ------------------------
>
> Key: BVAL-135
> URL: https://issues.apache.org/jira/browse/BVAL-135
> Project: BVal
> Issue Type: Bug
> Reporter: Florian Pirchner
> Priority: Major
>
> Hi,
> tried to use bval-guice in OSGi environments. Added @org.apache.bval.guice.Validate to an OSGi service method. But getting class loader problems.
> Sample code:
> {code:title=OSGiService.java|borderStyle=solid}
> public class RepositoryService implements IRepositoryService {
> @Override
> @Validate(validateReturnedValue = true)
> public void addToRepository(@NotNull String name) {
> System.out.println("Called with " + name);
> }
> }
> {code}
> While the service method is invoked, the class org.apache.bval.jsr303.ClassValidator#unwrap(Class<T> type) tries to load the class org.apache.bval.jsr303.extensions.MethodValidatorImpl. It is contained in the same bundle, so OSGi should not have a problem loading it.
> But the impl delegates the loading to ClassUtils.getClass(type.getName() + "Impl"). Since ClassUtils is part of the bundle commons-lang3, the class can not be loaded and an Exception is thrown.
> Maybe you could change the call to ClassUtils.getClass(getClass().getClassLoader(), type.getName() + "Impl") and everything should be fine.
> Thanks, Florian
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)