[hibernate-dev] How to enable Javassist when running a WildFly unit test?

Guillaume Smet guillaume.smet at gmail.com
Mon Aug 27 09:52:55 EDT 2018


So, the system properties are not considered when running with the security
manager.

Log says:
Could not copy system properties, system properties will be ignored

And the code is the following:
try {
    Properties systemProperties = System.getProperties();
    // Must be thread-safe in case an application changes System properties
during Hibernate initialization.
    // See HHH-8383.
    synchronized ( systemProperties ) {
        GLOBAL_PROPERTIES.putAll( systemProperties );
    }
}
catch (SecurityException se) {
    LOG.unableToCopySystemProperties();
}

As the System.getProperties() call is not in a privileged block, it fails.

Not sure if it's a bug or a feature.

-- 
Guillaume

On Mon, Aug 27, 2018 at 3:18 PM Scott Marlow <smarlow at redhat.com> wrote:

> Better to use WildFly -secmgr option, instead of -Dsecurity.manager.
>  From what I recall, this helps avoid a boot time issue with
> -Dsecurity.manager.
>
> For enabling javassist for a one off test run, simply prestart your
> WildFly app server with the desired options and then launch.
>
> For more than a one off, find the arquillian.xml being used, for example
> wildfly/testsuite/integration/basic/src/test/config/arq/arquillian.xml
> and see if you can update the:
>
>    <property name="javaVmArguments">${server.jvm.args}</property>
>
> Perhaps you could try presetting setting server.jvm.args to
> -Dhibernate.bytecode.provider=javassist
>
> Scott
>
> On 08/27/2018 07:20 AM, Martin Simka wrote:
> > Hi Gail,
> >
> > mvn clean test -Dtest=HibernateNativeAPINaturalIdTestCase
> > -Dextra.server.jvm.args="-Dhibernate.bytecode.provider=javassist"
> > -Dsecurity.manager=true
> >
> > should do it. But I still see ByteBuddy in the stacktrace. I also tried
> to
> > add property directly to WildFly configuration file or to
> hibernate.cfg.xml
> > with the same result.
> >
> > Martin
> >
> > On Sat, Aug 25, 2018 at 11:28 PM Gail Badner <gbadner at redhat.com> wrote:
> >
> >> To clarify, I'm trying to enable javassist on WildFly 14.
> >>
> >> On Fri, Aug 24, 2018 at 8:54 PM, Gail Badner <gbadner at redhat.com>
> wrote:
> >>
> >>> I tried running:
> >>>
> >>> mvn clean test -Dtest=HibernateNativeAPINaturalIdTestCase
> >>> -Dhibernate.bytecode.provider=javassist -Dsecurity.manager=true
> >>>
> >>> The result is a permissions failure, and ByteBuddy is in the
> stacktrace.
> >>>
> >>> I also tried adding the property to the StandardServiceRegistryBuilder
> >>> built by SFSBHibernateSFNaturalId, and that didn't work either.
> >>>
> >>> Is there some other way to enable javassist?
> >>>
> >>> Thanks,
> >>> Gail
> >>>
> >> _______________________________________________
> >> hibernate-dev mailing list
> >> hibernate-dev at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >>
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list