You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Benson Margulies <be...@basistech.com> on 2015/11/07 20:29:10 UTC

hibernate validator feature

I created a simple pax-exam test of the hibernate-validator feature, and I get:

javax.validation.ValidationException: Unable to create a
Configuration, because no Bean Validation provider could be found. Add
a provider like Hibernate Validator (RI) to your classpath.

Any suggestions?

@ProbeBuilder
public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
    probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*");
    return probe;
}

@Configuration
public Option[] configure() throws Exception {
    loadProps();
    karafDebug = false;

    return options(karafDistributionConfiguration()
                    .frameworkUrl(
                            maven()
                                    .groupId("org.apache.karaf")
                                    .artifactId("apache-karaf")
                                    .type("zip")
                                    .version(karafVersion))
                    .karafVersion(karafVersion).name("Apache Karaf")
                    .unpackDirectory(new File("target/pax"))
                    .useDeployFolder(false),
            keepRuntimeFolder(),
            configureConsole().ignoreLocalConsole(),
            logLevel(LogLevelOption.LogLevel.INFO),
            features(maven().groupId("org.apache.karaf.features")
                            .artifactId("enterprise")
                            .version(karafVersion)
                            .classifier("features")
                            .type("xml"),
                    "hibernate-validator"),
            when(karafDebug).useOptions(debugConfiguration()),
            junitBundles(),
            systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
            systemProperty("org.ops4j.pax.exam.rbc.rmi.host").value("localhost")
    );
}

Re: hibernate validator feature

Posted by Benson Margulies <be...@basistech.com>.
You know, I tried that.

I've gotten myself unblocked by figuring out how to avoid the service locator.


On Sat, Nov 7, 2015 at 3:00 PM, James Carman <ja...@carmanconsulting.com> wrote:
> I usually do not try to work with hibernate validator that way. I expose
> OSGi services. When I am at a computer later, I can show you an example.
>
> On Sat, Nov 7, 2015 at 2:29 PM Benson Margulies <be...@basistech.com>
> wrote:
>>
>> I created a simple pax-exam test of the hibernate-validator feature, and I
>> get:
>>
>> javax.validation.ValidationException: Unable to create a
>> Configuration, because no Bean Validation provider could be found. Add
>> a provider like Hibernate Validator (RI) to your classpath.
>>
>> Any suggestions?
>>
>> @ProbeBuilder
>> public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
>>     probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*");
>>     return probe;
>> }
>>
>> @Configuration
>> public Option[] configure() throws Exception {
>>     loadProps();
>>     karafDebug = false;
>>
>>     return options(karafDistributionConfiguration()
>>                     .frameworkUrl(
>>                             maven()
>>                                     .groupId("org.apache.karaf")
>>                                     .artifactId("apache-karaf")
>>                                     .type("zip")
>>                                     .version(karafVersion))
>>                     .karafVersion(karafVersion).name("Apache Karaf")
>>                     .unpackDirectory(new File("target/pax"))
>>                     .useDeployFolder(false),
>>             keepRuntimeFolder(),
>>             configureConsole().ignoreLocalConsole(),
>>             logLevel(LogLevelOption.LogLevel.INFO),
>>             features(maven().groupId("org.apache.karaf.features")
>>                             .artifactId("enterprise")
>>                             .version(karafVersion)
>>                             .classifier("features")
>>                             .type("xml"),
>>                     "hibernate-validator"),
>>             when(karafDebug).useOptions(debugConfiguration()),
>>             junitBundles(),
>>             systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
>>
>> systemProperty("org.ops4j.pax.exam.rbc.rmi.host").value("localhost")
>>     );
>> }

Re: hibernate validator feature

Posted by James Carman <ja...@carmanconsulting.com>.
I usually do not try to work with hibernate validator that way. I expose
OSGi services. When I am at a computer later, I can show you an example.

On Sat, Nov 7, 2015 at 2:29 PM Benson Margulies <be...@basistech.com>
wrote:

> I created a simple pax-exam test of the hibernate-validator feature, and I
> get:
>
> javax.validation.ValidationException: Unable to create a
> Configuration, because no Bean Validation provider could be found. Add
> a provider like Hibernate Validator (RI) to your classpath.
>
> Any suggestions?
>
> @ProbeBuilder
> public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
>     probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*");
>     return probe;
> }
>
> @Configuration
> public Option[] configure() throws Exception {
>     loadProps();
>     karafDebug = false;
>
>     return options(karafDistributionConfiguration()
>                     .frameworkUrl(
>                             maven()
>                                     .groupId("org.apache.karaf")
>                                     .artifactId("apache-karaf")
>                                     .type("zip")
>                                     .version(karafVersion))
>                     .karafVersion(karafVersion).name("Apache Karaf")
>                     .unpackDirectory(new File("target/pax"))
>                     .useDeployFolder(false),
>             keepRuntimeFolder(),
>             configureConsole().ignoreLocalConsole(),
>             logLevel(LogLevelOption.LogLevel.INFO),
>             features(maven().groupId("org.apache.karaf.features")
>                             .artifactId("enterprise")
>                             .version(karafVersion)
>                             .classifier("features")
>                             .type("xml"),
>                     "hibernate-validator"),
>             when(karafDebug).useOptions(debugConfiguration()),
>             junitBundles(),
>             systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
>
> systemProperty("org.ops4j.pax.exam.rbc.rmi.host").value("localhost")
>     );
> }
>