[JBoss AOP] - Newbie - Help Needed
by andydale
Hi,
I am new to AOP and am currently running into problenm when trying to implement a custom aspect (interceptor) on JBoss 4.0.4GA.
I have already managed to write a working Interceptor by actually coding it inside the bean with the @AroundInvoke, but now i want to implement it like demonstrated here http://docs.jboss.org/jbossas/jboss4guide/r3/html/aop.chapt.html with having a .jar (custom Aspect) file, and jboss-aop.xml file in the deploy directoy, and annotation the method in the bean. The problem i am currently having is that it never seems to fire.
TestInterrup.java (aspect interace)
package com.jboss.aspect;
|
| import java.lang.annotation.Target;
| import java.lang.annotation.ElementType;
|
| @Target({ElementType.METHOD})
| public @interface TestInterrupt {}
TestInterruptAspect.java
package com.jboss.aspect;
|
| //import the relevant aop libs
| import org.jboss.aop.joinpoint.Invocation;
|
| public class TestInterruptAspect {
|
| public Object testInterrupt(Invocation invocation)throws Throwable{
|
| //test print
| System.out.println("**** Interrupt fired successfully ****");
|
| return invocation.invokeNext();
| }
|
| }
jboss-aop.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
| <aop>
| <aspect class="com.jboss.aspect.TestInterruptAspect"
| scope="PER_VM"/>
|
| <bind pointcut="execution(* *->@com.jboss.aspect.TestInterrupt(*))">
| <advice name="testInterrupt"
| aspect="com.jboss.aspect.TestInterruptAspect"/>
| </bind>
| </aop>
|
Can anyone offer me any advice on how to solve the problem of it not firing on method invocation ?
Thanks in advance,
Andy
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958501#3958501
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958501
19 years, 9 months
[JBoss Seam] - Embeddable Objects (EJB3) not working properly
by niesar
Hi guys,
in a Seam/JSF/Facelets evaluation project I ran into the following problem. Looks like there is a problem if you use embeddable Objects in Entity beans.
Consider the following entity bean containing an embedded object: @Entity
| @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
| @DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING)
| @Table (name = "CLassAB")
| @Name("classA")
| public class ClassA
| implements java.io.Serializable {
|
| @Id
| @GeneratedValue
| @Column (name = "Id")
| private int id;
|
| @Column (name = "Var1", nullable=false, length=3)
| @NotNull @Length(min=2, max=3)
| private String var1;
|
| @Embedded // <------- trouble maker
| private ClassE classEInst;
|
| @Basic
| private Double latitude;
|
| @Basic
| private Double longitude;
|
|
|
| public int getId() {
| return id;
| }
|
| protected void setId(int id) {
| this.id = id;
| }
|
|
| public String getVar1() {
| return var1;
| }
|
| public void setVar1(String var1) {
| this.var1 = var1;
| }
|
|
| public ClassE getClassEInst()
| {
| return classEInst;
| }
|
| public void setClassEInst(ClassE classEInst)
| {
| this.classEInst = classEInst;
| }
|
|
| public Double getLatitude() {
| return latitude;
| }
|
|
| public void setLatitude(Double latitude) {
| this.latitude = latitude;
| }
|
| public Double getLongitude() {
| return longitude;
| }
|
| public void setLongitude(Double longitude) {
| this.longitude = longitude;
| }
|
| public GeoPoint getLocation() {
| return new GeoPoint(latitude,longitude);
| }
|
|
| public String toString() {
| return var1;
| }
| }Please disregard the inheritance. You don't need to bother with it for this issue.
ClassE just contains a single integer in this test case@Embeddable
| public class ClassE
| implements java.io.Serializable {
|
| private int classEVar;
|
|
| public ClassE() {
| }
|
|
| public ClassE(int classEContents) {
| this.classEVar = classEContents;
| }
|
| public int getClassEVar() {
| return classEVar;
| }
|
| public void setClassEVar(int classEVar) {
| this.classEVar = classEVar;
| }
The problem arises in a JSF page where I want to edit instances of entity bean ClassA (classAEdit.xhtml):<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:o="http://www.optimizer.de/jsf"
| template="template.xhtml">
|
| <!-- content -->
| <ui:define name="content">
| <div class="section">
| <h1>Edit ClassA - Test</h1>
| <h:form>
| <fieldset>
| <o:classA-input classAInst="#{classASearch.selectedClassAInst}" showId="#{false}" /> // <------------- (1)
| <div class="entry errors"><h:messages globalOnly="true" /></div>
| <div class="entry">
| <div class="input">
| <h:commandButton value="Save" action="#{classAEdit.update}" class="button"/>
| <h:commandButton value="Delete" action="#{classAEdit.delete}" class="button"/>
| <s:link value="Cancel" action="classAList" linkStyle="button" buttonClass="button"/>
| </div>
| </div>
| </fieldset>
| </h:form>
| </div>
| </ui:define>
| </ui:composition>
Take a look at (1).
tag classA-input is defined in a facelets tag lib (classA-input.xhtml)<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:c="http://java.sun.com/jstl/core"
| xmlns:fn="http://java.sun.com/jsp/jstl/functions"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:o="http://www.optimizer.de/jsf">
| <ui:composition>
| <div class="entry">
| <div class="label"><h:outputLabel for="id">ID:</h:outputLabel></div>
| <div class="output"><h:outputText id="id">#{classAInst.id}</h:outputText></div>
| </div>
| <div class="entry">
| <div class="label"><h:outputLabel for="classEInst">Class E Instance (embedded):</h:outputLabel></div>
| <div class="input">
| <h:inputText id="classEInst" value="#{classAInst.classEInst}" /><br/> // <------------------ (2)
| <span class="errors"><h:message for="classEInst" /></span>
| </div>
| </div>
| <div class="entry">
| <div class="label"><h:outputLabel for="latitude">Latitude:</h:outputLabel></div>
| <div class="input">
| <h:inputText id="latitude" value="#{classAInst.latitude}" /><br/>
| <span class="errors"><h:message for="latitude" /></span>
| </div>
| </div>
| <div class="entry">
| <div class="label"><h:outputLabel for="longitude">Longitude:</h:outputLabel></div>
| <div class="input">
| <h:inputText id="longitude" value="#{classAInst.longitude}" /><br/>
| <span class="errors"><h:message for="longitude" /></span>
| </div>
| </div>
| </ui:composition>
| </html>In (1) an input field with contents `{{classASearch.selectedClassAInst} is created.
Here is the relevant part of classASearch: @Stateful
| @Name("classASearch")
| @Scope(ScopeType.SESSION)
| public class ClassASearchAction implements ClassASearch
| {
| @PersistenceContext
| private EntityManager em;
|
| private String searchString;
|
| @DataModel
| private List<ClassA> classAInstList;
| @DataModelSelection
| @Valid
| private ClassA selectedClassAInst; // <--------------------
| [...]
| }
The interesting part is that everything works fine if the ClassE instance is displayed in (2). However, if you change the contents and want to save, you'll get an error - apparingly from MyFaces:
/WEB-INF/facelets/tags/classA-input.xhtml @20,68 value="#{classAInst.classEInst}": Exception setting property classEInst of base with class test.ClassB
[hint: classA-input.xhtml @20,68 is (2)]
Since the code works fine for Strings or - as you can see above - doubles, but fails with embedded objects, I guess MyFaces is not compatible with @Embedded Objects created by EJB3/Hibernate.
However, I don't know where to file the bug. Is MyFaces supposed to deal correctly with an EJB3 embedded obejct? Or is Hibernate/EJB3 implementing the embedded object in a strange way so that MyFaces can't deal correctly with the code? Or are JBoss and MyFaces just not as compatible as they should be?
So is this a bug or a feature request? File a bug in the JBoss or in the Apache JIRA???
---
BTW, the problem seems to arise in PropertyResolverImpl.setValue(). In http://myfaces.apache.org/impl/xref/org/apache/myfaces/el/PropertyResolve... you can see the error is thrown in the catch (RuntimeException e) part in setValue().
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958497#3958497
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958497
19 years, 9 months
[Tomcat, HTTPD, Servlets & JSP] - JBossCacheService to Tomcat clustering not found
by ivan.pe
Recently I have upgraded to JBoss 4.0.4GA, by custom installation and after my ear containing web module gets deployed I am getting JBoss cache / clustering exception via bundled Tomcat. I have checked Tomcat config (server.xml) and I can't find any option how to stop this exception from happening. However it has no impact on the deployed application, but the exception bug me a lot!
Any suggestions welcome.
15:47:01,441 INFO [JBossCacheManager] init(): replicationGranularity_ is 0 and invaldateSessionPolicy is 2
15:47:01,453 ERROR [JBossCacheService] jboss.cache:service=TomcatClusteringCache service to Tomcat clustering not found
15:47:01,453 ERROR [JBossCacheManager] JBossCacheService to Tomcat clustering not found
org.jboss.web.tomcat.tc5.session.ClusteringNotSupportedException: jboss.cache:service=TomcatClusteringCache service to Tomcat clustering not found
at org.jboss.web.tomcat.tc5.session.JBossCacheService.(JBossCacheService.java:127)
at org.jboss.web.tomcat.tc5.session.JBossCacheManager.init(JBossCacheManager.java:144)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:332)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
at org.jboss.web.WebModule.startModule(WebModule.java:83)
at org.jboss.web.WebModule.startService(WebModule.java:61)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy39.start(Unknown Source)
at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.ws.server.WebServiceDeployer.start(WebServiceDeployer.java:117)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy40.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:997)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy6.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:755)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:464)
at java.lang.Thread.run(Thread.java:595)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958496#3958496
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958496
19 years, 9 months