开发者

Glassfish 3.1.1 CDI Classloader delegate false

开发者 https://www.devze.com 2023-03-23 05:33 出处:网络
My main problem is that I want to use myfaces jsf implementation and because of that, I have to use delegate=false in glassfish-web.xml. This ends up in loading classes from my application first and t

My main problem is that I want to use myfaces jsf implementation and because of that, I have to use delegate=false in glassfish-web.xml. This ends up in loading classes from my application first and then look at the server libraries.

When I use hibernate, I have the problem with javassist that the version 3.14.0-GA bundled with osgi-weld and the 3.14.0-GA I defined in my pom.xml are different. I also tried to remove the entry from my pom.xml (excluded all transitive dependencies to javassist) but it won't work. The exception is a bit strange.

SCHWERWIEGEND: Exception while loading the app : org.jboss.weldx.transaction.org$jboss$weld$bean-WEB-INF$lib$seam-international-3$0$0$Final-Built-in-UserTransaction_$$_WeldProxy cannot be cast to javassist.util.proxy.ProxyObject
java.lang.ClassCastException: org.jboss.weldx.transaction.org$jboss$weld$bean-WEB-INF$lib$seam-international-3$0$0$Final-Built-in-UserTransaction_$$_WeldProxy cannot be cast to javassist.util.proxy.ProxyObject
    at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:222)
    at org.jboss.weld.bean.builtin.ee.AbstractEEBean.<init>(AbstractEEBean.java:46)
    at org.jboss.weld.bean.builtin.ee.UserTransactionBean.<init>(UserTransactionBean.java:60)
    at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:199)
    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(W开发者_运维技巧eldBootstrap.java:370)
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
    at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:270)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
    at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:662)

How can I solve this problem?


just put javassist-3.14.0-GA.jar in GLASSFISH_HOME\domains\domain1\lib and dont include it in your application classpath, if you use maven mark the dependency as provided

<dependency>
     <groupId>org.javassist</groupId>
     <artifactId>javassist</artifactId>
     <version>3.14.0-GA</version>
     <scope>provided</scope>
</dependency>


The following Ticket describes the problem: https://issues.jboss.org/browse/WELD-570

The Javassist Classes live the bundle mentioned above: glassfish/modules/weld-osgi-bundle.jar

Our preliminary solution was to change the

<class-loader delegate="true" />

in our glassfish-web.xml.

If you are using javassist for hibernate, this article suggests you switch to the alternative Byte Code Provider CGLIB: http://www.java.net/node/705285

If you are using Hibernate over JPA, you may be able to switch using Glassfish's Hibernate: https://blogs.oracle.com/GlassFishPersistence/entry/using_hibernate_as_jpa_provider

0

精彩评论

暂无评论...
验证码 换一张
取 消