-
1. Re: Seam Application in VPS Technology
idyoshin Jan 6, 2010 5:41 AM (in response to xsalefter.xsalefter.yahoo.com)If you don't need some specific EE stuck (messaging, etc.) you can simply create your seam application as web archive (or even create it with maven, which is better in my oppinion). and simply deploy to any servlet container.
I've tested my seam applications in VPS with tomcat 6 and jetty 6 - and they worked very fast with limited resources (512Mb of memory) (but those was not as big as my recent.) .
but if you stucked on full EE infrastructure - you need to run the proper container. don't know whether VPS providers deploy that stuff.
Regards,
Ilya Dyoshin
-
2. Re: Seam Application in VPS Technology
xsalefter.xsalefter.yahoo.com Jan 6, 2010 5:57 AM (in response to xsalefter.xsalefter.yahoo.com)Hi Ilya.. Thanks for your reply. Do you create your apps using seam entity-query/entity-list and using richfaces? Or, in other word, you use a generated-code application?
And in your 512Mb environment, do you use it with database (eg mysql/postgresql)? And do you found some serious problem when play with tomcat?
Thanks.. :D.
-
3. Re: Seam Application in VPS Technology
idyoshin Jan 6, 2010 10:15 AM (in response to xsalefter.xsalefter.yahoo.com)Of course I've been using PostgreSQL. And yes application was using entitiy-query/entity-home and Richfaces.
About generation - I guess it's a not a good idea to use it (even if you already have your database). In my personal oppinion - working with seam is better without using automated code generation.
If you plan to use tomact or jetty - I'd recommended for you to use the Maven not the Seam-gen project. In maven you simply create dynamic web-app. The most interesting part is creation of the proper persistence configuration (well If you have access only for the pure tomcat or jetty without access to crete datasources) you can package everything into application.war archive :) see the example
in src/main/webapp/WEB-INF/components.xml
... <persistence:entity-manager-factory name="entityManagerFactory" persistence-unit-name="MINEPU" /> <persistence:managed-persistence-context auto-create="true" entity-manager-factory="#{entityManagerFactory}" name="entityManager" /> <transaction:entity-transaction entity-manager="#{entityManager}" /> ...
and for persistence unit in src/main/resources/META-INF/persistence.xml:
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="MINEPU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <!-- cache --> <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider" /> <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="hibernate.generate_statistics" value="true" /> <property name="hibernate.cache.use_structured_entries" value="true" /> <!-- data access --> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /> <property name="hibernate.connection.driver_class" value="org.postgresql.Driver" /> <property name="hibernate.connection.username" value="USERNAME" /> <property name="hibernate.connection.password" value="PASSWORD" /> <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5433/DATABASE" /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="true" /> <!-- connection pool --> <property name="hibernate.c3p0.min_size" value="5" /> <property name="hibernate.c3p0.max_size" value="20" /> <property name="hibernate.c3p0.timeout" value="1800" /> <property name="hibernate.c3p0.max_statements" value="50" /> </properties> </persistence-unit> </persistence>
also you should place emty seam.properties file into the src/main/resources/ folder. add faces-config.xml file with proper facelets configuration. And that's all. I've been testing my application using maven-jetty-plugin.
And don't forget to change maven default compiler configuration and point org.apache.maven.plugins:maven-compiler-plugin for at least 1.5 java target.
hope that would be helpfull.
Regards.
Ilya Dyoshin
-
4. Re: Seam Application in VPS Technology
zogehu Jan 6, 2010 12:31 PM (in response to xsalefter.xsalefter.yahoo.com)Yes I also use VPS, JBoss and PostgreSQL with limited environment (512Mb memory...)
I have only problem with base administration tasks like firewall, correct installing JBoss. I need an adminstrator, or a provider who has VPS images with preinstalled JBoss...
-
5. Re: Seam Application in VPS Technology
xsalefter.xsalefter.yahoo.com Jan 6, 2010 6:52 PM (in response to xsalefter.xsalefter.yahoo.com)Hi all.. Thanks for all great reply. It was very helpful :D.
About generation - I guess it's a not a good idea to use it (even if you already have your database). In my personal oppinion - working with seam is better without using automated code generation.Ilya.. Can you explain why? I had asking about this before, and some expert member here answer that there is no problem about EntityList/Query arch. You can see it here. Have you ever found the problem? Your comment about seam performance problem will be helpful.
Actually, what I really love about seam-gen code is entityQuery/List and the facelets scripts. It cut my job - and my team mate - over more than 60 percent about doing something CRUD code. My working flow is create entity code, run seam generate-ui, change the UI a bit, and show it to client as alpha preliminary release to know if the requirement is satisfying.
If you plan to use tomcat or jetty - I'd recommended for you to use the Maven not the Seam-gen project.Never try it before. But, can you give me a reason why you don't follow Dan Allen post about running seam-gen project on a plain vanilla tomcat ?
And how about problem after production release? Have you found some serious problem with running seam on tomcat/jetty?
For Ilya and Zoltan, can you give me info about, how big your application is? I mean, how many views, entity classes, and tables in your seam apps that running on VPS machine?
I have only problem with base administration tasks like firewall, correct installing JBoss. I need an adminstrator, or a provider who has VPS images with preinstalled JBoss...I don't know, but AFAIK some VPS hosting have service called
managed-VPS
. If you just can't manage it by your self, you can ask for managed-VPS. Of course there is a 'money-charge' for it, but for your comfort, I think you it is a one of solution.Sorry, this is no-mean for market/sell something, but FYI, you can check here , here , or here .
Thanks a lot.. :D.
-
6. Re: Seam Application in VPS Technology
xsalefter.xsalefter.yahoo.com Jan 6, 2010 6:57 PM (in response to xsalefter.xsalefter.yahoo.com)
xsa lefter wrote on Jan 06, 2010 18:52:
I don't know, but AFAIK some VPS hosting have service calledmanaged-VPS
. If you just can't manage it by your self, you can ask for managed-VPS. Of course there is a 'money-charge' for it, but for your comfort,I think you it is a one of solution.Typo. I mean
I think it is one of solution your you.
-
7. Re: Seam Application in VPS Technology
xsalefter.xsalefter.yahoo.com Jan 6, 2010 9:23 PM (in response to xsalefter.xsalefter.yahoo.com).Hi Ilya..
I know maybe my question is out of topic here.. But Im just curious about using seam cache. I see in your configuration that u used it. But when I try to add the cache to my apps, I get the following error:
org.jboss.seam.InstantiationException: Could not instantiate Seam component: chartOfAccountHome at org.jboss.seam.Component.newInstance(Component.java:2144) at org.jboss.seam.Component.getInstance(Component.java:2021) at org.jboss.seam.Component.getInstance(Component.java:1983) at org.jboss.seam.Component.getInstance(Component.java:1977) at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55) at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50) at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148) at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54) at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72) at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44) at org.jboss.el.parser.AstValue.getValue(AstValue.java:63) at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112) at org.jboss.seam.navigation.Param.getStringValueFromModel(Param.java:145) at org.jboss.seam.navigation.Pages.getStringValuesFromModel(Pages.java:748) at org.jboss.seam.ui.component.UISeamCommandBase.getUrl(UISeamCommandBase.java:62) at org.jboss.seam.ui.renderkit.ButtonRendererBase.getOnClick(ButtonRendererBase.java:37) at org.jboss.seam.ui.renderkit.ButtonRendererBase.doEncodeBegin(ButtonRendererBase.java:66) at org.jboss.seam.ui.util.cdk.RendererBase.encodeBegin(RendererBase.java:79) at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495) at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:595) Caused by: org.jboss.seam.RequiredException: @In attribute requires non-null value: chartOfAccountHome.cacheProvider at org.jboss.seam.Component.getValueToInject(Component.java:2335) at org.jboss.seam.Component.injectAttributes(Component.java:1736) at org.jboss.seam.Component.inject(Component.java:1554) at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97) at org.jboss.seam.util.Work.workInTransaction(Work.java:47) at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) at com.waditra.bean.accounting.service.ChartOfAccountHome_$$_javassist_seam_5.create(ChartOfAccountHome_$$_javassist_seam_5.java) 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.seam.util.Reflections.invoke(Reflections.java:22) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) at org.jboss.seam.Component.callComponentMethod(Component.java:2249) at org.jboss.seam.Component.callCreateMethod(Component.java:2172) at org.jboss.seam.Component.newInstance(Component.java:2132) ... 65 more
No matter I had added the following code:
@In(create=true) CacheProvider<PojoCache> cacheProvider;
My persistance.xml is:
<persistence-unit name="wrcaccounting" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <non-jta-data-source>java:comp/env/wrcaccountingDatasource</non-jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="false"/> <property name="hibernate.max_fetch_depth" value="5" /> <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" /> <!-- Only relevant if Seam is loading the persistence unit (Java SE bootstrap) --> <!-- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> --> </properties> </persistence-unit>
my context.xml is:
<Context path="/wrcaccounting"> <Resource auth="Container" name="wrcaccountingDatasource" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/wrc_accounting_dev" username="root" password="admin" maxActive="100" maxIdle="30" maxWait="10000"/> </Context>
and I just use treecache.xml from the seam distribution into my project.
Of course this is work OOTB in JBoss AS, but when I try to migration to tomcat, the error appear. Can you give me a solution?
Thank you very much if you could help me.. :).
-
8. Re: Seam Application in VPS Technology
idyoshin Jan 6, 2010 10:07 PM (in response to xsalefter.xsalefter.yahoo.com)Sorry, but I've been using ehcache only for persistence-level caching.
Actually, I haven't used seam-managed caching yet (the database speed was quite enough for me). But in my oppinion you simply haven't created seam-scoped cache in your application try adding something like
<cache:eh-cache-provider auto-create="true" name="dummyCache" configuration="META-INF/cacheconf.xml" />
to your components.xml And then inject it and use like following:
@In EhCacheProvider dummyCache;
Regards,
Ilya Dyoshin -
9. Re: Seam Application in VPS Technology
zogehu Jan 7, 2010 11:23 PM (in response to xsalefter.xsalefter.yahoo.com)Hi xsa lefter!
Thanks your advice, I will check those! I write more info about my app privately!
Z