[JBoss Seam] - Context management for custom servlets
by thatrichard
I'm using Seam-2.0.0.Beta1. According to the docs:
anonymous wrote : 25.1.4.6. Context management for custom servlets
|
| ...Seam provides a servlet filter that can be applied to any other servlet that needs access to Seam components.
|
| This filter allows custom servlets to interact with the Seam contexts. It sets up the Seam contexts at the beginning of each request, and tears them down at the end of the request
I'm reading this as saying that I can configure Seam to inject components into a simple on-JSF servlet.
The relevant bits of my servlet are as follows:
| @Name("documentDownloader")
| public class DocumentDownloadServlet extends HttpServlet {
|
| @Logger
| private Log log;
|
| @In( create=true )
| private Session hibernateSession;
|
| @Override
| protected void doGet( HttpServletRequest request, HttpServletResponse response )
| throws ServletException, IOException {
|
| //etc.
|
My components.xml file contains
| <components xmlns="http://jboss.com/products/seam/components"
| ...
| xmlns:web="http://jboss.com/products/seam/web"
| ...
| >
| <web:context-filter url-pattern="/dimmer/dim/*" />
However, no injection is taking place.
What am I doing wrong?
Thanks
Richard
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095027#4095027
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095027
18Â years, 9Â months
[JBoss Seam] - approach using seam tests
by feivele
Hi,
one question. What is the right way using test in seam-gen project.
I have a project created with seam-gen (using RHDS, same like in console). In my test folder I have created a test class and a testng.xml.
If I choose the class and use "run as - TestNG Test" the result is Total tests run: 0, Failures: 0, Skips: 0
If I use build.xml -> test: You need to specify at least one testng.xml or one class
or if I use "testng.xml -> run as -> TestNG Suite" here the error
java.lang.NoClassDefFoundError: org/jboss/deployers/spi/DeploymentException
| at java.lang.Class.forName0(Native Method)
| at java.lang.Class.forName(Class.java:169)
| at org.jboss.seam.mock.BaseSeamTest.embeddedJBossAvailable(BaseSeamTest.java:977)
| at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:967)
| at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:893)
| at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
| 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:597)
| at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
| at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:397)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:145)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:82)
| at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:166)
| at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
| at org.testng.TestRunner.runWorkers(TestRunner.java:689)
| at org.testng.TestRunner.privateRun(TestRunner.java:566)
| at org.testng.TestRunner.run(TestRunner.java:466)
| at org.testng.SuiteRunner.runTest(SuiteRunner.java:301)
| at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296)
| at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276)
| at org.testng.SuiteRunner.run(SuiteRunner.java:191)
| at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808)
| at org.testng.TestNG.runSuitesLocally(TestNG.java:776)
| at org.testng.TestNG.run(TestNG.java:701)
| at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
| at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
|
after add the lib/test/*.jar files to run dialog the error was the following
ERROR 14-10 19:59:43,856 [org.jboss.dependency.plugins.AbstractController.incrementState():456] Error installing to Instantiated: name=DeploymentFilter state=Described
| java.lang.IllegalStateException: Class not found: [Ljava.lang.String;
| at org.jboss.metadata.spi.signature.Signature.stringsToClasses(Signature.java:174)
| at org.jboss.metadata.spi.signature.Signature.stringsToClasses(Signature.java:125)
| at org.jboss.metadata.spi.signature.Signature.getParametersTypes(Signature.java:292)
| at org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader.getComponentMetaDataRetrieval(AnnotatedElementMetaDataLoader.java:138)
| at org.jboss.metadata.plugins.context.AbstractMetaDataContext.getComponentMetaDataRetrieval(AbstractMetaDataContext.java:280)
| at org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge.getComponentMetaData(MetaDataRetrievalToMetaDataBridge.java:159)
| at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.methodHasAnnotations(AOPConstructorJoinpoint.java:202)
| at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.hasMethodMetaData(AOPConstructorJoinpoint.java:172)
| at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.hasInstanceOrJoinpointMetaData(AOPConstructorJoinpoint.java:152)
| at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.dispatch(AOPConstructorJoinpoint.java:99)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:103)
| at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:52)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:197)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:136)
| at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
| at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:233)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:724)
| at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:445)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:555)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:489)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:289)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:192)
| at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:302)
| at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:272)
| at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:119)
| at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96)
| at org.jboss.embedded.Bootstrap.deployBaseBootstrapUrl(Bootstrap.java:150)
| at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:162)
| at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:201)
| at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:214)
| at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:11)
| at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:968)
| at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:893)
| at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
| 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:597)
| at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
| at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:397)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:145)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:82)
| at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:166)
| at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
| at org.testng.TestRunner.runWorkers(TestRunner.java:689)
| at org.testng.TestRunner.privateRun(TestRunner.java:566)
| at org.testng.TestRunner.run(TestRunner.java:466)
| at org.testng.SuiteRunner.runTest(SuiteRunner.java:301)
| at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296)
| at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276)
| at org.testng.SuiteRunner.run(SuiteRunner.java:191)
| at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808)
| at org.testng.TestNG.runSuitesLocally(TestNG.java:776)
| at org.testng.TestNG.run(TestNG.java:701)
| at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
| at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
| Caused by: java.lang.ClassNotFoundException: [Ljava.lang.String;
| at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
| at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
| at org.jboss.metadata.spi.signature.Signature.stringsToClasses(Signature.java:170)
| ... 55 more
Hey guys, big thanks to your work. Seam rocks. But can you please update/refresh documentation. The correct approach is not clear how to use seam tests.
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095025#4095025
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095025
18Â years, 9Â months
[JBoss Seam] - Re: Feature request regarding nested conversations
by pete.muirï¼ jboss.org
Sorry about the delay getting to this thread.
"wschwendt" wrote : One problem is that unfortunately Gavin King appears to be no longer present on this forum (yes, I understand that he's probably awfully busy and cannot answer mundane support questions here).
If you can persuade it us it's worth us looking at we can distill it down for him and see what he says (yes, its worth looking at IMO :) ). Gavin is busy with Web Beans atm.
anonymous wrote : And the following approach is not viable either: We cannot simply access a component from the parent conversation and call a property Setter of this component with the ending result of the nested conversation supplied as argument for this Setter.
This is what you are supposed to be able to do.
anonymous wrote : The reason is that when a component from the parent conversation is called while the nested conversation is still in progress, the ManagedEntityIdentityInterceptor saves wrappers for the called component in the scope of the nested conversation (!) and not the scope of the parent conversation.
I'm 90% sure this is a bug. Do you have a JIRA issue open for it? Can you point me at it if you do? I need to review it carefully with Norman.
anonymous wrote : I'm puzzled by the fact that Seam offers nothing yet in this regard. A feature like that would be highly useful when modeling complex flows and composing them of one or more subflows. I hope that an output-mapper gets added to Seam, in order to avoid having to resort to ugly hacks such as writing from the nested conversation to the parent conversation scope.
|
Even if you were able to write attributes back to the parent conversation do you still think this would be useful?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095020#4095020
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095020
18Â years, 9Â months
[JBoss Seam] - s:button action cannot resolve el expression
by tynor
Seam 2.0.0.CR1
I'm flumoxed. I have a simple rich:dataTable that contains some items. I can happily print property values of the items, and even use s:link to dynamically invoke a view based on an object properly:
(this works):
| <rich:dataTable id="pendingItems"
| var="item"
| value="#{dashboard.pendingItems}" >
| <h:column id="action">
| <f:facet name="header">Item</f:facet>
| <s:link
| value="Edit..." view="#{item.editorView}">
| <f:param name="itemId" value="#{item.itemId}" />
| </s:link>
| </h:column>
|
(the following, however, prints the item property as the value of the button name (demonstrating that item is definitely defined), but when I click on the button, I get
javax.el.PropertyNotFoundException with message: "Target Unreachable, identifier 'item' resolved to null"
Huh?
| <s:button value="Do Something to #{item.name}" action="#{item.doSomething}">
| <f:param name="itemId" value="#{item.itemId}" />
| </s:button>
|
Perhaps the "item" object is in the wrong context (page vs. conversation?). How can I cope?
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095016#4095016
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095016
18Â years, 9Â months