Re: [jboss-dev-forums] [JBoss Microcontainer Development] - Issues using Javassist TypeInfoFactory in other projects
by Kabir Khan
Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] replied to the discussion
"Issues using Javassist TypeInfoFactory in other projects"
To view the discussion, visit: http://community.jboss.org/message/534604#534604
--------------------------------------------------------------
I am also seeing this
java.lang.IllegalArgumentException: Cannot set accessible on method info: JavassistMethodInfo@5578920a{name=privMain}
at org.jboss.test.kernel.deployment.support.StaticInjector.injectToMethod(StaticInjector.java:76)
at org.jboss.test.kernel.deployment.support.StaticInjector.injectToNonPublicMethod(StaticInjector.java:59)
at org.jboss.test.kernel.deployment.test.BeanContainerStaticTestCase.testStaticInjection(BeanContainerStaticTestCase.java:53)
private void injectToMethod(Class<?> clazz, String method, Object value, Class<?> signature, boolean isPublic) throws Throwable
{
ClassInfo classInfo = configurator.getClassInfo(clazz);
MethodInfo mi = Config.findMethodInfo(classInfo, method, new String[]{signature.getName()}, true, isPublic);
if (isPublic == false)
{
// TODO - move this into Reflection?
if (mi instanceof ReflectMethodInfoImpl)
{
ReflectMethodInfoImpl rmi = (ReflectMethodInfoImpl)mi;
Method m = rmi.getMethod();
m.setAccessible(true);
}
else
throw new IllegalArgumentException("Cannot set accessible on method info: " + mi);
}
mi.invoke(null, new Object[]{value});
}
If we moved the setAccessible() stuff to jboss-reflect as indicated in the comment, we could manage the accessibility of members there?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/534604#534604]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 11 months
Re: [jboss-dev-forums] [JBoss Microcontainer Development] - Issues using Javassist TypeInfoFactory in other projects
by Kabir Khan
Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] replied to the discussion
"Issues using Javassist TypeInfoFactory in other projects"
To view the discussion, visit: http://community.jboss.org/message/534602#534602
--------------------------------------------------------------
Another issue is that dynamically created classes are not found in the classpools.
Dynamic proxies are not found at all:
0 DEBUG [JDKLazyInstantiationTestCase] ==== setUp org.jboss.test.kernel.lazy.test.JDKLazyInstantiationTestCase ====
5 DEBUG [JDKLazyInstantiationTestCase] ==== Starting testLazy ====
20 DEBUG [KernelFactory] Starting JBoss Kernel construction...
53 WARN [PropertyConfiguration] Factory: org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory@4393722c
466 DEBUG [KernelFactory] Completed JBoss Kernel construction. Duration: 446 milliseconds
568 ERROR [AbstractKernelController] Error installing to Instantiated: name=beanProxy state=Described
java.lang.RuntimeException: Class not found: $Proxy0
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.get(JavassistTypeInfoFactoryImpl.java:311)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.getTypeInfo(JavassistTypeInfoFactoryImpl.java:519)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory.getTypeInfo(JavassistTypeInfoFactory.java:51)
at org.jboss.classadapter.plugins.BasicClassAdapterFactory.getClassAdapter(BasicClassAdapterFactory.java:54)
Neither are the javassist ProxyFactory proxies, since they just define the class in the classloader with no way to find them from the pools:
0 DEBUG [JavassistLazyInstantiationTestCase] ==== setUp org.jboss.test.kernel.lazy.test.JavassistLazyInstantiationTestCase ====
3 DEBUG [JavassistLazyInstantiationTestCase] ==== Starting testLazy ====
18 DEBUG [KernelFactory] Starting JBoss Kernel construction...
47 WARN [PropertyConfiguration] Factory: org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory@4393722c
514 DEBUG [KernelFactory] Completed JBoss Kernel construction. Duration: 496 milliseconds
618 ERROR [AbstractKernelController] Error installing to Instantiated: name=beanProxy state=Described
java.lang.RuntimeException: Class not found: org.jboss.test.kernel.lazy.support.IRare_$$_javassist_0
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.get(JavassistTypeInfoFactoryImpl.java:311)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl.getTypeInfo(JavassistTypeInfoFactoryImpl.java:519)
at org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory.getTypeInfo(JavassistTypeInfoFactory.java:51)
at org.jboss.classadapter.plugins.BasicClassAdapterFactory.getClassAdapter(BasicClassAdapterFactory.java:54)
In AOP what we did was to write the class bytes to the in memory vfs location from the aop classpools, so that when trying to look up the CtClass later there is a resource path for the class bytes:
URL outputURL = new URL(tempURL.toString() + "/" + classFileName);
//Write the classfile to the temporary url
synchronized (tmplock)
{
if (trace) logger.trace(this + " " + pool + ".toClass() myloader:" + myloader + " writing bytes to " + tempURL);
ByteArrayOutputStream byteout = new ByteArrayOutputStream();
BufferedOutputStream out = new BufferedOutputStream(byteout);
out.write(cc.toBytecode());
out.flush();
out.close();
byte[] classBytes = byteout.toByteArray();
MemoryContextFactory factory = MemoryContextFactory.getInstance();
factory.putFile(outputURL, classBytes);
Going to check with Chiba, but I'll see if I can modify javassist to allow ProxyFactory and ProxyFactoryHelper to accept an interface like
interface ByteRecorder{
void writeBytes(String classname, byte[]) throws IOException
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/534602#534602]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 11 months
Re: [jboss-dev-forums] [JCA Development] - JcaXAResourceRecovery
by Ivo Studenský
Ivo Studenský [http://community.jboss.org/people/istudens%40redhat.com] replied to the discussion
"JcaXAResourceRecovery"
To view the discussion, visit: http://community.jboss.org/message/534595#534595
--------------------------------------------------------------
The crash recovery tests are automated in the AS testsuite as an optional task, see testsuite/imports/config/tests-crash-recovery.xml and https://jira.jboss.org/jira/browse/JBAS-7219 JBAS-7219. They are included in both, the EAP5 branch and trunk.
Currently, the recovery tests run against selected databases inside the redhat network, namely PostgreSQL 8.2 and 8.3, Oracle 10g and 11g, Sybase 15, DB2 9.7, MSSQL 2005 and 2008, MySQL 5.0 and 5.1, i.e. supported db's for EAP. They don't use Derby at the moment.
The current tests involve only XA-datasource for each supported db in crash recovery and there is a question what other types of JCA XA resources they could involve into the recovery testing. It is subject for discussion.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/534595#534595]
Start a new discussion in JCA Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 11 months
Re: [jboss-dev-forums] [JBoss Microcontainer Development] - On demand resolution
by Adrian Brock
Adrian Brock [http://community.jboss.org/people/adrian%40jboss.org] replied to the discussion
"On demand resolution"
To view the discussion, visit: http://community.jboss.org/message/534591#534591
--------------------------------------------------------------
> Ales Justin wrote:
>
> > I created a test for DynamicImport-Package to check whether https://jira.jboss.org/jira/browse/JBCL-131 https://jira.jboss.org/jira/browse/JBCL-131 is actually working at the OSGi layer.
> I fail to see how dynamic import and JBCL-131 are related?
> JBCL-131 is an impl of OSGi' lazy bundle activation -- e.g. only invoke BundleActivator if some class from that bundle needs to be loaded.
Well actually JBCL-131 is about lazy resolve, not lazy start.
It's not working because it hasn't been enabled.
I've committed the following patch which makes it work using Ales's DeploymentMetaData
(I've not done anything with lazy start).
I don't know if that is the correct place for it?
Another question is whether you always want to enable lazy resolve for OSGi, even if the user specifies something else?
P.S. There's no point re-opening issues in closed releases. You need to raise new issues.
/core/src/main/java/org/jboss/osgi/framework/deployers
$ svn diff
Index: AbstractClassLoadingDeployer.java
===================================================================
--- AbstractClassLoadingDeployer.java (revision 103238)
+++ AbstractClassLoadingDeployer.java (working copy)
@@ -29,6 +29,7 @@
import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
import org.jboss.classloading.spi.metadata.RequirementsMetaData;
+import org.jboss.deployers.plugins.classloading.DeploymentMetaData;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
@@ -61,7 +62,10 @@
{
super(OSGiMetaData.class);
addInput(AbstractBundleState.class);
- setOutput(ClassLoadingMetaData.class);
+ addInput(ClassLoadingMetaData.class);
+ addInput(DeploymentMetaData.class);
+ addOutput(ClassLoadingMetaData.class);
+ addOutput(DeploymentMetaData.class);
setStage(DeploymentStages.POST_PARSE);
setTopLevelOnly(true);
}
@@ -79,6 +83,13 @@
@Override
public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
{
+ if (unit.isAttachmentPresent(DeploymentMetaData.class) == false)
+ {
+ DeploymentMetaData deploymentMetaData = new DeploymentMetaData();
+ deploymentMetaData.setLazyResolve(true);
+ unit.addAttachment(DeploymentMetaData.class, deploymentMetaData);
+ }
+
if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
return;
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/534591#534591]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 11 months