Class loading with JBoss

I want to use the latest version of sleep mode inside the ear without updating the banks on the server. I follow the instructions given here - http://jaitechwriteups.blogspot.com/2008/08/how-to-upgrade-hibernate-in-jboss.html .

However, the problem now is that the application does not load jboss-local-jdbc.rar in the deployment folder.

2009-07-21 09:01:50,347 INFO [org.jboss.system.ServiceConfigurator] Problem configuring service jboss.jca:service=DataSourceBinding,name=MockDS org.jboss.deployment.DeploymentException: Exception setting attribute ConnectionManager = jboss.jca:service=LocalTxCM,name=MockDS on mbean jboss.jca:service=DataSourceBinding,name=MockDS; - nested throwable: (javax.management.InvalidAttributeValueException: Set attribute has class class javax.management.ObjectName loaded from null that is not assignable to attribute class class javax.management.ObjectName loaded from org.jboss.mx.loading.UnifiedClassLoader3@1babddb { url=file:/C:/servers/jboss-4.2.2.GA/server/default/tmp/deploy/tmp22267hibernate_upgrade_test.ear ,addedOrder=43}) at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:707) at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:382) at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:462) at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:171) at org.jboss.system.ServiceController.install(ServiceController.java:226) at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 

Any idea?

+3
source share
4 answers

I had a check using the instructions on this page, and it basically follows the same steps as mine. The critical difference is apparently in the contents of its jboss-app.xml :

 <jboss-app> <loader-repository> org.myapp:loader=SomeClassloader <loader-repository-config> java2ParentDelegation=false </loader-repository-config> </loader-repository> </jboss-app> 

My system does not disable parent delegation, it only has a bootloader name:

 <jboss-app> <loader-repository>org.myapp:loader=MyAppName</loader-repository> </jboss-app> 

You can (or cannot) also set the Isolated = true attribute in the JBoss deploy/ear-deployer.xml :

And it works well. By disabling parent delegation, you are impairing the ability of your application to interact with the container in any way, which is a bit extreme. If you do not consider this option, yak shaving is required .

If you leave the java2ParentDelegation=false parameter, you get a situation where any classes in the EAR that have the same name as the classes in JBoss will be loaded mainly from the EAR (which is good). However, any classes not found in the EAR will fall into JBoss libs. In the case of jboss-local-jdbc.rar this is good. However, it can have special side effects.

For example, when Hibernate creates a factory session, it searches for the Hibernate Search and Hibernate Validator libraries and tries to start them. If they are not in your EAR, they will find them in JBoss libs. The problem is that you often get a linker error, because the versions of Search and Validator that come with JBoss may not be compatible with Hibernate packaged in your EAR.

The solution to this is either to set up a Hibernate factory session to disable the registration of Search and Validator listeners using the configuration properties ( hibernate.validator.autoregister_listeners=false and hibernate.search.autoregister_listeners=false ), or to pack compatible versions of Search and Validator in your EAR as well .

+7
source

Jerrish

It seems you are packing a jar containing javax.management classes. * in your application packaging. Remove this jar from the application packaging (as it is already shipped to JBoss AS).

+1
source

I am using the jboss-classloading.xml , which is designed to load classes. The syntax is more natural than the jboss-app.xml for me. See http://phytodata.wordpress.com/2010/10/21/demystifying-the-jboss5-jboss-classloading-xml-file/ for details.

0
source

Why don't you just remove sleep mode on jboss application server?

-1
source

Source: https://habr.com/ru/post/1434968/


All Articles