[JBoss Seam] - seam-gen 'generate-entities' generates invalid code for tabl
by voreichel
Using seam-gen 'generate-entities' to generate a CRUD application from an existing PostgreSQL database does not generate working code.
I have the follwing two tables in my database:
Table t_user
| CREATE TABLE t_user
| (
| email character varying(255) NOT NULL,
| firstname character varying(255),
| lastname character varying(255),
| loginname character varying(255),
| "password" character varying(255),
| joined timestamp without time zone,
| CONSTRAINT t_user_pkey PRIMARY KEY (email)
| )
|
and a second table t_user_roles
| CREATE TABLE t_user_roles
| (
| t_user_email character varying(255) NOT NULL,
| element integer,
| CONSTRAINT fk8fc22a14c7001400 FOREIGN KEY (t_user_email)
| REFERENCES t_user (email) MATCH SIMPLE
| ON UPDATE NO ACTION ON DELETE NO ACTION
| )
|
element encodes which role a user is in.
When I run seam generate-entities I get no errors or warnings
| C:\seam-buch\seam\jboss-seam-2.0.0.GA>seam generate-entities
| C:\seam-buch\jdk\jdk_1_5_0_12
| Buildfile: C:\seam-buch\seam\jboss-seam-2.0.0.GA\seam-gen\build.xml
|
| init:
|
| init-properties:
| [echo] c:/seam-buch/appserv/jboss-4.2.1.GA
|
| validate-workspace:
|
| validate-project:
|
| generate-entities:
| [echo] Reverse engineering database using JDBC driver C:/seam-buch/appserv/jboss-4.2.1.GA/server\default/lib/postgresql-8.2-506.jdbc2ee.jar
| [echo] project=c:/seam-buch/workspaceJBossTools/seamquizadmin
| [echo] model=com.seamguru.seamquizadmin
| [hibernate] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
| [hibernate] 1. task: hbm2java (Generates a set of .java files)
| [hibernate] 14.11.2007 17:53:12 org.hibernate.cfg.Environment <clinit>
| [hibernate] INFO: Hibernate 3.2.5
| [hibernate] 14.11.2007 17:53:12 org.hibernate.cfg.Environment <clinit>
| [hibernate] INFO: hibernate.properties not found
| [hibernate] 14.11.2007 17:53:12 org.hibernate.cfg.Environment buildBytecodeProvider
| [hibernate] INFO: Bytecode provider name : cglib
| [hibernate] 14.11.2007 17:53:12 org.hibernate.cfg.Environment <clinit>
| [hibernate] INFO: using JDK 1.4 java.sql.Timestamp handling
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.reveng.OverrideRepository addFile
| [hibernate] INFO: Override file: c:\seam-buch\workspaceJBossTools\seamquizadmin\resources\seam-gen.reveng.xml
| [hibernate] 14.11.2007 17:53:13 org.hibernate.connection.DriverManagerConnectionProvider configure
| [hibernate] INFO: Using Hibernate built-in connection pool (not for production use!)
| [hibernate] 14.11.2007 17:53:13 org.hibernate.connection.DriverManagerConnectionProvider configure
| [hibernate] INFO: Hibernate connection pool size: 20
| [hibernate] 14.11.2007 17:53:13 org.hibernate.connection.DriverManagerConnectionProvider configure
| [hibernate] INFO: autocommit mode: false
| [hibernate] 14.11.2007 17:53:13 org.hibernate.connection.DriverManagerConnectionProvider configure
| [hibernate] INFO: using driver: org.postgresql.Driver at URL: jdbc:postgresql:seamDB
| [hibernate] 14.11.2007 17:53:13 org.hibernate.connection.DriverManagerConnectionProvider configure
| [hibernate] INFO: connection properties: {user=postgres, password=****}
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: RDBMS: PostgreSQL, version: 8.2.5
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.2 JDBC2 with NO SSL (build 506)
| [hibernate] 14.11.2007 17:53:13 org.hibernate.dialect.Dialect <init>
| [hibernate] INFO: Using dialect: org.hibernate.dialect.PostgreSQLDialect
| [hibernate] 14.11.2007 17:53:13 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
| [hibernate] INFO: Using default transaction strategy (direct JDBC transactions)
| [hibernate] 14.11.2007 17:53:13 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
| [hibernate] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Automatic flush during beforeCompletion(): disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Automatic session close at end of transaction: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: JDBC batch size: 15
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: JDBC batch updates for versioned data: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Scrollable result sets: enabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: JDBC3 getGeneratedKeys(): disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Connection release mode: auto
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Default batch fetch size: 1
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Generate SQL with comments: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Order SQL updates by primary key: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Order SQL inserts for batching: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
| [hibernate] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
| [hibernate] 14.11.2007 17:53:13 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
| [hibernate] INFO: Using ASTQueryTranslatorFactory
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Query language substitutions: {}
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: JPA-QL strict compliance: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Second-level cache: enabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Query cache: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory createCacheProvider
| [hibernate] INFO: Cache provider: org.hibernate.cache.HashtableCacheProvider
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Optimize cache for minimal puts: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Structured second-level cache entries: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Statistics: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Deleted entity synthetic identifier rollback: disabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Default entity-mode: pojo
| [hibernate] 14.11.2007 17:53:13 org.hibernate.cfg.SettingsFactory buildSettings
| [hibernate] INFO: Named query checking : enabled
| [hibernate] 14.11.2007 17:53:13 org.hibernate.connection.DriverManagerConnectionProvider close
| [hibernate] INFO: cleaning up connection pool: jdbc:postgresql:seamDB
| [hibernate] 14.11.2007 17:53:13 org.hibernate.tool.Version <clinit>
| [hibernate] INFO: Hibernate Tools 3.2.0.b10
| 14.11.2007 17:53:13 org.hibernate.connection.DriverManagerConnectionProvider close
| INFO: cleaning up connection pool: jdbc:postgresql:seamDB
| [hibernate] 2. task: generic exportertemplate: view/list.xhtml.ftl
| [hibernate] 3. task: generic exportertemplate: view/view.xhtml.ftl
| [hibernate] 4. task: generic exportertemplate: view/view.page.xml.ftl
| [hibernate] 5. task: generic exportertemplate: view/edit.xhtml.ftl
| [hibernate] 6. task: generic exportertemplate: view/edit.page.xml.ftl
| [hibernate] 7. task: generic exportertemplate: src/EntityList.java.ftl
| [hibernate] 8. task: generic exportertemplate: view/list.page.xml.ftl
| [hibernate] 9. task: generic exportertemplate: src/EntityHome.java.ftl
| [hibernate] 10. task: generic exportertemplate: view/layout/menu.xhtml.ftl
| [javaformatter] Java formatting of 14 files completed. Skipped 0 file(s).
| [echo] Type 'seam restart' and go to http://localhost:8080/seamquizadmin
|
| BUILD SUCCESSFUL
| Total time: 3 seconds
|
| C:\seam-buch\seam\jboss-seam-2.0.0.GA>
|
Running seam restart terminates without warning or error:
| C:\seam-buch\seam\jboss-seam-2.0.0.GA>seam restart
| C:\seam-buch\jdk\jdk_1_5_0_12
| Buildfile: C:\seam-buch\seam\jboss-seam-2.0.0.GA\seam-gen\build.xml
|
| init:
|
| init-properties:
| [echo] c:/seam-buch/appserv/jboss-4.2.1.GA
|
| validate-workspace:
|
| validate-project:
|
| restart:
| [echo] Restarting project 'seamquizadmin'
|
| init:
|
| compile:
| [javac] Compiling 14 source files to c:\seam-buch\workspaceJBossTools\seamquizadmin\exploded-archives\seamquizadmin.jar
|
| copyclasses:
|
| jar:
| [copy] Copying 1 file to c:\seam-buch\workspaceJBossTools\seamquizadmin\exploded-archives\seamquizadmin.jar\META-INF
| [copy] Copying 1 file to c:\seam-buch\workspaceJBossTools\seamquizadmin\exploded-archives\seamquizadmin.jar
|
| war:
| [copy] Copying 25 files to c:\seam-buch\workspaceJBossTools\seamquizadmin\exploded-archives\seamquizadmin.war
|
| ear:
|
| datasource:
|
| explode:
| [copy] Copying 16 files to c:\seam-buch\appserv\jboss-4.2.1.GA\server\default\deploy\seamquizadmin.ear\seamquizadmin.jar
| [copy] Copying 25 files to c:\seam-buch\appserv\jboss-4.2.1.GA\server\default\deploy\seamquizadmin.ear\seamquizadmin.war
|
| restart:
|
| BUILD SUCCESSFUL
| Total time: 2 seconds
|
| C:\seam-buch\seam\jboss-seam-2.0.0.GA>
|
Then I tried to open the generated webapp in a browser:
[img]http://www.seamguru.com/jbossforum/img/seamgenDBbug.jpg[/img]
[urlhttp://www.seamguru.com/jbossforum/img/seamgenDBbug.jpg[/url]
The error message tells me that class 'com.seamguru.seamquizadmin.TUserList' does not have a property 'tUser'.
The generated class TUserList defines a member tUser and a getter (getTUser). When I change the getter to gettUser. Please note the lowercase 't' in TUser. I get one step further.
Now I get a similar error for class TUserRoleList. Making similar change fixes this problem too.
Now the home screen of the application is rendered correctly. But selecting 'TUserRolesList' from the menu on the top of the page gives a similar error message as the the two before. Now property 'tUserEmail' cannot be found.
See [img]http://www.seamguru.com/jbossforum/img/seamDBBug2.png[/img]
See http://www.seamguru.com/jbossforum/img/seamDBBug2.png
My questions are:
Has anyone else seen this error?
Why does the error message complain about 'tUserEmail' / 'tUser' as far as I can see 'tUser' / 'tUserEmail' is not used in the XHTML pages?
Any response welcome!
Volker
Environment Information:
| Seam 2.0.0.GA
| PostgreSQL 8.2
| JBoss 4.2.1.GA
| Windows XP
| Java 1.5
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104710#4104710
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104710
18 years, 8 months
[JBoss Portal] - Re: High-level information concerning the flow of a portal r
by chris.laprun@jboss.com
"tulumvinh" wrote :
| I am not interested in the gory details of the PortalServlet, I am more interested in the information at a higher level. For example, I am interested in the flow of a request when I click on the "login" link.
| The high-level overview will help me understand how to best customized the portal.
|
I'm afraid that the details of what happens is mostly gory details... :)
"tulumvinh" wrote :
| 1. the url for the login link is http://host/webapplicationcontext/auth/portal/default/default. I know that /auth is mapped to the servlet descriptor of jboss-web-deployer and "/portal/default" is the portal name and its page. What is the last "/default"?
|
http://docs.jboss.com/jbportal/v2.6.2/referenceGuide/html/urls.html
"tulumvinh" wrote :
| 2. The login form action is "j_security_check". When this request is sent to the server side and processed by PortalServlet, what happens after that?
|
The reference guide (http://docs.jboss.com/jbportal/v2.6.2/referenceGuide/html/) might contain the information that you need. Without context of what you're trying to achieve, it's difficult to answer your query. Plus, an explanation of Portal internals are outside of the scope of this forum. One could make a point that such an overview should be more prominent in the documentation and, if you feel strongly about it, please open a JIRA task for it. Ultimately, though, the source is the best documentation for the internal behavior of Portal. If you need more help figuring things out, you might want to consider buying consulting and/or support from us...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104703#4104703
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104703
18 years, 8 months
[Clustering/JBoss] - SFSB failover not working as expected
by chrismeadows
Hi there,
I'm testing two JBoss 4.2.2 GA nodes in a cluster using the 'all' config. The nodes cluster together fine. I then run a multithreaded client to start up 200 or so SFSBs that cycle through a number of states. The client requests are are load balanced in the cluster as expected.
However, when I test failover by killing one of the nodes mid test, I get various exceptions such as
javax.ejb.NoSuchEJBException, Could not find stateful bean: 4ss55r-gaev0q-f901ig99-1-f901ok6j-5w (bean was marked as removed)
and
javax.naming.NamingException, Could not dereference object
If I catch the exceptions and retry the client requests, then the SFSB state is sorted out and the results are as they should be
I might have missed something here, but I was expecting the client side interceptors to reroute client requests automatically on cluster member failure, i.e. I shouldn't have to programmatically catch the exceptions and retry.
I'm using HA-JNDI as follows
| jndiProps.put("java.naming.provider.url", "jnp://foo.zub.com:1100,jnp://bar.zub.com:1100");
| jndiProps.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| jndiProps.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
|
and I've added retry interceptors as per section 16.3.1.1 of the JBoss 4 manual.
Did I miss something? Or have I misunderstood how JBoss failover is dealt with from the client?
Any insight/clarification gratefully received,
Regards,
Chris
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104701#4104701
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104701
18 years, 8 months
[Installation, Configuration & DEPLOYMENT] - Problems with shutting down the JBoss after ava.lang.OutOfMe
by nezdali
Hello,
I having troubles with shutting down the JBoss AS 4.2.2.GA after it gets an error running my application
2007-11-14 18:54:59,334 ERROR [org.apache.catalina.connector.CoyoteAdapter] An exception or error occurred in the container during the request processing
| java.lang.OutOfMemoryError: PermGen space
|
When i try to shutdown -S, it throws an exception:
Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 [Root exception is javax.naming.CommunicationException: Failed to retrieve stub from server localhost:1099 [Root exception is java.io.EOFException]]
| at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1562)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jboss.Shutdown.main(Shutdown.java:214)
| Caused by: javax.naming.CommunicationException: Failed to retrieve stub from server localhost:1099 [Root exception is java.io.EOFException]
| at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:268)
| at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
| ... 4 more
| Caused by: java.io.EOFException
| at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2232)
| at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
| at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
| at java.io.ObjectInputStream.<init>(ObjectInputStream.java:268)
| at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:255)
| ... 5 more
|
I am starting JBoss with run.sh -c all &,
in run.conf the following settings:
#
| if [ "x$JAVA_OPTS" = "x" ]; then
| JAVA_OPTS="-Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
| fi
|
| # Enable the jconsole agent remotely on port 1120
| JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=1120"
| JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
| JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
|
What could be the problem while shutting down the JBoss?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104699#4104699
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104699
18 years, 8 months