[JBoss JIRA] Created: (WELD-625) Local no-interface view EJB3.1 proxy requests superclass of EJB from container
by Craig Ringer (JIRA)
Local no-interface view EJB3.1 proxy requests superclass of EJB from container
------------------------------------------------------------------------------
Key: WELD-625
URL: https://jira.jboss.org/browse/WELD-625
Project: Weld
Issue Type: Bug
Affects Versions: 1.0.1.Final, 1.1.0.BETA2
Environment: Glassfish 3.0.1 with JDK 1.6.0r18, Glassfish 3.1 build 15 with JDK 1.7b101. Ubuntu 10.04. Also tried upgrading Glassfish 3.0.1 to Weld 1.0.1-Final and upgrading Glassfish 3.1 build 15 to the latest Weld 1.1 snapshot (900); issue still occurs.
Tested with JBoss AS 6 M4 as well, but cannot reproduce the issue there.
Reporter: Craig Ringer
If Weld (CDI) is used to inject a local no-interface view of an EJB into another managed bean, the generated proxy that is injected cannot resolve calls to methods implemented in the EJB's superclass that aren't overridden by the concrete EJB class.
An outline of the simplified test case that demonstrates the problem is:
// This can be any DI candidate in an EJB container. In this case it's a JSF2 backing bean
// managed in a CDI context.
//
@javax.inject.Named
@javax.enterprise.context.SessionScoped
public class InjectionSite {
// If injected via @EJB, everything works, because we don't use Weld to create the proxy.
@Inject private EJBClass ejb;
public int getValue() {
// Throws IllegalStateException from Weld
return ejb.getValue();
}
}
// The EJB its self has a method that's implemented by a superclass and
// not overridden by the concrete EJB class.
@Stateless
public class EJBClass extends EJBSuper {
// Inherits getValue() from super
}
public class EJBSuper {
public int getValue() {
return 1;
}
}
This seems to come down to Weld's EnterpriseBeanProxyMethodHandler. It decides which EJB class to ask the container for an instance of by determining which class implements the method being called. If the implementation is in a superclass of the EJB, this will fail, because the container doesn't know anything about the EJB's superclass, and in any non-trivial case there'll be several different EJBs with the same superclass anyway.
The test case functions correctly if modified to use the Glassfish native JSF2/EJB injection via @EJB instead of Weld injection with @Inject, as the proxy created by @EJB isn't the Weld proxy implementation. That's only an option if you're using JSF2, though.
As a workaround, the concrete EJB can wrap the superclass's methods, but this is rather clumsy in real-world cases where the superclass exists for a reason, particularly for things like data access facades where the superclass contains generified DAO methods and subclasses only provide a type param and a few helpers.
If the object being injected isn't an EJB, everything works fine, but that's not really an option if you need EJB features or if you're injecting a bean that can't be made serializable into a serializable object like a JSF2 session-scoped bean.
Background here: http://forums.java.net/jive/thread.jspa?messageID=480532񵔔 . A test case is attached to the thread.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 7 months
[JBoss JIRA] Created: (WELD-507) Problems With Interceptors and Glassfish V3
by Dyego Carmo (JIRA)
Problems With Interceptors and Glassfish V3
-------------------------------------------
Key: WELD-507
URL: https://jira.jboss.org/jira/browse/WELD-507
Project: Weld
Issue Type: Bug
Components: Interceptors and Decorators
Affects Versions: 1.0.1.Final, 1.0.1.CR2, 1.0.1.CR1, 1.0.0.GA, 1.0.0.CR1, 1.0.0.PREVIEW1
Environment: Glassfish V3 3.0.1 B14
Weld 1.0.1 Final
NetBeans 6.8 Or 6.9 Beta
Windows XP Operation System
4 GB of RAM
Reporter: Dyego Carmo
Priority: Blocker
I have problems with deploy of my interceptors, See:
INFO: Created HTTP listener http-listener-1 on port 8080
INFO: Created HTTP listener http-listener-2 on port 8181
INFO: Created HTTP listener admin-listener on port 4848
INFO: Created virtual server server
INFO: Created virtual server __asadmin
INFO: Virtual server server loaded system default web module
INFO: Portable JNDI names for EJB NewSessionBean : [java:global/QuemSabeUmLogTeste/QuemSabeUmLogTeste-ejb/NewSessionBean, java:global/QuemSabeUmLogTeste/QuemSabeUmLogTeste-ejb/NewSessionBean!teste.NewSessionBean]
INFO: WELD-000900 1.0.1 (SP1)
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Inicializando Mojarra 2.0.2 (FCS b10) para o contexto '/QuemSabeUmLogTeste-war'
INFO: Loading application QuemSabeUmLogTeste#QuemSabeUmLogTeste-war.war at QuemSabeUmLogTeste-war
SEVERE: Exception while loading the app
org.glassfish.deployment.common.DeploymentException: WELD-001417 Enabled interceptor class class teste.BasicInterceptor is neither annotated @Interceptor nor registered through a portable extension
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:181)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:239)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001417 Enabled interceptor class class teste.BasicInterceptor is neither annotated @Interceptor nor registered through a portable extension
at org.jboss.weld.bootstrap.Validator.validateEnabledInterceptorClasses(Validator.java:449)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:319)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:399)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:178)
... 30 more
The beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<class>teste.BasicInterceptor</class>
</interceptors>
</beans>
The BasicInterceptor.java
@Interceptor @Basic
public class BasicInterceptor {
private final static ThreadLocal<InvocationContext> context = new ThreadLocal<InvocationContext>();
@AroundInvoke
public Object classInterceptor(InvocationContext newContext) throws Exception {}
}
The Basic.java
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Basic {
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 7 months
[JBoss JIRA] Created: (WELD-230) EL Literals not working in numberguess on Jetty or Tomcat.
by Steven Boscarine (JIRA)
EL Literals not working in numberguess on Jetty or Tomcat.
----------------------------------------------------------
Key: WELD-230
URL: https://jira.jboss.org/jira/browse/WELD-230
Project: Weld
Issue Type: Bug
Components: Examples
Affects Versions: 1.0.0.CR1
Environment: Ubuntu Jaunty Jackalope AMD64
Tomcat 6.0.20
mvn -version
Apache Maven 2.2.0 (r788681; 2009-06-26 09:04:01-0400)
Java version: 1.6.0_16
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.28-16-generic" arch: "amd64" Family: "unix"
Reporter: Steven Boscarine
Is the examples POM in Weld 1 CR1 may be importing the wrong EL lib version?
I am having a hard time getting EL Literals working in Jetty or Tomcat. I first tried in my own app and couldn't get them working, so I tried modifying the numberguess example home.xhtml file to:
<div>
I'm thinking of a number between #{game.getSmallest()} and #{game.biggest}. You have #{game.remainingGuesses} guesses.
</div>
...and got:
2009-10-21 23:22:22.697::WARN: /weld-numberguess/home.jsf
java.lang.NoSuchMethodError: javax.el.ELResolver.invoke(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;
at com.sun.el.parser.AstValue.getValue(AstValue.java:111)
at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:71)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:71)
at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:217)
at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(ELText.java:141)
at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:78)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:74)
at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:178)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1610)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:340)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:915)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
If it helps, according to mvn site, the versions are:
javax.el el-api 2.1.2-b04
org.glassfish.web el-impl 2.1.2-b04
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 7 months
[JBoss JIRA] Created: (WELD-496) Examples named incorrectly in the Weld reference documentation
by asookazian (JIRA)
Examples named incorrectly in the Weld reference documentation
--------------------------------------------------------------
Key: WELD-496
URL: https://jira.jboss.org/jira/browse/WELD-496
Project: Weld
Issue Type: Bug
Components: Documentation
Affects Versions: 1.0.1.Final
Environment: N/A
Reporter: asookazian
Priority: Trivial
The following needs attention:
"Weld comes with two starter example applications, in addition to more specialized examples. The first, weldnumberguess,
is a web (war) example containing only non-transactional managed beans. This example can be
run on a wide range of servers, including JBoss AS, GlassFish, Apache Tomcat, Jetty, Google App Engine, and
any compliant Java EE 6 container. The second example, weld-translator, is an enterprise (ear) example
that contains session beans. This example must be run on JBoss AS 6.0, Glassfish 3.0 or any compliant Java EE
6 container."
There are many more start example apps now in 1.0.1. Also, the names of the two cited above have changed to numberguess and translator.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 7 months