-
1. Re: Step-by-Step Seam Getting Started Guide
aozoren Aug 9, 2006 4:53 PM (in response to james.williams)
1. In Step #5 - "seam scaffold-wtp-project" does not do anything since "scaffold-wtp-project" is not one the parameters defined in seam.sh. I hope I am not using a different seam-gen than you.
2. Eclipse reports a problem in "ejb-jar.xml" file. Problem is "An EJB module must contain one or more enterprise beans.". Eclipse project is created before seam-gen is run and refreshed after seam-gen. -
2. Re: Step-by-Step Seam Getting Started Guide
wondermike Aug 10, 2006 12:16 AM (in response to james.williams)Hi, after typing 'seam scaffold-wtp-project sample' instead of 'seam scaffold-wtp-project' in step #5 the sample worked for me.
Thanks for this tutorial! Michael -
3. Re: Step-by-Step Seam Getting Started Guide
manuel.gentile Aug 10, 2006 5:01 AM (in response to james.williams)Great tutorial!
BTW, can you show us how create seam project by reverse engineer on annotated bean?!?!!?
Thanks! -
4. Re: Step-by-Step Seam Getting Started Guide
james.williams Aug 10, 2006 11:16 AM (in response to james.williams)Hi, after typing 'seam scaffold-wtp-project sample' instead of 'seam scaffold-wtp-project' in step #5 the sample worked for me.
Thanks for this tutorial!
Thanks for spotting the typo, Michael!
I fixed the wiki so others shouldn't encounter this issue.
James -
5. Re: Step-by-Step Seam Getting Started Guide
james.williams Aug 10, 2006 11:19 AM (in response to james.williams)Great tutorial!
BTW, can you show us how create seam project by reverse engineer on annotated bean?!?!!?
That's a very good idea for a tutorial. Have you figured out how to get the reverse engineer plugins to work yet?
If so, wanna contribute? If not, wanna figure it out and author a wiki?
I may or may not be able to draft a reverse engineering wiki, but I do know that this wiki worked for me awhile back: http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossSEAMReverseEngineerGuide
James -
6. Re: Step-by-Step Seam Getting Started Guide
aozoren Aug 10, 2006 5:33 PM (in response to james.williams)I guess I am the only Mac user here. :)
seam.sh is missing the following parameter that seam.bat has.
if [ "${seamtask}" = scaffold-wtp-project ]
then
ant new-project -Dproject.name=${projectname} -Dscaffold=true
fi
"An EJB module must contain one or more enterprise beans." still remains.. -
7. Re: Step-by-Step Seam Getting Started Guide
james.williams Aug 11, 2006 9:33 AM (in response to james.williams)seam.sh is missing the following parameter that seam.bat has.
if [ "${seamtask}" = scaffold-wtp-project ] then ant new-project -Dproject.name=${projectname} -Dscaffold=true fi
Another good catch! I fixed seam.sh in seam-gen, so that won't screw up others."An EJB module must contain one or more enterprise beans." still remains..
I don't have OS/X so I'll have to defer to someone else who can identify what's still wrong with the sample eclipse project on mac.
James -
8. Re: Step-by-Step Seam Getting Started Guide
aozoren Aug 11, 2006 8:07 PM (in response to james.williams)More findings..
1. seam.sh is missing one more parameter (shown below)
if [ "${seamtask}" = new-wtp-project ]
then
ant new-wtp-project -Dproject.name=${projectname}
fi
2. Using "new-wtp-project" parameter actually works and creates correct ejb-jar.xml like below..
<ejb-jar>
<assembly-descriptor>
<interceptor-binding>
<ejb-name>*</ejb-name>
<interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor-binding>
</assembly-descriptor>
</ejb-jar>
Using "scaffold-wtp-project" does not work since it creates the ejb-jar.xml below..
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>
sampleEJB</display-name>
</ejb-jar>
That needs to be corrected I believe..
3. After fixing the problem #2, sample project successfully deployed but gave the error below..
02:23:01,632 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=sampleEJB.jar
java.lang.RuntimeException: Interceptor class not found: org.jboss.seam.ejb.SeamInterceptor
Checking the web.xml (of sample) revealed what is below..
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
sampleWeb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
However, the blank project had the correct web.xml shown below..
<?xml version="1.0" ?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<filter-name>Seam Exception Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
<filter-name>Seam Redirect Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
<filter-mapping>
<filter-name>Seam Exception Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Seam Redirect Filter</filter-name>
<url-pattern>*.seam</url-pattern>
</filter-mapping>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
</web-app>
However correcting this problem got me the error below..
02:44:45,210 ERROR [[/sampleWeb]] Error configuring application listener of class org.jboss.seam.servlet.SeamListener
java.lang.ClassNotFoundException: org.jboss.seam.servlet.SeamListener
So I compared the classpath of both web apps (blank and sample)..
blank had "JBOSS 4.0" library group, sample did not.
blank had 5 jars under "Web App Libraries", sample none.
It is no wonder sample project does not work at all..
4. I don't understand why in image http://wiki.jboss.org/wiki/attach?page=JBossSeamGettingStartedGuideStep4%2Ffigure-4.7.png, sampleEJB project does not show the error indicator (red cross). At this point it generated the incorrect ejb-jar.xml and it must show the error indicator.
Later the error indicator is visible in image http://wiki.jboss.org/wiki/attach?page=JBossSeamGettingStartedGuideStep5%2Ffigure-5.5.png. So was there an error or not?
Red cross magically disappears in image http://wiki.jboss.org/wiki/attach?page=JBossSeamGettingStartedGuideStep5%2Ffigure-5.7.png.
I am baffled.. Why on earth this seam-gen thingy creates a perfect sample project for some people yet does not work for me..
Maybe it is the late hour.. I need to check everything with fresh eyes in the morning.. :) -
9. Re: Step-by-Step Seam Getting Started Guide
aozoren Aug 11, 2006 8:44 PM (in response to james.williams)One more thing...
in page.ftl and template.ftl, namespaces are defined as follows..
<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">
I believe the "f" namespace should be as follows
"http://java.sun.com/jsf/core", or the f tags don't not work.. For instance for loading bundles.. Talking about message bundles, it would be nice to put one under "blankWeb/WebContent/WEB-INF/classes"
Also, there are two template.xhtmls in the blank project. The one under "WebContent" is not used by the generated pages. -
10. Re: Step-by-Step Seam Getting Started Guide
cja987 Aug 14, 2006 12:04 AM (in response to james.williams)"An EJB module must contain one or more enterprise beans." still remains..
That's a normal validation failure, since there actually aren't any beans yet. You can silence it by editing the EJB's META-INF/ejb-jar.xml file and taking the schema attribute off the opening <ejb-jar> tag, i.e. change this (wrapping added):<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
To this:<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
You can change it back after you've actually added a bean. -
11. Re: Step-by-Step Seam Getting Started Guide
cja987 Aug 14, 2006 12:30 AM (in response to james.williams)Actually it looks like it's not that simple. If I take that shortcut, the sample fails to deploy:
:18:55,245 ERROR [MainDeployer] Could not create deployment: file:/pkg/jboss-4.0.4.GA/server/default/tmp/deploy/tmp3975sample.ear-contents/sampleEJB.jar org.jboss.deployment.DeploymentException: expected one enterprise-beans tag at org.jboss.metadata.MetaData.getUniqueChild(MetaData.java:113) at org.jboss.metadata.ApplicationMetaData.importEjbJarXml(ApplicationMetaData.java:371) at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:166) at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:541) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... etc ...
Curiously, this only works if I use the org.jboss package names given in the example when setting up seamgen. If you don't use those package names (I used org.example) then the application deploys fine, though it fails to actually show any example content. -
12. Re: Step-by-Step Seam Getting Started Guide
christian.bauer Aug 14, 2006 1:35 AM (in response to james.williams)"org.jboss" package names for example code and especially screenshots and console output is not a good idea in any case. The tutorial should be rewritten with "my.package".
-
13. Re: Step-by-Step Seam Getting Started Guide
james.williams Aug 14, 2006 6:09 PM (in response to james.williams)I think you might have a permissions issue. In your case seam-gen doesn't appear to overwrite existing files like ejb-jar.xml when creating a new project, although the ant task does define overwrite explicitly. Those files are created initially by eclipse WTP, but we want to overwrite them with the seam-gen versions.
Maybe eclipse is generating the files under a different user, or not providing "rwx" to the files that that seam-gen is trying to overwrite.
James -
14. Re: Step-by-Step Seam Getting Started Guide
lowecg2004 Aug 14, 2006 7:10 PM (in response to james.williams)I'm also getting this problem on WinXP. I checked ejb-jar.xml, and it hadn't been modified. I replaced sampleEJB\ejbModule\META-INF\ejb-jar.xml with the file in seam-gen\resources\META-INF. This time, when I ran the application I received the following error:
ejb-jar.xml must either obey the right xml schema or define a valid DOCTYPE!
Adding the following fixed this...:<?xml version="1.0" encoding="UTF-8"?> <ejb-jar version="3.0" 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/ejb-jar_3_0.xsd">
...however, I now get the following:00:06:51,781 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=sampleEJB.jar java.lang.RuntimeException: Interceptor class not found: org.jboss.seam.ejb.SeamInterceptor at org.jboss.ejb3.interceptor.InterceptorInfoRepository.loadClass(InterceptorInfoRepository.java:513) at org.jboss.ejb3.interceptor.InterceptorInfoRepository.getOrInitialiseFromAnnotations(InterceptorInfoRepository.java:421) at org.jboss.ejb3.interceptor.InterceptorInfoRepository.initialiseDefaultInterceptors(InterceptorInfoRepository.java:411) at org.jboss.ejb3.interceptor.InterceptorInfoRepository.initialise(InterceptorInfoRepository.java:100) at org.jboss.ejb3.Ejb3HandlerFactory$DDFactory.<init>(Ejb3HandlerFactory.java:44) at org.jboss.ejb3.Ejb3HandlerFactory.getInstance(Ejb3HandlerFactory.java:79) at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:507) at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:463) at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:125) at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260) at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243) 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.create(Unknown Source) at org.jboss.system.ServiceController.create(ServiceController.java:330) at org.jboss.system.ServiceController.create(ServiceController.java:273) 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 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 $Proxy36.create(Unknown Source) at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:429) 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.create(WebServiceDeployer.java:99) at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180) at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91) 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 $Proxy37.create(Unknown Source) at org.jboss.deployment.MainDeployer.create(MainDeployer.java:953) at org.jboss.deployment.MainDeployer.create(MainDeployer.java:943) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:807) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771) at sun.reflect.GeneratedMethodAccessor13.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)