[JBoss Seam] - I need help with scope type
by rcherchi
Hi,
I use jboss-seam-1.2.1.GA and jboss-4.0.5.GA.
I need to perform a member registration for the web site I'm working on. The registration perform some server side validation. I also have some ajax calls using javascript and seam remoting.
At the moment, it works with a stateful session bean and the "conversation" or "session" scope.
Because it's a one page process, I would say that the page scope more appropriate.
I have similar needs for other pages in the site. I use the session scope everywhere at the moment.
I can't figure out how to use correctly a page or event scope.
Would you have any recommendations for migrating from a SESSION scope to PAGE or EVENT.
Thanks for your time.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101063#4101063
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101063
18 years, 5 months
[JBoss Seam] - Re: Trouble Getting the Most Basic SeamTest to Work
by neilac333
I have moved to CR3 and based on the Wiki example have reconfigured my classpath to load libraries in a special order. Here is the classpath, which I hope is self-explanatory:
| <path id="seam.test.class.path.libs">
| <fileset dir="${seam-hibernate.lib.dir}/bootstrap" />
| <fileset dir="${seam-hibernate.lib.dir}" includes="jboss-embedded-all.jar,thirdparty-all.jar"/>
| <fileset dir="${sun-jsf.lib.dir}"/>
| <fileset dir="${commons.lib.dir}"/>
| <fileset dir="${seam-hibernate.lib.dir}" excludes="jboss-container.jar,hibernate*,jboss-seam.jar"/>
| <fileset dir="${seam-hibernate.lib.dir}" includes="hibernate*,jboss-archive-browsing.jar"/>
| <fileset dir="${seam-hibernate.lib.dir}" includes="jboss-seam.jar"/>
| </path>
|
I get this exception, which I can probably figure out on my own:
| org.jboss.deployers.spi.DeploymentException: Unable to find bootstrap file: conf/bootstrap-beans.xml in classpath
| at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:200)
| 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:1006)
| at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:931)
| 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:585)
| at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
| at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
| at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
| at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
| at org.testng.TestRunner.runWorkers(TestRunner.java:678)
| at org.testng.TestRunner.privateRun(TestRunner.java:624)
| at org.testng.TestRunner.run(TestRunner.java:495)
| at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
| at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
| at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
| at org.testng.SuiteRunner.run(SuiteRunner.java:190)
| at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
| at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
| at org.testng.TestNG.run(TestNG.java:699)
| at org.testng.TestNG.privateMain(TestNG.java:824)
| at org.testng.TestNG.main(TestNG.java:802)
|
Now certain JARs in the Ant script in the example, like jboss-embedded-all.jar, are not found in the CR3 distribution. So I really need an idea as to what JARs/bootstrap files I need and in what order I need to load them.
And I thought out-of-container testing was supposed to be easy!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101060#4101060
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101060
18 years, 5 months
[JBoss Seam] - Using fine-grained pages.xml
by chris.simons
Seam wizards,
I'm using the Seam 1.21GA documentation as a guide for breaking out a lengthy pages.xml into single, page specific files.
According to the documentation, I am to break out each file into their given view-id and append .page.xml.
Therefore, I have added:
/resources/admin/da/categoryAdmin.page.xml
...
I have stripped out the corresponding page definition from pages.xml and placed into each fine-grained file. Likewise, I removed the "view-id" parameter from each fine-grained page file.
Here is what that same fine-grained file now looks like:
<!DOCTYPE pages PUBLIC
| "-//JBoss/Seam Pages Configuration DTD 1.2//EN"
| "http://jboss.com/products/seam/pages-1.2.dtd">
|
| <page conversation-required="true" no-conversation-view-id="/admin/da/moduleAdmin.xhtml">
| #{cvAdminModule.name}
| <begin-conversation nested="true" join="false"/>
| <navigation from-action="#{adminValueManager.findValuesByCategory}">
| <redirect view-id="/admin/da/valueAdmin.xhtml"/>
| </navigation>
| </page>
However, after doing so, page definitions are no longer working. Have I done something wrong? Should the fine-grained files actually go under /resources/WEB-INF? If so, the documentation may need to describe this in more detail.
Thanks for taking a look - hope someone has an tip for me to look at.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101052#4101052
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101052
18 years, 5 months
[JBoss Seam] - AbstractResource subclass gets ClientAbortException writing
by JakeC
While writing to the output stream, I get the following stacktrace:
11:03:00,031 INFO [Util] 0: Writing 16,384 bytes of 57,567 to buffer
| 11:41:42,202 INFO [Util] 0: Writing 16,384 bytes of 57,567 to buffer
| 11:41:42,202 INFO [Util] 0: Writing 16,384 bytes of 57,567 to buffer
| 11:41:42,202 INFO [Util] 0: Writing 16,384 bytes of 57,567 to buffer
| 11:41:42,202 ERROR [Util] Error serving file: <path to file>
| ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error
| at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:366)
| at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:433)
| at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:348)
| at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:392)
| at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:381)
| at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:88)
| at com.mycompany.myproject.Util.download(Util.java:93)
My code that does the writing is here:
public static void download(HttpServletResponse response, File file, String downloadName)
| throws IOException {
| FileInputStream fis = null;
| OutputStream os = null;
| if(file != null && file.exists()) {
| try {
| byte[] buf = new byte[BUF_SIZE];
| if(downloadName != null && downloadName.trim().length() > 0)
| response.setHeader("Content-Disposition", "attachment;filename=\"" +
| downloadName + "\"");
| response.setHeader("Cache-Control", "no-store");
| response.setHeader("Pragma", "no-cache");
| response.setDateHeader("Expires", 0);
| response.setContentType("application/octet-stream");
| fis = new FileInputStream(file);
| os = response.getOutputStream();
| int len = -1;
| int x = 0;
| while((len = fis.read(buf)) != -1) {
| log.info("{0}: Writing {1} bytes of {2} to buffer", x, len, file.length());
| os.write(buf, 0, len);
| }
| } catch (Throwable t) {
| log.error("Error serving file: "+file, t);
| response.sendError(HttpServletResponse.SC_NOT_FOUND);
| } finally {
| if(fis != null) try{fis.close();}catch(Throwable t){
| log.warn("Error closing input stream: " + t.getMessage(), t);
| }
| if( os != null) try{ os.flush();}catch(Throwable t){
| if("org.apache.catalina.connector.ClientAbortException".equals(t.getClass().getCanonicalName()))
| log.info("client canceled download");
| else
| log.warn("Error flushing output stream: " + t.getClass().getCanonicalName(), t);
| }
| if( os != null) try{ os.close();}catch(Throwable t){
| log.warn("Error closing output stream: " + t.getMessage(), t);
| }
| }
| } else {
| log.error("Error serving unknown file: "+file);
| response.sendError(HttpServletResponse.SC_NOT_FOUND);
| }
| }
It works just fine under http, but croaks in https. This is with a self-signed certificate, after accepting it, of course.
I checked the request path, and it is using the https protocol.
One problem I'm having on that page is that IE believes that the page contains both secure and unsecure items. However, our entire web app is completely under https, and there are no references to external resources. Looking at the source of the page, the only things with "http:" in them are the DOCTYPE dtd and the html xmlns declarations. Could that possibly have anything to do with it?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101048#4101048
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101048
18 years, 5 months
[Persistence, JBoss/CMP, Hibernate, Database] - Hibernate/JPA jars
by kuvera
Hi,
I am trying to get started with JPA/Hibernate, in a standalone application. Jars are in classpath, persistence.xml is there, but it gives me an exception on the first line:
emf = Persistence.createEntityManagerFactory("punit");
| java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
|
It looks like jar version problem, but I have the latest jars:
| antlr-2.7.6.jar 443 432 2006/05/05
| asm-attrs.jar 16 777 2005/03/17
| asm.jar 26 360 2005/03/17
| cglib-2.1.3.jar 282 338 2005/12/02
| dom4j-1.6.1.jar 313 898 2005/08/13
| ehcache-1.2.3.jar 208 048 2006/11/03
| ejb3-persistence.jar 50 574 2007/03/28
| hibernate-annotations.jar 265 130 2007/03/28
| hibernate-commons-annotations.jar 66 426 2007/03/28
| hibernate-entitymanager.jar 116 544 2007/03/28
| hibernate-validator.jar 60 992 2007/03/28
| hibernate3.jar 2 255 753 2007/07/31
| javassist.jar 471 005 2006/11/16
| jboss-archive-browsing.jar 413 698 2007/03/28
| jdbc2_0-stdext.jar 6 727 2004/06/03
| jta.jar 8 812 2004/06/03
|
(Apache commons and mysql libs are also there in another dir.)
persistence.xml is read in, making an xml syntax error complains.
| <?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="punit">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <properties>
| <property name="hibernate.show_sql" value="true" />
| <property name="hibernate.format_sql" value="true" />
| <property name="hibernate.connection.driver_class"
| value="com.mysql.jdbc.Driver" />
| <property name="hibernate.connection.url"
| value="jdbc:mysql://localhost:3306/nyilzar2?characterEncoding=utf8" />
| <property name="hibernate.connection.username" value="..." />
| <property name="hibernate.connection.password" value="..." />
| <property name="hibernate.dialect"
| value="org.hibernate.dialect.MySQLDialect" />
| </properties>
| </persistence-unit>
| </persistence>
|
Please help.
kuvera
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101046#4101046
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101046
18 years, 5 months