[Javassist user questions] - Re: adding annotations
by cat4hire
I've found how to make the ClassFile working for defining my new class, but I'm still unable to add the annotation. Now I work as follows:
1) I create a CtClass object and set the inheritance chain on that;
2) I get the byte[] from the CtClass and place them into a ByteArrayInputStream, used to create a ClassFile;
3) I add the annotation to the classfile;
4) I get the byte[] from the classfile thru a ByteArrayOutputStream;
5) I load the class thru the defineClass method.
Now the class is of the right type, but it has no the annotation.
The following is my code; anyone has an idea of which is my error adding the annotation?
| subProxyClassName += this.getSubClassNameSuffix();
|
| // make a new class and prepare the annotation
| CtClass newProxyClass = pool.makeClass(subProxyClassName);
| newProxyClass.setSuperclass( baseProxyClass );
| ByteArrayInputStream is = new ByteArrayInputStream( newProxyClass.toBytecode() );
| DataInputStream dis = new DataInputStream( is );
| ClassFile classFile = new ClassFile( dis );
| newProxyClass.defrost();
| ConstPool constantPool = classFile.getConstPool();
| AnnotationsAttribute attribute = new AnnotationsAttribute( constantPool, AnnotationsAttribute.visibleTag );
| javassist.bytecode.annotation.Annotation annotation = new javassist.bytecode.annotation.Annotation( this.annotationClassName, constantPool );
| attribute.setAnnotation( annotation );
| classFile.addAttribute( attribute );
| classFile.setVersionToJava5();
| ByteArrayOutputStream bos = new ByteArrayOutputStream();
| DataOutputStream os = new DataOutputStream( bos );
| classFile.write( os );
| new javassist.bytecode.annotation.Annotation( constantPool, subProxy );
| bytecode = bos.toByteArray();
| baseProxyClass = null;
|
| ...
|
| Class clazz = this.defineClass(subProxyClassName, bytecode, 0, bytecode.length);
|
|
Thanks,
Luca
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133098#4133098
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133098
16 years, 3 months
[JBoss jBPM] - Re: jbpm 3.2.2 in Jboss AS 4.2.2 - Transaction Problems
by cornhoolio22
Hope this wokrs ;) Adjust the factory to your name...
| <jbpm-context>
| <service name="persistence">
| <factory>
| <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
| <field name="isCurrentSessionEnabled"><true /></field>
| <field name="isTransactionEnabled"><false /></field>
| </bean>
| </factory>
| </service>
| <service name="message">
|
isCurrentSessionEnabled true means jBPM will request Hibernate to use the current session associated with the current transaction. If there is no current transaction, an exception will be thrown stating no session is active. In this case, you may want to set this isCurrentSessionEnabled to false, and inject the current session into the JbpmContext via the JbpmContext.setSession(session) method. This will also insure that jBPM uses the same Hibernate session as other parts of your application. Note, the Hibenrate session can be injected into a stateless session bean via a persistence context, for example
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133097#4133097
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133097
16 years, 3 months
[Beginners Corner] - JBoss installing Problem
by prodv
Hi everybody,
we have actually a JBoss 3.0.4 running on a RH Advanced Server 2 with a DB2 7.2 Database. We are going to move this JBoss on a new machine, which is running RHEL 5 with a DB2 8.2 Database.
Some facts to the Server: 8 GB RAM, Dual Quad-Core Xeon, 64bit RHEL 5.
I installed the new Sun JAVA SDK and copied the whole JBoss 3.0.4 to the new Server.
After starting the JBoss, i have only one instance running and JBoss doesnt connect to the DB.
i get the following WARN-message
16:04:00,361 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=isip/fundFreigabe,service=EJB
| org.jboss.deployment.DeploymentException: Error: can't find data source: java:/DB2ISIPDS; - nested throwable: (javax.naming.NameNotFoundException: DB2ISIPDS not bound)
| at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.<init>(JDBCEntityBridge.java:99)
| at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:397)
| at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:339)
| at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
| at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
| at org.jboss.ejb.Container.invoke(Container.java:756)
| at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy5.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:398)
| 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:517)
| at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
| at $Proxy18.start(Unknown Source)
| at org.jboss.ejb.EjbModule.startService(EjbModule.java:430)
| at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
| 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:517)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy5.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:398)
| 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:517)
| at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
| at $Proxy10.start(Unknown Source)
| at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:395)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:807)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
| at org.jboss.deployment.MainDeployer.addDeployer(MainDeployer.java:224)
| 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:517)
| at org.jboss.deployment.SubDeployerSupport.startService(SubDeployerSupport.java:98)
| at org.jboss.ejb.EJBDeployer.startService(EJBDeployer.java:131)
| at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
| 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:517)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy5.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:398)
| at org.jboss.system.ServiceController.start(ServiceController.java:418)
| 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:517)
| at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
| at $Proxy3.start(Unknown Source)
| at org.jboss.deployment.SARDeployer.start(SARDeployer.java:249)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:807)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:585)
| 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:517)
| at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
| at $Proxy4.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:435)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:656)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:261)
| at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
| 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:517)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy0.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:398)
| 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:517)
| at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
| at $Proxy3.start(Unknown Source)
| at org.jboss.deployment.SARDeployer.start(SARDeployer.java:249)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:807)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:585)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:569)
| 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:517)
| at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:324)
| at org.jboss.system.server.ServerImpl.start(ServerImpl.java:221)
| at org.jboss.Main.boot(Main.java:148)
| at org.jboss.Main$1.run(Main.java:381)
| at java.lang.Thread.run(Thread.java:534)
| Caused by: javax.naming.NameNotFoundException: DB2ISIPDS not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:464)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:443)
| at javax.naming.InitialContext.lookup(InitialContext.java:347)
| at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.<init>(JDBCEntityBridge.java:96)
| ... 111 more
|
Does anyone have a clue what i can do to make JBoss working? Is the JBoss 3.0.4 not compatible with RHEL5? If not, can anyone give me some official infos for this fact.
many greets from germany,
Malte Poltermann
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133093#4133093
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133093
16 years, 3 months
[Installation, Configuration & DEPLOYMENT] - Re: Maximum CPU Usage in Jboss4.0.4 GA
by zasmen
Hi Peter,
The configurations are as follows:
jdk version
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
postgresql version
PostgreSQL 8.1.4
jboss version
jboss 4.0.4 GA
linux server specification
RAM 1 GB
CPU 3 GHz
JVM shows::
JAVA_OPTS="-server -Xms512m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
postgres-ds.xml shows::
<local-tx-datasource>
<jndi-name>PostgresDS</jndi-name>
<connection-url>jdbc:postgresql://1.2.3.4:5432/db_testname</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>xyz</user-name>
xyz
<type-mapping>PostgreSQL 8.1.4</type-mapping>
<min-pool-size>10</min-pool-size>
<max-pool-size>64</max-pool-size>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
<track-statement>true</track-statement>
</local-tx-datasource>
postgresql.conf shows::
listen_addresses = '*'
port = 5432
max_connections = 100
shared_buffers = 1000
org.jboss.resource.connectionmanager.JBossManagedConnectionPool shows::
BlockingTimeoutMillis int RW 30000 MBean Attribute.
State int R 3 MBean Attribute.
AvailableConnectionCount long R 64 MBean Attribute.
ManagedConnectionFactoryName javax.management.ObjectName RW View MBean MBean Attribute.
ConnectionCount int R 10 MBean Attribute.
NoTxSeparatePools boolean RW True False MBean Attribute.
MinSize int RW 10 MBean Attribute.
MaxConnectionsInUseCount long R 14 MBean Attribute.
MaxSize int RW 64 MBean Attribute.
StateString java.lang.String R Started MBean Attribute.
InUseConnectionCount long R 0 MBean Attribute.
ConnectionCreatedCount int R 42 MBean Attribute.
ConnectionDestroyedCount int R 32 MBean Attribute.
IdleTimeoutMinutes long RW 15
The applications gets very slow.Does increasing the RAM to 2gb solves it?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133085#4133085
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133085
16 years, 3 months