[Javassist user questions] - Re: adding annotations
by cat4hire
I've made another experiment: using an AnnotationsWriter as follows does not work too:
|
| ByteArrayOutputStream aos = new ByteArrayOutputStream();
| AnnotationsWriter aw = new AnnotationsWriter(aos, constantPool);
| aw.numAnnotations(1);
| aw.annotation(this.annotationClassName, 0);
| aw.close();
| byte ab[] = aos.toByteArray();
| attribute = new AnnotationsAttribute(constantPool, AnnotationsAttribute.visibleTag, ab);
|
| System.out.println("Annotation attribute " + attribute.getName() + " " + attribute.getAnnotations().length);
| classFile.addAttribute( attribute );
|
The class can be loaded and instantiated, but I cannot access its annotations.
In both cases, if I print the classfile content with a ClassFileWriter I got a message that lets me think I've got the annotations:
| attribute: SourceFile (2 byte): javassist.bytecode.SourceFileAttribute
| attribute: RuntimeVisibleAnnotations (6 byte): javassist.bytecode.AnnotationsAttribute
|
Moreover, in the case in which I use an AnnotationsWriter I got the following run-time exception when I try to access the annotations thru the Class.getAnnotations() method:
| Exception in thread "Thread-Example-Main" java.lang.reflect.GenericSignatureFormatError
| at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:103)
| at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:233)
| at sun.reflect.generics.parser.SignatureParser.parseTypeSignature(SignatureParser.java:359)
| at sun.reflect.generics.parser.SignatureParser.parseTypeSig(SignatureParser.java:157)
| at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:367)
| at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:181)
| at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
| at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
| at java.lang.Class.initAnnotationsIfNecessary(Class.java:3072)
| at java.lang.Class.getAnnotations(Class.java:3052)
|
I cannot find whre I'm doing something wrong.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133207#4133207
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133207
17 years, 2 months
[JBoss jBPM] - Re: Less coding by custom nodes/jrules/etc...
by pojomonkey
"kukeltje" wrote : See http://docs.jboss.com/jbpm/v3/userguide/jpdl.html#configurationofdelegations
|
| How you parse the content of what is in there is completely up to the developer
I had another look at that and came up with the following:
<process-definition xmlns="" name="TestProcess">
|
| <start-state name="startstate">
|
| <transition to="node1" name="ok">
| <action name="Test1" class="TestHandler" config-type="constructor">
| <blob>This is some constructor config data</blob>
| </action>
| <action name="Test2" class="TestHandler" config-type="field">
| <blob>This is some field config data</blob>
| </action>
| <action name="Test3" class="TestHandler" config-type="bean">
| <blob>This is some bean config data</blob>
| </action>
| </transition>
| </start-state>
|
| <node name="node1">
| <transition to="end"></transition>
| </node>
| <end-state name="end"></end-state>
| </process-definition>
and
import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
| import org.jbpm.graph.def.ActionHandler;
| import org.jbpm.graph.exe.ExecutionContext;
|
| public class TestHandler implements ActionHandler
| {
| private static Log log = LogFactory.getLog(TestHandler.class);
|
| public String blob;
|
| public TestHandler()
| {
| log.debug("Default constructor");
| blob = "default";
| }
|
| public TestHandler(String xml)
| {
| this();
|
| log.debug("Config constructor");
|
| configure(xml);
| }
|
| public void configure(String xml)
| {
| log.debug("Parse: " + xml.trim());
| }
|
| public void setBlob(String blob)
| {
| log.debug("Setter");
| this.blob = blob;
| }
|
| public void execute(ExecutionContext executionContext) throws Exception
| {
| log.debug("Execute: " + blob);
| }
|
| }
|
Hope that helps :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133178#4133178
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133178
17 years, 2 months
[JCA/JBoss] - Re: Oracle DS
by Artec
"vicky.kak(a)jboss.com" wrote : "Artec" wrote : Hi vickyk, and thanks for your answer.
| | Ok for the first question !
| | For the second instead i attach you the part of the stacktrace above the error that i've past yesterday
| |
| | 2008-02-29 00:00:36,823 INFO [org.jboss.resource.connectionmanager.TxConnectionManager] Starting
| | 2008-02-29 00:00:36,835 INFO [org.jboss.security.plugins.JaasSecurityManagerService] Created securityMgr=org.jboss.security.
| | plugins.JaasSecurityManager@196bac4
| | 2008-02-29 00:00:36,836 INFO [org.jboss.security.plugins.JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedC
| | achePolicy@bfd10a
| | 2008-02-29 00:00:36,836 INFO [org.jboss.security.plugins.JaasSecurityManagerService] Added HsqlDbRealm, org.jboss.security.p
| | lugins.SecurityDomainContext@1352367 to map
| | 2008-02-29 00:00:36,843 INFO [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.DefaultDS] Bound connectio
| | n factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=DefaultDS to JNDI name 'java:/DefaultD
| | S'
| | 2008-02-29 00:00:36,843 INFO [org.jboss.resource.connectionmanager.TxConnectionManager] Started
| | 2008-02-29 00:00:36,843 INFO [org.jboss.mq.pm.jdbc2.PersistenceManager] Starting
| |
| | ...and so, the error is in the defaultds,right ?? and not in my oracle-ds ??
| | I don't use hypersonic !
| |
| | Thanks
| | Davide
| Where is the error , these are just log statements ?
|
the complete stacktrace is
2008-02-29 00:00:36,835 INFO [org.jboss.security.plugins.JaasSecurityManagerService] Created securityMgr=org.jboss.security.
plugins.JaasSecurityManager@196bac4
2008-02-29 00:00:36,836 INFO [org.jboss.security.plugins.JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedC
achePolicy@bfd10a
2008-02-29 00:00:36,836 INFO [org.jboss.security.plugins.JaasSecurityManagerService] Added HsqlDbRealm, org.jboss.security.p
lugins.SecurityDomainContext@1352367 to map
2008-02-29 00:00:36,843 INFO [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.DefaultDS] Bound connectio
n factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=DefaultDS to JNDI name 'java:/DefaultD
S'
2008-02-29 00:00:36,843 INFO [org.jboss.resource.connectionmanager.TxConnectionManager] Started
2008-02-29 00:00:36,843 INFO [org.jboss.mq.pm.jdbc2.PersistenceManager] Starting
2008-02-29 00:00:42,942 ERROR [org.jboss.mq.pm.jdbc2.PersistenceManager] Starting failed
org.jboss.mq.SpyJMSException: Could not resolve uncommited transactions. Message recovery may not be accurate; - nested thro
wable: (org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: Connectio
n is broken: Connection refused); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection
; - nested throwable: (java.sql.SQLException: Connection is broken: Connection refused)))
at org.jboss.mq.pm.jdbc2.PersistenceManager.resolveAllUncommitedTXs(PersistenceManager.java:276)
at org.jboss.mq.pm.jdbc2.PersistenceManager.startService(PersistenceManager.java:1299)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:966)
at $Proxy11.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:392)
at org.jboss.system.ServiceController.start(ServiceController.java:408)
at org.jboss.system.ServiceController.start(ServiceController.java:408)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy5.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy7.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:476)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:200)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:273)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:966)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:392)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy5.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:597)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy6.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:365)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:272)
at org.jboss.Main.boot(Main.java:150)
at org.jboss.Main$1.run(Main.java:388)
at java.lang.Thread.run(Thread.java:536)
Caused by: org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: Connec
tion is broken: Connection refused); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connect
ion; - nested throwable: (java.sql.SQLException: Connection is broken: Connection refused))
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:106)
at org.jboss.mq.pm.jdbc2.PersistenceManager.getConnection(PersistenceManager.java:1206)
at org.jboss.mq.pm.jdbc2.PersistenceManager.resolveAllUncommitedTXs(PersistenceManager.java:219)
... 68 more
Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException
: Connection is broken: Connection refused)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnection
Factory.java:157)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnection(InternalManagedConnectionPool.
java:352)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.jav
a:151)
at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.
java:429)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:413)
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:331)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:488)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnecti
onManager2.java:798)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
... 70 more
Caused by: java.sql.SQLException: Connection is broken: Connection refused
at org.hsqldb.Trace.getError(Unknown Source)
at org.hsqldb.Trace.error(Unknown Source)
at org.hsqldb.jdbcConnection.reconnectHSQL(Unknown Source)
at org.hsqldb.jdbcConnection.openHSQL(Unknown Source)
at org.hsqldb.jdbcConnection.(Unknown Source)
at org.hsqldb.jdbcDriver.connect(Unknown Source)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnection
Factory.java:147)
... 78 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133165#4133165
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133165
17 years, 2 months