2.1.2.CR2
by Norman Richards
Just FYI - the release is now out. We've basically just got docs and
testing left to go for the final release, so if we can get those
knocked out we can the final release out and move on to the next big
releases.
15 years, 7 months
How to store data in contexts
by Pete Muir
Dan and Shane raised the issue of how to store data directly in a
context. 299 includes that facility:
@Current Manager manager;
public void go(final String something) {
// Store the String something in the session context
Contextual<String> somethingContextual = new
Contextual<String>() {
public String create(CreationalContext<String> arg0) {
System.out.println("Storing " + something + " in a
context");
return something;
}
public void destroy(String arg0) {
System.out.println("Removing " + something + " from a
context");
}
};
manager.getContext(ApplicationScoped.class).get(somethingContextual,
new CreationalContext<String>() {
public void push(String arg0) {
// No-op, we don't need to deal with partially
circularities here
}
});
}
But often, if you are controlling the data object, it's better to use
a bean to manage the data.
--
Pete Muir
http://www.seamframework.org
http://in.relation.to/Bloggers/Pete
15 years, 7 months
Seam 2.1.2 CR2 testing done
by Ondřej Skutka
Hi all!
Seam 2.1.2.CR2 testing is done and kudos goes to Norman for helping the
crippled Seam QE team. Thanks Norman!
What has been done:
- initial testing
- closing resolved JIRAs
- running functional tests on JBosss 4, JBoss 5 and Tomcat 6
- seam-gen ftests (except for hot-deployment tests -- comming soon)
- JBDS -- sketchy
What has not been tested:
- functional tests on Tomcat+jboss-embedded
- Portlet Bridge
Ondra
15 years, 7 months
where is jboss el?
by Dan Allen
As we organize Seam 3 and the examples, I find myself asking two questions:
- Where is JBoss EL hosted and why is it not listed as a project at
jboss.org?
- Why are we not using JBoss EL 2.0? It appears that Norman and Pete have
both tagged a 2.0 release, so why are we not using it?
Also, I am trying to figure out where the EL 1.3 spec is being defined and
what the status of JBoss EL is in supporting that spec. This seems to be a
pretty critical piece of the puzzle and thus it should be more well defined.
-Dan
--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan
NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters. Please don't hesitate to resend a message if
you feel that it did not reach my attention.
15 years, 7 months
Seam 2.1.2.CR2 testing
by Ondřej Skutka
Hello!
There is a problem with allocating human resources for Seam 2.1.2 CR2
testing. Jozef has PTO until May 20 and I have a clear order to finish
off a WFK work before starting on other stuff (specifically $subj).
Jozef did a great job on Friday with finishing initial release testing
and running one testall task while working on WFK. Still there are many
tasks that need to be done and while I might be able to do some Seam
testing, we will definitely need someone to help us doing all the
tests.
Here is what needs to be done:
- Close resolved JIRAs
- run testall on tomcat6, tomcat+jboss-embedded and jboss-4.2.3 and
preferably also on a jdk6 / JBoss-?
- seam-gen tests
- JBoss Tools manual tests
- optionally Portlet Bridge
Already done
- initial testing
- run testall on JBoss 5.0.1 / JDK 5
Ondra
15 years, 7 months
Seam/jBPM integration within the SOA platform
by Kevin Conner
A few weeks back I was investigating a problem for a customer, related
to the integration of seam applications within the SOA platform. I
managed to chase down the issues but wanted to discuss them further in
this forum. Apologies to Pete and Marek for taking so long over this.
First the relevant configuration
Within the SOA platform we have a jBPM/hibernate configuration that
results in the use of the hibernate JTASessionContext to manage the
lifecycle of sessions, tying those sessions into the encompassing JTA
transaction. We are also using the jBPM JtaDbPersistenceService in
order to guarantee the existence of a transactional context for the jBPM
context.
The codebase I have used in this investigation is from the following tag
https://svn.jboss.org/repos/seam/branches/enterprise/JBPAPP_4_3_FP01
When running a seam example on the SOA platform we were seeing an
exception being thrown as a result of a hibernate session being used
after it has previously been closed, this was a SessionException with
the text "Session is closed!".
In chasing this down I discovered two issues
- an interleaving of the transaction synchronizations between jBPM
and hibernate (now removed in jBPM, certainly in 3.2.5-SP5). This
could cause the session to be closed twice, depending on which order
the Synchronizations were invoked by the transaction manager.
- hibernate objects being used outside of a transactional context
It is the latter that I would like to understand further as I was
surprised to see this given that some areas in the seam/jBPM integration
explicitly test for the existence of transactions and even create a
transactional context. Is there a reason why this is not completely
done within a transaction?
I appreciate that I am a seam novice and there may be something obvious
that I am missing. I do have some suggestions for a fix, however, and
would like some feedback as to whether they would be appropriate. I
have attached the diff file to this message, again based on the previous
tag.
Thanks in advance for any help that you can give,
Kev
--
JBoss, a Division of Red Hat
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire,
SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA), Matt Parsons
(USA) and Brendan Lane (Ireland)
Index: src/main/org/jboss/seam/bpm/ProcessInstance.java
===================================================================
--- src/main/org/jboss/seam/bpm/ProcessInstance.java (revision 10421)
+++ src/main/org/jboss/seam/bpm/ProcessInstance.java (working copy)
@@ -36,26 +36,16 @@
{
if ( !Contexts.isConversationContextActive() ) return null;
- return new Work<org.jbpm.graph.exe.ProcessInstance>()
+ Long processId = BusinessProcess.instance().getProcessId();
+ if (processId!=null)
{
-
- @Override
- protected org.jbpm.graph.exe.ProcessInstance work() throws Exception
- {
- Long processId = BusinessProcess.instance().getProcessId();
- if (processId!=null)
- {
- //TODO: do we need to cache this??
- return ManagedJbpmContext.instance().getProcessInstanceForUpdate(processId);
- }
- else
- {
- return null;
- }
- }
-
- }.workInTransaction();
-
+ //TODO: do we need to cache this??
+ return ManagedJbpmContext.instance().getProcessInstanceForUpdate(processId);
+ }
+ else
+ {
+ return null;
+ }
}
public static org.jbpm.graph.exe.ProcessInstance instance()
Index: src/main/org/jboss/seam/bpm/ManagedJbpmContext.java
===================================================================
--- src/main/org/jboss/seam/bpm/ManagedJbpmContext.java (revision 10421)
+++ src/main/org/jboss/seam/bpm/ManagedJbpmContext.java (working copy)
@@ -83,6 +83,12 @@
throw new IllegalStateException("JbpmContext may only be used inside a transaction");
}
+ if (jbpmContext == null)
+ {
+ log.debug( "recreating seam managed jBPM context" );
+ jbpmContext = Jbpm.instance().getJbpmConfiguration().createJbpmContext() ;
+ }
+
if ( !synchronizationRegistered && !Lifecycle.isDestroying() && transaction.isActive() )
{
jbpmContext.getSession().isOpen();
@@ -100,7 +106,7 @@
public void beforeCompletion()
{
- log.debug( "flushing seam managed jBPM context" );
+ log.debug( "closing seam managed jBPM context" );
/*org.jbpm.graph.exe.ProcessInstance processInstance = ProcessInstance.instance();
if (processInstance!=null)
{
@@ -113,47 +119,30 @@
//destroyed, flush here:
Contexts.getBusinessProcessContext().flush();
}
- jbpmContext.getSession().flush();
- log.debug( "done flushing seam managed jBPM context" );
+ closeContext();
+ log.debug( "closed seam managed jBPM context" );
}
public void afterCompletion(int status)
{
synchronizationRegistered = false;
- if ( !Contexts.isEventContextActive() )
- {
- //in calls to MDBs and remote calls to SBs, the
- //transaction doesn't commit until after contexts
- //are destroyed, so wait until the transaction
- //completes before closing the session
- //on the other hand, if we still have an active
- //event context, leave it open
- closeContext();
- }
}
@Destroy
public void destroy()
{
- if ( !synchronizationRegistered )
- {
- //in requests that come through SeamPhaseListener,
- //there can be multiple transactions per request,
- //but they are all completed by the time contexts
- //are dstroyed
- //so wait until the end of the request to close
- //the session
- //on the other hand, if we are still waiting for
- //the transaction to commit, leave it open
- closeContext();
- }
+ closeContext();
}
private void closeContext()
{
- log.debug( "destroying seam managed jBPM context" );
- jbpmContext.close();
- log.debug( "done destroying seam managed jBPM context" );
+ if (jbpmContext != null)
+ {
+ log.debug( "destroying seam managed jBPM context" );
+ jbpmContext.close();
+ log.debug( "done destroying seam managed jBPM context" );
+ jbpmContext = null;
+ }
}
public static JbpmContext instance()
Index: src/main/org/jboss/seam/bpm/TaskInstance.java
===================================================================
--- src/main/org/jboss/seam/bpm/TaskInstance.java (revision 10421)
+++ src/main/org/jboss/seam/bpm/TaskInstance.java (working copy)
@@ -36,25 +36,16 @@
{
if ( !Contexts.isConversationContextActive() ) return null;
- return new Work<org.jbpm.taskmgmt.exe.TaskInstance>()
+ Long taskId = BusinessProcess.instance().getTaskId();
+ if (taskId!=null)
{
-
- @Override
- protected org.jbpm.taskmgmt.exe.TaskInstance work() throws Exception
- {
- Long taskId = BusinessProcess.instance().getTaskId();
- if (taskId!=null)
- {
- //TODO: do we need to cache this??
- return ManagedJbpmContext.instance().getTaskInstanceForUpdate(taskId);
- }
- else
- {
- return null;
- }
- }
-
- }.workInTransaction();
+ //TODO: do we need to cache this??
+ return ManagedJbpmContext.instance().getTaskInstanceForUpdate(taskId);
+ }
+ else
+ {
+ return null;
+ }
}
public static org.jbpm.taskmgmt.exe.TaskInstance instance()
Index: src/main/org/jboss/seam/contexts/Contexts.java
===================================================================
--- src/main/org/jboss/seam/contexts/Contexts.java (revision 10421)
+++ src/main/org/jboss/seam/contexts/Contexts.java (working copy)
@@ -18,6 +18,7 @@
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.transaction.Transaction;
+import org.jboss.seam.util.Work;
import org.jboss.seam.web.Session;
/**
@@ -344,17 +345,32 @@
//TODO: it would be nice if BP context spanned redirects along with the conversation
// this would also require changes to BusinessProcessContext
- boolean destroyBusinessProcessContext = !Init.instance().isJbpmInstalled() ||
- !BusinessProcess.instance().hasActiveProcess();
- if (destroyBusinessProcessContext)
+ try
{
- //TODO: note that this occurs from Lifecycle.endRequest(), after
- // the Seam-managed txn was committed, but Contexts.destroy()
- // calls BusinessProcessContext.getNames(), which hits the
- // database!
- log.debug("destroying business process context");
- destroy( getBusinessProcessContext() );
+ new Work<Object>()
+ {
+ @Override
+ protected Object work() throws Exception
+ {
+ boolean destroyBusinessProcessContext = !Init.instance().isJbpmInstalled() ||
+ !BusinessProcess.instance().hasActiveProcess();
+ if (destroyBusinessProcessContext)
+ {
+ //TODO: note that this occurs from Lifecycle.endRequest(), after
+ // the Seam-managed txn was committed, but Contexts.destroy()
+ // calls BusinessProcessContext.getNames(), which hits the
+ // database!
+ log.debug("destroying business process context");
+ destroy( getBusinessProcessContext() );
+ }
+ return null;
+ }
+ }.workInTransaction();
}
+ catch (final Exception ex)
+ {
+ log.warn("Exception destroying context ", ex);
+ }
}
if ( !Manager.instance().isLongRunningConversation() )
Index: build/root.pom.xml
===================================================================
--- build/root.pom.xml (revision 10421)
+++ build/root.pom.xml (working copy)
@@ -250,7 +250,7 @@
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-jpdl</artifactId>
- <version>3.2.2.GA_SOA-P</version>
+ <version>3.2.5.SP5</version>
</dependency>
<dependency>
15 years, 7 months
Seam 2.1.2.CR2 initial testing results
by Jozef Hartinger
Hello,
let's start with library changes since 2.1.2.CR1:
Added libraries:
> ./lib/guice.jar
> ./lib/gen/glassX.jar
> ./lib/gen/laguna.jar
> ./lib/gen/darkX.jar
This is for functional tests:
> ./src/test/ftest/lib/cargo-core-uberjar-1.0.jar
These are for RESTEasy application:
> ./lib/jettison.jar
> ./lib/resteasy-atom-provider.jar
Removed libraries:
< ./lib/gen/dom4j.jar
< ./lib/gen/ant.jar
< ./lib/gen/asm-attrs.jar
< ./lib/gen/jta.jar
< ./lib/gen/jboss-el.jar
< ./lib/gen/jboss-seam.jar
< ./lib/gen/asm.jar
< ./lib/gen/antlr.jar
< ./lib/gen/cglib.jar
< ./lib/gen/hibernate.jar
Upgraded libraries:
> /lib,jta.jar,1.0.1B
> /lib,wicket-datetime.jar,1.3.5.jboss1
> /lib,wicket-extensions.jar,1.3.5.jboss1,,
> /lib,wicket-ioc.jar,1.3.5.jboss1,,
> /lib,wicket.jar,1.3.5.jboss1,,
Furthermore,
* guice example app is not added to dist
* restbay's datasource is missing doctype definition
That's all for now.
--
Jozef Hartinger
15 years, 7 months
How to "clear" something from a context
by Pete Muir
This is something that was quite commonly needed in Seam, in part due
to the use of outjection. As 299 doesn't support outjection, you need
to use the manager pattern:
@SessionScoped
public class Login {
public User user;
public Login(@New User user) {
// Initialize with an empty, new, user - the "not logged in" user
this.user = user;
}
public void login(User user) {
// Log in a real user
this.user = user;
}
@Produces @LoggedIn @RequestScoped
public User getCurrentUser() {
return user;
}
}
This is much cleaner :-)
--
Pete Muir
http://www.seamframework.org
http://in.relation.to/Bloggers/Pete
15 years, 7 months
Multiple WAR in EAR
by Stuart Douglas
I have done some investigating into multiple war support in seam. When
running a seam app with multiple wars you and up with two seam apps
running side by side, with different application contexts and
components. The Lifecycle and ServletLifecycle classes both maintain a
static reference to the servlet context (abstracted as a map in
LifeCycle). This means that only one of the seam apps will have their
application context stored in these classes. This seam app will work
fine. The seam app that is not referenced has the following problems:
- Cannot load resource bundles due to use of the wrong ServletContext in
ServletLifecycle (or wrong bundles loaded).
- Timers and async methods started in the second app will be run in the
app context of the first
- The wrong identity component will be created by the IdentityFilter.
- The resource servlet for the second app is run the app context of the
first, and will not work
- Wicket integration for the second app will not work
- Spring integration will not work in the second app
- jbpm integration in the second app is broken.
Some of these are easier to fix than others. The servlet and filter
problems are easy to fix as they have direct access to the
ServletContext and can simply pass it through to Lifecycle (abstracted
as a map of course)
The timer and async method issues are a bit harder. They will need to
store a reference to the application scope that they are meant to be run
in, same with the jbpm integration.
I do not know if it will be possible to get full spring support in multi
war apps, but I don't really know enough about spring to be able to say
one way or another.
As far as I can tell these are the only major problems with multi war
apps, if these are resolved it should work fine.
Stuart
15 years, 7 months
2.1.2.CR2 release
by Norman Richards
Ok. It looks like we've resolved all the code issue with only doc
issues remaining. I'm going to start getting ready for the release,
so please hold off on commits until the branch is tagged.
15 years, 7 months