[jboss-user] [JBoss Seam] - Re: REST applications with Seam and the Restlet framework (n
Hi Sanjeev, I am using Restlet with Seam. I've not posted any details for a while but I will try to find time to post an updated - and fuller - example soon. It's worth remembering that neither the JBoss Seam or Restlet team support integrating the two projects (although there was interest and curiosity). As far as I know our project is the only implementation like this. Best regards, Dig. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4052289#4052289 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4052289 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: EJBs in muliple JARs with Seam (JNDI issue?)
I have resolved this issue. I didn't need to use @JndiName or do anything else special (in any case, thanks Gavin). I'm not entirely sure what the problem was but it went away when I recreated my environment from scratch. My problem was caused by beans not appearing at the root of the JNDI context (for some unknown reason). I do recommend looking at your JNDI tree if you have a similar issue. If using Embeddable EJB see http://wiki.jboss.org/wiki/Wiki.jsp?page=EmbeddableJNDIView. So, as far as I can see there are no issues with having multiple EJB JARs within a Embeddable EJB 3.0 application, so long as you get the JNDI paths correct (as in Seam documentation). It's also important to remember to have META-INF/ejb-jar.xml and seam.properties within the JAR. You'll also probably need to explicitly define each Entity (using class elements) in your persistence.xml. Dig.[/url] View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3979805#3979805 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3979805 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - EJBs in muliple JARs with Seam (JNDI issue?)
Hi. I'm looking for advice on how to use multiple EJB JAR files within a Seam application running with JBoss Embeddable EJB 3.0. The problem relates to EJB JNDI locations and how Seam discovers the EJB components. I have several libraries of JavaBean and EJB3 Seam components. Each library lives in it's own JAR file. This works fine in JBoss AS but I'm having trouble using multiple JARs with JBoss Embeddable EJB 3.0. I know that my application works fine if all the beans are in the same classpath / JAR file. However when I rebuild and run the app with multiple JARs Seam does not pick up the EJBs in the JARs that are not the main/home JAR. I can see that the EJBs have been deployed properly by the container and that the problem is that Seam is looking in the wrong place for the EJBs in other JARs. What is the best way to tell Seam to look in different JNDI locations when EJBs are deployed in multiple JARs? Here is a snapshot of my JNDI tree when the EJBs are deployed in *separate* JARs. There are two 'JARs', one named 'project' and the other named 'templating-ejb'. GLOBAL JNDI | +- UserTransaction (class: org.jboss.ejb3.embedded.UserTransactionImpl) | +- UserServiceBean (class: org.jnp.interfaces.NamingContext) | | +- local (proxy: $Proxy39 implements interface org.restlet.seam.UserService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject) | | | - | java:/ Namespace | +- comp.ejb3 (class: javax.naming.Context) | | NonContext: null | +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter) | +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource) | +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory) | +- TransactionManager (class: org.jboss.tm.TxManager) | | | - | EJB ENCs |jboss.j2ee:jar=templating-ejb,name=SkinServiceBean,service=EJB3 | +- env (class: org.jnp.interfaces.NamingContext) | |jboss.j2ee:jar=project,name=UserServiceBean,service=EJB3 | +- UserTransaction (class: org.jboss.ejb3.tx.UserTransactionImpl) | +- env (class: org.jnp.interfaces.NamingContext) | | +- org.restlet.seam.UserServiceBean (class: org.jnp.interfaces.NamingContext) | | | +- em (class: org.jboss.ejb3.entity.TransactionScopedEntityManager) | Here is a snapshot of my JNDI tree when the EJBs are deployed in the *same* JAR. There is one JAR named 'production'. GLOBAL JNDI | +- UserTransaction (class: org.jboss.ejb3.embedded.UserTransactionImpl) | +- UserServiceBean (class: org.jnp.interfaces.NamingContext) | | +- local (proxy: $Proxy41 implements interface org.restlet.seam.UserService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject) | +- SkinServiceBean (class: org.jnp.interfaces.NamingContext) | | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory) | | +- local (class: java.lang.Object) | | | - | java:/ Namespace | +- comp.ejb3 (class: javax.naming.Context) | | NonContext: null | +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter) | +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource) | +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory) | +- TransactionManager (class: org.jboss.tm.TxManager) | | | - | EJB ENCs |jboss.j2ee:jar=production,name=UserServiceBean,service=EJB3 | +- UserTransaction (class: org.jboss.ejb3.tx.UserTransactionImpl) | +- env (class: org.jnp.interfaces.NamingContext) | | +- org.restlet.seam.UserServiceBean (class: org.jnp.interfaces.NamingContext) | | | +- em (class: org.jboss.ejb3.entity.TransactionScopedEntityManager) | |jboss.j2ee:jar=production,name=SkinServiceBean,service=EJB3 | +- UserTransaction (class: org.jboss.ejb3.tx.UserTransactionImpl) | +- env (class: org.jnp.interfaces.NamingContext) | | +- com.jellymold.templating.SkinServiceBean (class: org.jnp.interfaces.NamingContext) | | | +- em (class: org.jboss.ejb3.entity.TransactionScopedEntityManager) | And here you can see the relevant section from my startup logs (separate JARS). 17:55:17,720 DEBUG [EJB3StandaloneBootstrap] !!loadMBeanServer servers 0 | 17:55:17,720 DEBUG [EJB3StandaloneBootstrap] !!loadMBeanServer creating... | 17:55:19,691 WARN [BeanSchemaBinding] You should use the 2.0 version of the Microcontainer xml. xmlns='urn:jboss:bean-deployer:2.0' | 17:55:20,087 DEBUG [BeanXMLDeployer] Parsing
[jboss-user] [JBoss Seam] - Re: EJBs in muliple JARs with Seam (JNDI issue?)
Clearly the subject should say 'multiple' not 'muliple'. My apologies. Dig. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3979431#3979431 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3979431 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - REST applications with Seam and the Restlet framework (no JS
I have created a proof-of-concept application based on Seam and the Restlet framework. Fortunately Seam has been designed with this kind of integration in mind and the job was not difficult. I thought other users might like to see how easy this is. By using Seam Restlets I can reuse my existing Seam components within a dedicated REST environment and still have access to EJB 3.0 via Seam and the JBoss Embeddable EJB 3.0 container. I'm considering using the Restlet framework to build full featured web applications backed by Seam - but of course, those apps need to be RESTful. JSF offers a different approach which is not appropriate to the projects I'm currently working on. I will still use Seam with JSF where relevant (as well as Seam's REST functionality). This post is a follow up to my earlier post on embedding Seam (http://www.jboss.com/index.html?module=bbop=viewtopict=92597). Thanks are due to Gavin for pointing me in the right direction. If you need to know more about Restlets look at http://www.restlet.org. My application allows you to see the name of users by accessing /users/[id] and is similar to example Restlet code. The application uses the Seam MockServletContext to simulate the presence of a Servlet container. Here is how I start Seam and the Restlet framework: | public class SeamContainer extends Container { | | public SeamContainer() throws Exception { | | // we need to wrap all this in a call via Seam | Lifecycle.beginCall(); | | // retrieve Context from our Container | Context context = getContext(); | | // add an HTTP server connector to the Restlet container | getServers().add(Protocol.HTTP, 8182); | | // attach a filter to manage calls via Seam | SeamCallFilter seamCallFilter = new SeamCallFilter(); | setRoot(seamCallFilter); | | // attach a log Filter to the container | LogFilter logFilter = new LogFilter(context, org.restlet.seam); | seamCallFilter.setNext(logFilter); | | // create a host router matching calls to the server | HostRouter host = new HostRouter(context, 8182); | seamCallFilter.setNext(host); | | // create the user router | Router userRouter = new Router(context); | host.getScorers().add(/users/[0-9]+, userRouter); | userRouter.getScorers().add($, getSeamRestlet(userRestlet)); | | // done with Seam for now | Lifecycle.endCall(); | } | | public static void main(String[] args) { | ServletContext servletContext = new MockServletContext(); | try { | // start JBoss Seam | new Initialization(servletContext).init(); | Lifecycle.setServletContext(servletContext); | // start the container | new SeamContainer().start(); | // TODO: stop JBoss Seam - when we make this a service | // TODO: Lifecycle.endApplication(servletContext); | } catch (Exception e) { | System.err.println(Can't launch the Web server.\nAn unexpected exception occured:); | e.printStackTrace(System.err); | } | } | | public Restlet getSeamRestlet(String name) { | return (Restlet) Component.getInstance(name, true); | } | } | Note that my Restlet is also a Seam component, though I'm not using this to do anything right now. Restlet objects are shared by many calls so we need to be careful when injecting Seam components. Here is the Restlet source: | @Name(userRestlet) | @Startup | @Scope(ScopeType.APPLICATION) | public class UserRestlet extends Restlet { | | private final static Logger log = Logger.getLogger(UserRestlet.class); | | public void handleGet(Call call) { | | String output; | | // get user by id | String id = call.getBaseRef().getLastSegment(); | log.debug(handleGet() user id: + id); | | // load user with id and create output | UserService userService = getUserService(); | User user = userService.loadUser(new Long(id)); | if (user != null) { | log.debug(handleGet() user found); | output = User with name: + user.getName(); | } else { | log.debug(handleGet() user NOT found); | output = User not found; | } | | // all done | call.setOutput(new StringRepresentation(output, MediaType.TEXT_PLAIN)); | } | | public UserService getUserService() { | return (UserService) Component.getInstance(userService, true); | } | } The magic bit is a Restlet Filter which I have called SeamCallFilter. This wraps all calls that come into my Restlet application and handles the start and end of a call to
[jboss-user] [JBoss Seam] - Re: Using Seam with JBoss Embeddable EJB 3.0. Any advice?
There is a follow up to this post here http://www.jboss.com/index.html?module=bbop=viewtopicp=3978556 View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3978557#3978557 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3978557 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: REST applications with Seam and the Restlet framework (n
Sure, I'll work on a runnable demo for you. It shouldn't take long. I'll mimic the environment of the Seam examples as much as I can (though it will run as a console application). I'm not sure what you'd need a patch for? I didn't change any part of Seam. Though I do suggest you modify Seam to make it easier to use away from Servlets/JSF. Dig. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3978595#3978595 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3978595 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: REST applications with Seam and the Restlet framework (n
I have created a JIRA issue and attached the example source. http://jira.jboss.org/jira/browse/JBSEAM-422 Later I will create some feature requests to make integrations of this kind (Restlet Seam) easier. Dig. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3978612#3978612 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3978612 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Using Seam with JBoss Embeddable EJB 3.0. Any advice?
Hi, I want to use Seam in an application that runs outside of a Servlet container. I'm looking for pointers on how best to do this. My application will be a REST based API service. It needs to interact with my existing EJB3 beans which are Seam components. My intention is to use the Restlet API with a lightweight HTTP server, such as Simple, along with the Embeddable EJB 3.0 configuration. I've got this working fine, my problem is how to add, start-up and use Seam in this environment. I've been using Seam for many months and I'm familiar with using it within JBoss AS. I understand that using Seam away from JSF will remove much of the functionality of Seam. I'm prepared to code around this and perhaps I'll need to simulate some JSF phases (as in Seam testing examples). My questions are: 1) How should I initialise Seam with Embeddable EJB 3.0? 2) How best to avoid issues related to not having JSF around? 3) Do I need to add to or replace any core Seam classes? 4) Any other advice? Many thanks in advance for your help, Dig. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3977883#3977883 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977883 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Using Seam with JBoss Embeddable EJB 3.0. Any advice?
Thanks for the reply Gavin. I see what you mean. I had started to change Seam code (commenting stuff out and duplicating classes such as Initialization) but I see that Seam is firmly hooked into the Servlet API. I think you would be best placed to make the Servlet API pluggable... not to mention JSF. A job for another day! In the mean time I'll see how far I can get in making a mock Servlet implementation that sits between the Restlet API and Seam. I hope I don't need to do the same for JSF. I'll let you know if I have any success. Dig. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3977925#3977925 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3977925 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Class loading problem
Hi. I'm getting a similar error. In my case an interface of mine cannot be found. The error seems random such that if I just redeploy, the error goes away. This used to work... I'm using Seam from CVS. Is Seam errantly tring to load interfaces and abstract classes as classes? My stack trace is below. Does anybody have an idea of what is happening? 18:54:41,018 ERROR [[/noticeboard]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener | net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException--null | at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237) | at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) | at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317) | at org.jboss.seam.Component.createProxyFactory(Component.java:1585) | at org.jboss.seam.Component.init(Component.java:218) | at org.jboss.seam.Component.init(Component.java:165) | at org.jboss.seam.init.Initialization.addComponent(Initialization.java:933) | at org.jboss.seam.init.Initialization.addComponent(Initialization.java:955) | at org.jboss.seam.init.Initialization.addComponents(Initialization.java:863) | at org.jboss.seam.init.Initialization.init(Initialization.java:550) | at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:32) | at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729) | at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187) | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) | 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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503) | at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164) | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) | at org.apache.catalina.core.StandardContext.init(StandardContext.java:5116) | 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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503) | at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164) | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) | at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297) | 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.GeneratedMethodAccessor1248.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.GeneratedMethodAccessor5.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
[jboss-user] [JBoss Seam] - Re: Class loading problem
Stan, thanks for the help. Your UseJBossWebLoader trick did not work for me though. Is this perhaps a problem with org.jboss.seam.Component.createProxyFactory? This seems to be calling net.sf.cglib.proxy.Enhancer.createClass on my interface and on rdewell's abstract class. What does Gavin think? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3964484#3964484 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3964484 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: s:link view=
I raised a related issue some time ago: http://jira.jboss.org/jira/browse/JBSEAM-216 This was to aid developers in creating nice looking URLs whilst still using Seam tags (for conversation management, etc.). I currently use an extended version of s:link (see issue above) along with url rewrites to create URLs which are prettier. It would be great if Gavin could take a look at s:link and consider these issues and the challenge of creating nice URLs. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3961057#3961057 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3961057 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user