Re: [jboss-user] [JBoss Microcontainer Development] - ClassPool bootstrap refactoring
by Kabir Khan
Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] replied to the discussion
"ClassPool bootstrap refactoring"
To view the discussion, visit: http://community.jboss.org/message/539493#539493
--------------------------------------------------------------
AbstractMCServerBase now does (once it is working properly I will move the extra code to LifecycleEventListeners)
@Override
protected void doInitialize() throws IllegalStateException, InvalidConfigurationException, LifecycleEventException
{
// NEW CODE - 1
/*
* Make sure we have the correct classpools set up
*/
//Initialize jboss-reflect to use the correct classpools
JBossClClassPoolConfig config = JBossClClassPoolConfig.getInstance();
RepositoryClassPoolFactory factory = new RepositoryClassPoolFactory(config.getClassPoolRepository());
JavassistTypeInfoFactoryImpl.setPoolFactory(factory);
// NEW CODE - 1 - END
/*
* We need to start the bootstrap here so we can set the kernel
* before we fire start kernel events
*/
this.initializeBootstrap();
// Call Super implementation
super.doInitialize();
// NEW CODE - 2
//Install the bean configuring the classpools
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("JBossClClassPoolConfig", JBossClClassPoolConfig.class.getName());
builder.setFactoryClass(JBossClClassPoolConfig.class.getName());
builder.setFactoryMethod("getInstance");
ValueMetaData inject = builder.createContextualInject(null, null, AutowireType.BY_NAME, InjectOption.CALLBACK);
//TODO add name to BeanMetaDataBuilder
((AbstractInjectionValueMetaData)inject).setValue("ClassLoading");
builder.addPropertyMetaData("classLoading", inject);
try
{
getKernel().getController().install(builder.getBeanMetaData());
}
catch (Throwable e)
{
// AutoGenerated
throw new RuntimeException(e);
}
// NEW CODE - 2 - END
}
The stuff in 1) sets up the classloader system so it understands the bootstrap classloaders
The stuff in 2) "listens" for ClassLoading and registers the container as a module Handler
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539493#539493]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years
[Beginner's Corner] - JBoss + SPECjEnterprise2010 (or how to patch hibernate)
by Christian Heupel
Christian Heupel [http://community.jboss.org/people/chrisheup] created the discussion
"JBoss + SPECjEnterprise2010 (or how to patch hibernate)"
To view the discussion, visit: http://community.jboss.org/message/539486#539486
--------------------------------------------------------------
Hello together,
I am currently trying to deploy the SPECjEnterprise2010 Benchmark on an JBoss Application-Server and I'm facing some Problems for which I hoped I could get a push in the right direction to solve them here (I should probably notice, that I opened the thread in this section because I indeed am a beginner when it comes to JBoss, SPEC and even EJB, maybe it would be better placed in the "deployment section" or in a hibernate-forum - as you will see).
I have tried to deploy it on the server versions 5.0.1, 5.1.0 and 6-M2, but with all of them I am facing deployment problems caused by hibernate errors.
A readme-file attached to SPEC then pointed out, that there will be deployment problems with JBoss and that a patch of hibernate would be necessary.
I have downloaded the hibernate sources, i have used the provided patches for this issue (Patch-Nr. is HHH-4552) to change the necessary files. Now my problem is, that I don't really know how to apply this patch to the used JBoss Application-Server since I find myself unable to reproduce the structure I find in the thirdparty-folder and even cannot find some of the patched files in one of the hibernate jars which are used there.
So my questions are to the point:
1) Has anyone accomplished to successfully deploy SPECjEnterprise2010 on a JBoss Application-Server and could give me a hint on what to do here?
2) Can someone please tell me how to use the patch correctly in order to not only alter the hibernate-sources, but to also integrate them in the AS?
3) Am I at the right place for these questions here? :)
Thanks a lot for any answers in advance!!,
Chris
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539486#539486]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years
Re: [jboss-user] [JBoss Microcontainer Development] - JBREFLECT-5 - Implementing generics in JavassistClassInfo
by Kabir Khan
Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] replied to the discussion
"JBREFLECT-5 - Implementing generics in JavassistClassInfo"
To view the discussion, visit: http://community.jboss.org/message/539484#539484
--------------------------------------------------------------
Having revisited how the classpools are set up ( http://community.jboss.org/thread/151095 http://community.jboss.org/thread/151095) which became apparent after looking into ( http://community.jboss.org/message/538568#538568 http://community.jboss.org/message/538568#538568) and fixed the problems to do with generating accessors for classes loaded by a parent of the jboss-reflect classloader I now end up with the following problems when starting AS:
Failed to boot JBoss:
java.lang.Exception: Encountered exception in server startup
at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.bootstrapMcAndDescriptors(AbstractMCServerBase.java:360)
at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.doStart(AbstractMCServerBase.java:292)
at org.jboss.bootstrap.impl.as.server.AbstractJBossASServerBase.doStart(AbstractJBossASServerBase.java:381)
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:413)
at java.lang.Thread.run(Thread.java:637)
Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: java.lang.IllegalStateException: java.lang.ClassNotFoundException: org.jboss.beans.metadata.spi.AnnotationMetaData
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployment.annotations
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployment
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:195)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:175)
at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:161)
at org.jboss.bootstrap.impl.mc.deployer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:188)
at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.bootstrapMcAndDescriptors(AbstractMCServerBase.java:345)
... 4 more
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: java.lang.IllegalStateException: java.lang.ClassNotFoundException: org.jboss.beans.metadata.spi.AnnotationMetaData
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployment.annotations
at org.jboss.kernel.plugins.deployment.AbstractKernelDeployment
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.rethrowWithLocation(JBossXBNoSchemaBuilder.java:2293)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:428)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElements(JBossXBNoSchemaBuilder.java:403)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.build(JBossXBNoSchemaBuilder.java:273)
at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:336)
at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:222)
at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:201)
at org.jboss.xb.binding.resolver.AbstractMutableSchemaResolver.resolve(AbstractMutableSchemaResolver.java:315)
at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:177)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.startElement(SaxJBossXBParser.java:370)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:191)
... 8 more
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: java.lang.ClassNotFoundException: org.jboss.beans.metadata.spi.AnnotationMetaData
at org.jboss.reflect.plugins.javassist.JavassistParameterizedClassInfo.findTypeInfo(JavassistParameterizedClassInfo.java:153)
at org.jboss.reflect.plugins.javassist.JavassistParameterizedClassInfo.getComponentType(JavassistParameterizedClassInfo.java:121)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.bindProperty(JBossXBNoSchemaBuilder.java:1447)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateType(JBossXBNoSchemaBuilder.java:1231)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:855)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateBean(JBossXBNoSchemaBuilder.java:843)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.generateTypeBinding(JBossXBNoSchemaBuilder.java:604)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.resolveTypeBinding(JBossXBNoSchemaBuilder.java:563)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createElementBinding(JBossXBNoSchemaBuilder.java:443)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.createRootElementBinding(JBossXBNoSchemaBuilder.java:423)
... 28 more
Caused by: java.lang.IllegalStateException: java.lang.ClassNotFoundException: org.jboss.beans.metadata.spi.AnnotationMetaData
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.getTypeInfo(JavassistTypeInfoFactoryImpl.java:852)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.createTypeInfoForTypeArgument(JavassistTypeInfoFactoryImpl.java:910)
at org.jboss.reflect.plugins.javassist.JavassistParameterizedClassInfo.getActualTypeArguments(JavassistParameterizedClassInfo.java:110)
at org.jboss.reflect.plugins.javassist.JavassistParameterizedClassInfo.findTypeInfo(JavassistParameterizedClassInfo.java:149)
... 37 more
Caused by: java.lang.ClassNotFoundException: org.jboss.beans.metadata.spi.AnnotationMetaData
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.delegateToIntrospectionImplementation(JavassistTypeInfoFactoryImpl.java:608)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.get(JavassistTypeInfoFactoryImpl.java:564)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.get(JavassistTypeInfoFactoryImpl.java:455)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.get(JavassistTypeInfoFactoryImpl.java:412)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.getTypeInfo(JavassistTypeInfoFactoryImpl.java:848)
... 40 more
Posting Shutdown Request to the server...
The problem here is for parameterized type infos. We currently use the type info of the raw type for the whole parameterized type which will not work for things like java.util.Set<org.jboss.beans.metadata.spi.AnnotationMetaData> since the raw type (Set) comes from the system classpath and thus cannot see the actual type argument classes (AnnotationMetaData is further down in the classloader hierarchy).
Parameterized type infos will need to be cached differently, I'll look at how these are handled in plain java across different classloaders.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539484#539484]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years
Re: [jboss-user] [JBoss Microcontainer Development] - JBREFLECT-6 Skipping compilation step
by Kabir Khan
Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] replied to the discussion
"JBREFLECT-6 Skipping compilation step"
To view the discussion, visit: http://community.jboss.org/message/539482#539482
--------------------------------------------------------------
Having revisited how the classpools are set up ( http://community.jboss.org/thread/151095 http://community.jboss.org/thread/151095) which became apparent after looking into ( http://community.jboss.org/message/538568#538568 http://community.jboss.org/message/538568#538568) I got some problems such as
10:59:48,915 WARN [PropertyConfiguration] Factory: org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory@55ad6c98
XmlRootElement java.net.URLClassLoader@9a082e2
Failed to boot JBoss:
java.lang.Exception: Encountered exception in server startup
at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.bootstrapMcAndDescriptors(AbstractMCServerBase.java:360)
at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.doStart(AbstractMCServerBase.java:292)
at org.jboss.bootstrap.impl.as.server.AbstractJBossASServerBase.doStart(AbstractJBossASServerBase.java:381)
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:413)
at java.lang.Thread.run(Thread.java:637)
Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: java.lang.RuntimeException: Error retrieving annotation attribute values
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:195)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:175)
at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:161)
at org.jboss.bootstrap.impl.mc.deployer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:188)
at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.bootstrapMcAndDescriptors(AbstractMCServerBase.java:345)
... 4 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Error retrieving annotation attribute values
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.getAnnotations(JavassistTypeInfoFactoryImpl.java:699)
at org.jboss.reflect.plugins.javassist.JavassistInheritableAnnotationHolder.getAnnotations(JavassistInheritableAnnotationHolder.java:78)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfo.getAnnotations(JavassistTypeInfo.java:790)
at org.jboss.reflect.plugins.javassist.JavassistInheritableAnnotationHolder.getAnnotation(JavassistInheritableAnnotationHolder.java:91)
at org.jboss.reflect.plugins.AbstractAnnotatedInfo.getUnderlyingAnnotation(AbstractAnnotatedInfo.java:55)
at org.jboss.xb.builder.JBossXBBuilder.initSchema(JBossXBBuilder.java:351)
at org.jboss.xb.builder.JBossXBNoSchemaBuilder.build(JBossXBNoSchemaBuilder.java:271)
at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:336)
at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:222)
at org.jboss.xb.builder.JBossXBBuilder.build(JBossXBBuilder.java:201)
at org.jboss.xb.binding.resolver.AbstractMutableSchemaResolver.resolve(AbstractMutableSchemaResolver.java:315)
at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:177)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.startElement(SaxJBossXBParser.java:370)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:191)
... 8 more
Caused by: java.lang.RuntimeException: Error retrieving annotation attribute values
at org.jboss.reflect.plugins.AnnotationValueFactory.createAnnotationValue(AnnotationValueFactory.java:124)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.getAnnotations(JavassistTypeInfoFactoryImpl.java:693)
... 32 more
Caused by: java.lang.RuntimeException: Error creating JavassistMethod for javax.xml.bind.annotation.XmlRootElement with classloader sun.misc.Launcher$AppClassLoader@517590db
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.toClass(JavassistMemberFactory.java:316)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.makeClass(JavassistMemberFactory.java:289)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.createJavassistMethod(JavassistMemberFactory.java:197)
at org.jboss.reflect.plugins.javassist.JavassistReflectionFactory.createMethod(JavassistReflectionFactory.java:200)
at org.jboss.reflect.plugins.javassist.JavassistMethodInfo.invoke(JavassistMethodInfo.java:114)
at org.jboss.reflect.plugins.SecurityActions.invokeMethod(SecurityActions.java:78)
at org.jboss.reflect.plugins.AnnotationValueFactory.createAnnotationValue(AnnotationValueFactory.java:117)
... 33 more
Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: org/jboss/reflect/plugins/javassist/JavassistMethod
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:136)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.toClass(JavassistMemberFactory.java:298)
... 39 more
Caused by: java.lang.NoClassDefFoundError: org/jboss/reflect/plugins/javassist/JavassistMethod
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:698)
at java.lang.ClassLoader.defineClass(ClassLoader.java:544)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163)
... 41 more
Caused by: java.lang.ClassNotFoundException: org.jboss.reflect.plugins.javassist.JavassistMethod
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
... 49 more
This turned out to be due to javax.xml.bind.annotation.XmlRootElement coming from the system classloader while the jboss-reflect classes coming from a child classloader. It was set up to always use the classloader of the class we are creating an accessor for. I have changed it to still do that apart from if the class comes from a parent classloader of the jboss-reflect one, in which case we use the jboss-reflect classloader.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539482#539482]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years