[JBoss Seam] - Re: Possible to write a rollback SeamTest?
by RobJellinghaus
Hm. No, actually, that's not the problem. I mean, I was sticking that @Resource tag into a SeamTest instance. Why should E-EJB inject into a SeamTest? Nothing else does....
What I wanted was the equivalent of "Component.getInstance("sessionContext")" for the EJB session context, that I could use from within the SeamTest. That would seem cleaner than your getTransactionManager() suggestion. But lacking that, I did this instead:
@Name("testAction")
| @Scope(ScopeType.CONVERSATION)
| public class TestAction implements Serializable
| {
| private static final Logger log = Logger.getLogger(TestAction.class);
|
| @In(create=true)
| private transient EntityManager entityManager;
|
| @Resource
| private SessionContext ctx;
|
| /**
| * Alter the passed-in BlogPost, then flush. If failure, then setRollbackOnly and
| * rethrow.
| */
| public void alterBlogPost (BlogPost bp) {
| try {
| bp.setTitle("newTestTitle");
|
| entityManager.flush();
| } catch (RuntimeException e) {
| log.debug("Could not flush changed blog post", e);
| ctx.setRollbackOnly(); // this line turns out to be optional!!!
| throw e;
| }
| }
| }
Then changed my test to:
testAction = (TestAction)Component.getInstance("testAction", true);
| BlogPost prior1 = priorBlogPosts.get(0);
|
| try {
| testAction.alterBlogPost(prior1);
|
| // should throw a RuntimeException, so shouldn't get here
| assert false;
| } catch (RuntimeException e) {
| log.debug("Caught expected exception", e);
| }
Works great :-) The sessionContext gets @Resource-injected into my TestAction, which flushes, blows up, and does setRollbackOnly; then it rethrows to my test case, which catches and ignores the exception.
Result: my test case passes just fine, and I avoid having to use your hacky workaround. But thanks for mentioning it anyway, you never know when you might need something like that :-D
The WEIRD thing, though, is that even if you leave out the ctx.setRollbackOnly() line, the action still rolls back when the runtime exception gets thrown out of it! Is this expected? It surprised me, but actually it's kind of cool. Is this standard Seam behavior or standard EJB3 behavior, or something else?
You never know what a test will teach you....
Cheers!
Rob
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957961#3957961
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957961
19 years, 9 months
[Installation, Configuration & Deployment] - Re: Why loading the class in EJB jar rather than the one in
by bennyckp
Please refer the scenario and the config in my first post.
In the jmx-console, I invoke the getPackageClassLoaders() of the loader with the param=ClassA.
It returns like that
anonymous wrote : [org.jboss.mx.loading.LoadMgr3$PkgClassLoader@bb365d
| {ucl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@4129e3
| { url=null ,addedOrder=0} order=1},
|
| org.jboss.mx.loading.LoadMgr3$PkgClassLoader@ee37f2
| {ucl=org.jboss.mx.loading.UnifiedClassLoader3@10cf62
| { url=file:/C:/jboss-4.0.3SP1/server/default/tmp/deploy/tmp44379mdb.jar ,addedOrder=41} order=2},
|
| org.jboss.mx.loading.LoadMgr3$PkgClassLoader@19b07e9
| {ucl=org.jboss.mx.loading.UnifiedClassLoader3@24fe6b
| { url=null ,addedOrder=0} order=3}
| ]
My question is:
1. What is the meaning of "url=null"?
2. Does the "order=1", "order=2"... determine the class loading order?
3. ClassA is loaded from mdb.jar instead of the app.war. But why?
FYI, I can see the package of ClassA (say com.XXX) only appears once in the ucl log.
anonymous wrote : ...
| [48531,UnifiedClassLoader,main] New jmx UCL with url file:/C:/jboss-4.0.3SP1/server/default/tmp/deploy/tmp44379mdb-1.3.jar
| [48531,RepositoryClassLoader,main] setRepository, repository=org.jboss.mx.loading.UnifiedLoaderRepository3@1da669c, cl=org.jboss.mx.loading.UnifiedClassLoader3@10cf62{ url=file:/C:/jboss-4.0.3SP1/server/default/tmp/deploy/tmp44379mdb-1.3.jar ,addedOrder=0}
| [48531,RepositoryClassLoader,main] setRepository, repository=org.jboss.mx.loading.UnifiedLoaderRepository3@1da669c, cl=org.jboss.mx.loading.UnifiedClassLoader3@10cf62{ url=file:/C:/jboss-4.0.3SP1/server/default/tmp/deploy/tmp44379mdb-1.3.jar ,addedOrder=0}
| [48531,UnifiedLoaderRepository3,main] Adding org.jboss.mx.loading.UnifiedClassLoader3@10cf62{ url=file:/C:/jboss-4.0.3SP1/server/default/tmp/deploy/tmp44379mdb-1.3.jar ,addedOrder=0}
| [48547,ClassLoaderUtils,main] Indexed pkg: com.XXX, UCL: org.jboss.mx.loading.UnifiedClassLoader3@10cf62{ url=file:/C:/jboss-4.0.3SP1/server/default/tmp/deploy/tmp44379mdb-1.3.jar ,addedOrder=41}
| [48547,ClassLoaderUtils,main] Indexed pkg: com.XXX.YYY, UCL: org.jboss.mx.loading.UnifiedClassLoader3@10cf62{ url=file:/C:/jboss-4.0.3SP1/server/default/tmp/deploy/tmp44379mdb-1.3.jar ,addedOrder=41}
| ...
It's difficult to post the class loading log here as it is too large. Could you suggest what thing I should post here?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957959#3957959
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957959
19 years, 9 months
[JBoss Seam] - Re: Seam reverse engineering tool
by gcowsar
More info: it doesn't always cause an exception, but it never returns any query results. If I put % in all the fields or a * in all the fields then it doesn't cause an exception.
This is probably closer to the root cause (SQL Error: -227):
20:58:00,121 INFO [STDOUT] Hibernate: select top ? rolleruser0_.id as id58_, rolleruser0_.locale as locale58_, rolleruser0_.username as username58_, rolleruser0_.passphrase as passphrase58_, rolleruser0_.fullname as fullname58_, rolleruser0_.emailaddress as emailadd6_58_, rolleruser0_.datecreated as datecrea7_58_, rolleruser0_.timezone as timezone58_, rolleruser0_.isenabled as isenabled58_ from roller.rolleruser rolleruser0_ where (rolleruser0_.username like ?) and (rolleruser0_.fullname like ?) and (rolleruser0_.locale like ?) and (rolleruser0_.timezone like ?) and rolleruser0_.isenabled=?
20:58:00,124 WARN [JDBCExceptionReporter] SQL Error: -227, SQLState: 3F000
20:58:00,124 ERROR [JDBCExceptionReporter] invalid schema name: ROLLER in statement [select top ? rolleruser0_.id as id58_, rolleruser0_.locale as locale58_, rolleruser0_.username as username58_, rolleruser0_.passphrase as passphrase58_, rolleruser0_.fullname as fullname58_, rolleruser0_.emailaddress as emailadd6_58_, rolleruser0_.datecreated as datecrea7_58_, rolleruser0_.timezone as timezone58_, rolleruser0_.isenabled as isenabled58_ from roller.rolleruser rolleruser0_ where (rolle ...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957954#3957954
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957954
19 years, 9 months
[Beginners Corner] - Failing to boot JBoss
by BOBSINM
Please help as i am stumped.
I have used JBoss quite a while ago a little and just re-installed the latest versions on a new computer (Windows XP).
I have Sun Java JDK version 1.5.0 Update 7 and JBoss AS 4.0.4.GA.
This is the error I am geting...
Is the double slash '\\' in the JBOSS_HOME & CLASSPATH ok...this looks a little out of place?
===============================================================================
.
JBoss Bootstrap Environment
.
JBOSS_HOME: C:\Program Files\JBoss\jboss-4.0.4.GA\bin\\..
.
JAVA: C:\Java\jdk1.5.0_07\bin\java
.
JAVA_OPTS: -Dprogram.name=run.bat -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcIn
terval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
.
CLASSPATH: C:\Java\jdk1.5.0_07\lib\tools.jar;C:\Program Files\JBoss\jboss-4.0.
4.GA\bin\\run.jar
.
===============================================================================
.
Failed to boot JBoss:
java.lang.ClassNotFoundException: org.jboss.system.server.ServerImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.jboss.system.server.ServerLoader.createServer(ServerLoader.java:2
85)
at org.jboss.system.server.ServerLoader.load(ServerLoader.java:267)
at org.jboss.Main.boot(Main.java:194)
at org.jboss.Main$1.run(Main.java:464)
at java.lang.Thread.run(Thread.java:595)
Press any key to continue . . .
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957952#3957952
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957952
19 years, 9 months
[JBoss Seam] - Re: Seam reverse engineering tool
by gcowsar
"jason_rency" wrote : "fkaufmes" wrote : My problem with the Seam tool is just told, I get the error message:
| |
| | ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
| | | javax.faces.el.EvaluationException: Cannot get value for expression '#{catererEditor.new}'
| |
| | I have no many-to-many mappings. The database structure is very simple for testing. Is there a possible solution for this problem?
|
| try to use the latest version of jboss ejb3 jars (jobss-ejb3 latest download) instead of the jars in ejb3.deploy in the server is still the old version.
OK I got the latest (I built jboss-4.0.5.CR1 from CVS) and used the libraries from there. Got the search page showing up now.
But, it fails when I hit the Find button with:
javax.faces.FacesException: Error calling action method of component with id _id2:_id18
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
javax.faces.component.UICommand.broadcast(UICommand.java:106)
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957951#3957951
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957951
19 years, 9 months