[JBoss Seam] - jbpm configuration problem
by nstoddar
I'm attempting to get Jbpm configured (this is my first time), but I keep getting an error that say it can't find my pageflow file.
java.lang.IllegalArgumentException: pageflow resource not found: clientregistration.jpdl.xml
| at org.jboss.seam.core.Jbpm.getPageflowDefinitionFromResource(Jbpm.java:132)
| at org.jboss.seam.core.Jbpm.installPageflowDefinitions(Jbpm.java:210)
| at org.jboss.seam.core.Jbpm.startup(Jbpm.java:67)
| 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:597)
My components.xml file is setup just like the documentation says it should be:
<core:jbpm>
| <core:pageflow-definitions>
| <value>clientregistration.jpdl.xml</value>
| </core:pageflow-definitions>
| </core:jbpm>
In addition, my pageflow definition file is in the root of the EAR just like the documentation says it should be. (I've double-checked and triple-checked the name of the file -- they're the same.) I can't seem to find any reason why it's not working (or at least giving me some other error besides this one). Can anybody shed some light on my configuration problem?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037222#4037222
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037222
19 years
[JBoss Seam] - core:managed-persistence-context question
by jbossjbh
I'm still trying to make sure I understand the relationship if any between the <core:managed-persistence-context /> entry in components.xml and the persistence.xml persistence-unit declaration. Given the follow from components.xml:
(2)<core:managed-persistence-context name="entityManager" auto-create="true"
| (1)persistence-unit-jndi-name="java:/seamspaceEnitityManagerFactory" />
and the following from persistence.xml:
<persistence-unit name = "seamspaceDatabase">
| .....
| <properties>
| .....
| <property name = "jboss.entity.manager.factory.jndi.name"
| (1) value="java:/seamspaceEntityManagerFactory" />
| </properties>
| </persistence-unit>
(1) What is this doing for me? Where would I use / take advantage of this in my code?
(2) Where and how if anywhere do I use the entityManager specified here.
I've seen the following:
@In EntityManager entityManager
Are these related?
Thanks
Jon
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037221#4037221
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037221
19 years
[JBoss Seam] - Re: Unit Testing EL in EJB-QL/HQL
by mrobinson28
Ok, in my unit test I originally had:
| EntityManager entityManager = emf.createEntityManager();
|
I have replaced it with:
| EntityManager entityManager = new EntityManagerProxy( emf.createEntityManager() );
|
Now the exception is:
| java.lang.IllegalStateException: No application context active
| at org.jboss.seam.ScopeType.getContext(ScopeType.java:139)
| at org.jboss.seam.Component.getInstance(Component.java:1589)
| at org.jboss.seam.Component.getInstance(Component.java:1567)
| at org.jboss.seam.Component.getInstance(Component.java:1562)
| at org.jboss.seam.core.Expressions.instance(Expressions.java:219)
| at org.jboss.seam.persistence.QueryParser.<init>(QueryParser.java:60)
| at org.jboss.seam.persistence.QueryParser.<init>(QueryParser.java:33)
| at org.jboss.seam.persistence.EntityManagerProxy.createQuery(EntityManagerProxy.java:57)
|
The class/method that I am attempting to unit test looks like:
| @Stateful
| @Scope(ScopeType.SESSION)
| @Name("userBrowser")
| @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
| public class UserBrowserAction implements Serializable, UserBrowser {
|
| @Logger
| private Log log;
|
| @PersistenceContext
| private EntityManager entityManager;
|
| @DataModel
| private List<User> users;
|
| @DataModelSelection(value = "users")
| private User selectedUser;
|
| @Factory("users")
| @Observer("newUserRegistered")
| @SuppressWarnings("unchecked")
| public void getUsers() {
| log.debug("Invoke factory for users");
|
| this.users = this.entityManager.createQuery("from User user where user.username <> #{currentUser.username} ").getResultList();
|
| log.debug("Found #0 users", this.users.size());
| }
|
| @Destroy
| @Remove
| public void destroy() {
| }
| }
|
My unit test is:
| public class UserBrowserTest extends SeamTest {
|
| @Test (groups = "unit")
| @SuppressWarnings("unchecked")
| public void testGetUsers() throws Exception {
| EntityManagerFactory emf = Persistence.createEntityManagerFactory("test-persistence-unit");
| EntityManager entityManager = new EntityManagerProxy( emf.createEntityManager() );
|
| // create a log to inject
| Log log = Logging.getLog(UserBrowserAction.class);
|
| UserBrowser userBrowser = new UserBrowserAction();
|
| super.setField(userBrowser, "entityManager", entityManager);
| super.setField(userBrowser, "log", log);
|
| // invoke method
| userBrowser.getUsers();
|
| // inspect the property
| List<User> users = (List<User>) super.getField(userBrowser, "users");
|
| assert users != null;
| assert users.size() == 2;
| }
| }
|
So my questions:
| * From the exception it looks like I may have to provide more than I am currently via something in org.jboss.seam.mock.* e.g currentUser (In the application currentUser is a session scoped component that is instantiated when a user logs in). Are there any examples of using these mock objects anywhere?
| * Currently I am extending SeamTest which I understand is used for integration testing. Is it incorrect to do this when unit testing; several of the methods provided seem helpful in unit testing also. Would it be feasible to override init so that the embedded container is not started for stand alone unit test (or maybe have something like SeamUnitTest?
| * In general I seem to be having difficulties writing unit test because it occurs over and over again that some method is accessing a variable that is within scope during normal program executions e.g. in the code above currentUser is within scope but is not injected into the component that is accessing it. Is this bad practice? I tested re-writing the class that I am trying to test to contain and instance of the currentUser object injected using @In and then accessing that object from the method that performs the query and this works, both in the application and in my unit test if I manually inject that object.
| * Is it possible to manually inject objects into different scopes programmatically for unit testing?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037218#4037218
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037218
19 years
[EJB 3.0] - Re: ScrollableResults possible in JBoss ?
by marcelvanvelzen
I did some more research, but I think this feature is lacking in the current implementation JBoss 4.05GA with EJB3.0.
I hope in the future this feature will be implemented.
It surprised me that it is lacking, since cursor behaviour is a very old and proven concept in a DBMS environment.
Only pagination is possible, but is a very inefficient way of retrieving bulk information and therefore results in the need for a higher pool size in the connection pool. In addition when performing stress and bulk testing the amount of memory necessary for running such processes is not really small (many MB's).
This worries me for the production environment.. Well, luckily JBoss will work in a cluster environment.
I also hope in the future releases of the Java JDK will be much more memory efficient. It's open source now, so we see how this develops.
Some Hibernate queries are slow. During performance testing I decided to put some logic on the DBMS. Instead of 50 seconds running time, this was downsized to 2 seconds.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037210#4037210
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037210
19 years