[Javassist user questions] - Simple Field Interseption
by roja
Hi,
I am just wondering if it is possible to have the following work (i.e. print out: 20 10) without having to use the javassist classloader?
| class Observed {
|
| public int n;
|
| public int getN() {
| return n;
| }
|
| public void setN(int n) {
| this.n = n;
| }
|
| }
|
| class Observer {
|
| public static void writeX(Object target, int value) {
|
| System.out.println(value);
|
| }
|
| }
|
| public class ObsObrTest {
|
| public static void main(String[] args) throws Exception {
|
| ClassPool cp = ClassPool.getDefault();
|
| CtClass theObserved = cp.get("Observed");
|
| CtClass theObserver = cp.get("Observer");
|
| CodeConverter conv = new CodeConverter();
|
| conv.replaceFieldWrite(theObserved.getField("n"), theObserver, "writeX");
|
| theObserved.instrument(conv);
|
| Class c = theObserved.toClass();
|
| Observed instanceOfObserved = (Observed)c.newInstance();
|
| instanceOfObserved.n = 20; //should cause the output of 20
|
| instanceOfObserved.setN(10); //should cause the output of 10
|
| }
| }
|
Cheers
Roja
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081913#4081913
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081913
18 years, 7 months
[EJB 3.0] - Cannot deploy EJB3 module
by ggary
I am checking feasibility of EJB3 based web services.
So, I created a tiny session bean and successfully built EJB module.
However when I am trying to deploy it to JBOSS 4.2.1 I am getting this:
15:59:03,811 INFO [Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 18s:749ms
| 15:59:08,780 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
|
| --- Packages waiting for a deployer ---
| org.jboss.deployment.DeploymentInfo@470af4de { url=file:/C:/Applications/jboss-4.2.1.GA/server/default/deploy/WSEJBModule.jar }
| deployer: null
| status: null
| state: INIT_WAITING_DEPLOYER
| watch: file:/C:/Applications/jboss-4.2.1.GA/server/default/deploy/WSEJBModule.jar
| altDD: null
| lastDeployed: 1189119548780
| lastModified: 1189119548780
| mbeans:
|
| --- Incompletely deployed packages ---
| org.jboss.deployment.DeploymentInfo@470af4de { url=file:/C:/Applications/jboss-4.2.1.GA/server/default/deploy/WSEJBModule.jar }
| deployer: null
| status: null
| state: INIT_WAITING_DEPLOYER
| watch: file:/C:/Applications/jboss-4.2.1.GA/server/default/deploy/WSEJBModule.jar
| altDD: null
| lastDeployed: 1189119548780
| lastModified: 1189119548780
| mbeans:
|
| --- MBeans waiting for other MBeans ---
| ObjectName: jboss.ws:service=DeployerInterceptorEJB21
| State: CONFIGURED
| I Depend On:
| jboss.ejb:service=EJBDeployer
|
| ObjectName: jboss.ws:service=DeployerInterceptorEJB3
| State: CONFIGURED
| I Depend On:
| jboss.ejb3:service=EJB3Deployer
|
| --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
| ObjectName: jboss.ejb3:service=EJB3Deployer
| State: NOTYETINSTALLED
| Depends On Me:
| jboss.ws:service=DeployerInterceptorEJB3
|
| ObjectName: jboss.ejb:service=EJBDeployer
| State: NOTYETINSTALLED
| Depends On Me:
| jboss.ws:service=DeployerInterceptorEJB21
|
Installation page says that JBoss AS 4.2.x versions include support for EJB3, by default.
Can someone tells me what I am missing and how to fix the problem.
Thanks a lot.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081911#4081911
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081911
18 years, 7 months
[JBoss Seam] - Re: working with a dynamically sized Datamodel with JSF/SEAM
by asookazian
Perhaps the idea is something like this, but I'm not getting any data on the JSF (screen) for this dataTable. The rendered attributes are evaluating to true after I click a run button on the JSF during the use case.
<h:dataTable var="myRole" value="#{myRoles}" rendered="#{userRoleSearch.displayViewRolesDataTable}">
| <c:if test="#{userRoleSearch.displayViewRolesDataTable}">
| <c:forEach items="#{myRole}" var="myVal">
| <h:column>
| #{myVal}
| </h:column>
| </c:forEach>
| </c:if>
| </h:dataTable>
also, when userRoleSearch.displayViewRolesDataTable = true, the following JSF fragment does not output the "testing now!" string. seems strange...
| <h:dataTable var="myRole" value="#{myRoles}" rendered="#{userRoleSearch.displayViewRolesDataTable}">
| <c:if test="#
| userRoleSearch.displayViewRolesDataTable}"> <h:outputText value="testing now!"/>
| </c:if>
| </h:dataTable>
also, does it matter if you're using JSF 1.1 or 1.2 regarding this problem???
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081901#4081901
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081901
18 years, 7 months
[EJB 3.0] - help getting started with eclipse
by wiggy
having basic problems getting to first check point with ejb3 - just starting out and got stuck.
running europa eclipse and run JBOSS AS4.2 and have deployed a mysql JTA datasource in the server and started in Eclipse.
Then I have created an EJB project and decalred an peristence unit xml as follows
| <?xml version="1.0" encoding="UTF-8"?>
| <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
| <persistence-unit name="embedDS" transaction-type="JTA">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>jdbc/embedDS</jta-data-source>
| <class>org.model.Message</class>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| <property name="hibernate.show_sql" value="true"/>
| </properties>
| </persistence-unit>
| </persistence>
|
I think i have this right - the defaultDS is still using jboss AS defaults.
I then create simple message persistence entity class as follows.
| package org.model;
|
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.GeneratedValue;
| import javax.persistence.GenerationType;
| import javax.persistence.Id;
| import javax.persistence.*;
|
| @Entity
| @Table(name="message", catalog="embed")
| public class Message
| {
| private long messageID;
| private String message;
|
| @Id
| @GeneratedValue(strategy=GenerationType.AUTO)
| @Column(name="messageID")
| public long getMessageID() {
| return messageID;
| }
|
| public void setMessageID(long messageID) {
| this.messageID = messageID;
| }
|
| public String getMessage() {
| return message;
| }
|
| public void setMessage(String message) {
| this.message = message;
| }
|
|
|
| }
|
however in my eclipse editor this wont compile - the error says
anonymous wrote :
| Severity and Description Path Resource Location Creation Time Id
| Schema "root" cannot be resolved for table "message" SessionTest/ejbModule/org/model Message.java line 11 1189118136216 1813
|
| Severity and Description Path Resource Location Creation Time Id
| Column "messageID" cannot be resolved SessionTest/ejbModule/org/model Message.java line 19 1189118136216 1811
|
| and
|
| Severity and Description Path Resource Location Creation Time Id
| Column "message" cannot be resolved SessionTest/ejbModule/org/model Message.java line 28 1189118136216 1812
|
|
- cant therefore compile nor test the rest of my understanding if i cant get past this.
the error Schema "root" cannot be resolved for table "message" is associated with the @table annotation -
any ideas as what I am doing wrong here ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081898#4081898
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081898
18 years, 7 months