[jboss-user] [JBoss Seam] - Problem with no handledException with StaleObjectStateExcept

2007-08-25 Thread krica
Hi,

I've been trying to figure this out for 5 straight days and cannot understand 
why org.jboss.seam.handledException is not being set in certain cases. 
Actually, it is set, but I cannot retrieve it in my handler class.

First the setup:
-Seam 1.2.1
-Tomcat
-Richfaces 3.0.1
-Myfaces 1.1.5

Ok, so I have a "my account" page, where a user can update his details. I also 
have an admin function, where an admin can update any user's details. The 
StaleObjectStateException occurs if both the user and the admin update the 
details at the same time. Nothing strange about this. What is strange is that 
if the admin is the "winner" (i.e. his update was commited) then the exception 
handler for the user's exception gets hold of org.jboss.seam.handledException 
value and proceeeds. However, if the user is the winner, then the admin's 
handler (same class) does NOT get the org.jboss.seam.handledException value. 
Why? Obviously something is happening in one case but not the other, but I 
can't figure out what.

Here are some details:

The "handler" is defined as follows: 

  | 
  | pages.xml
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 

So, when a StaleObjectStateException occurs, the user is redirected to 
/errorConcurrentModif.xhtml, which has a page action handle().


  | @Stateless
  | @Name("concurrentModifHandler")
  | public class ConcurrentModifHandler implements ConcurrentModifHandlerLocal {
  | 
  | public void handle() {
  | ...
  | StaleObjectStateException sose = null;
  | if (Contexts.isConversationContextActive()) {
  | Object o = 
Contexts.getConversationContext().get("org.jboss.seam.handledException");
  | if (o != null && o instanceof StaleObjectStateException) {
  | sose = (StaleObjectStateException) o;
  | }
  | }
  | 
  | ...
  | }
  | 

Here, sose is null in one case but not the other. In both cases, prior to 
reaching my code, org.jboss.seam.core.Exceptions successfully sets 
"org.jboss.seam.handledException" into an instance of 
ServerConversationContext's "additions" map. 

Another funny thing I noticed was that in the case where it works (as I 
expected), the  ServerConversationContext's flush() method is called before my 
handler, but in the case where sose is null, the flush() method is called 
afterwards. flush() is where the values in the additions map are moved to the 
Session's attributes.

Here's how the pages are set up. First the admin's (role is named BR). The 
admin (BR) searches for users and gets presented with a data table in a page 
called manageBidders. The actualt DataModel is created in a Session scoped 
component.


  | @Stateful
  | @Name("bidderSearch")
  | @Scope(ScopeType.SESSION)
  | @Restrict("#{s:hasRole('BR')}")
  | public class BidderSearchingAction implements BidderSearchingLocal {
  | ...
  | @DataModel
  | private List bidders;
  | ...
  | @Factory
  | public List getBidders() {
  | ...
  | return bidders;
  | }
  | }
  | 

The admin then clicks on the edit link in the data table

  | 
  | ...
  | 
  | ...
  | 
  | 

BidderManager:

  | @Stateful
  | @Scope(ScopeType.CONVERSATION)
  | @Name("bidderManager")
  | public class BidderManager implements BidderManagerLocal {
  | ...
  | @Begin(join = true)
  | public void showEdit(Bidder selectedBidder) {
  | selBidder = database.merge(selectedBidder);
  | userName = selBidder.getUserName();
  | emailRepeat = selBidder.getEmailAddress();
  | action = Constants.EDIT;
  | }
  | ...
  | }
  | 

And the corresponding entry in pages.xml


  | 
  | #{s:hasRole('BR')}
  | 
  | 
  | 
  | 
  | 

When the admin submits the changes, an action bidderManager.save() is called.


  | 
  | 
  | 
  | In BidderManager:
  |  
  |@End
  | @Restrict("#{s:hasRole('Bidder') or s:hasRole('BR')}")
  | public void save() {
  | ...
  | }
  | 
  | 

Navigation after save is handled by pages.xml:

  | 
  | #{s:hasRole('Bidder') or s:hasRole('BR')}
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 

Now, for the user (the Bidder) the process is as follows:

His menubar has a link to "my account":


  |   
  | 

As you see, it is the same action class BidderManager, but in this case the 
showEditMyAccount method


  | @Begin(join = true)
  | @Restrict("#{s:hasRole('Bidder')}")
  | public void showEditMyAccount() {
  | selBidder = loggedInUser.getBidder();
  | userName = selBidder.getUserName();
  | action = Constants.EDIT_MYACCOUNT;
  | }
  | 

This presents the user with the same page as the admin, but with some fields 
disabled. The same bidderManager.save() as for the admin is called on submit. 
The loggedIn

[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - How do I extend MessageInterpolator?

2007-06-17 Thread krica
Sorry if this is not the right forum, but I couldn't find a dedicated Hibernate 
Validator forum.

In my application, I have validation on a field which changes dynamically, at 
runtime. Thus, the error message displayed to the customer needs to be dynamic 
as well. This means that I cannot use a ResourceBundle. The reference docs 
state that I can extend MessageInterpolator and refers to the JavaDocs, but the 
JavaDoc has next to no documentation. I have tried to debug my way through all 
this, but I am not getting very far.

So far I have deduced (probably incorrectly) that I need to register the 
MessageInterpolator with the property 
"hibernate.validator.message_interpolator_class", and I (think) I have done so. 
However, its interpolate method is never called.

I am using JBoss Seam, and have registered it in persistence.xml by adding the 
following:

  | 

Can anybody shed some light on how to actually get the extended 
MessageInterpolator to be used?

Thanks!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055013#4055013

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055013
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Argh! Where is the cid coming from?

2007-04-07 Thread krica
Hi,

While I really like Seam, sometimes it feels like I've just traded one set of 
problems for another, that being conversation propagation. Almost every 
non-trivial web page interaction causes some sort of problem for me.

Anyway, here's my current problem, and while I have found a workaround (which 
I'll show at the end), I simply cannot understand WHY I need to do that. The 
problem is that I get a "IllegalStateException: long-running conversation 
already active".

The application has a user type named Bidder. A bidder may submit one and only 
one bid to the system. A bid consists of one or more bid items, which are 
price/volume pairs. Bidders can always view their bid, and based on some 
business rules, the bidder may be able to edit the bid or request a bid 
correction (which is an edit with approval).

>From the bidder's home page, he can choose ViewBid, and from ViewBid he can 
>choose a link which directs him to ReqCorr (request correction). While in 
>ReqCorr he can edit a DataTable and, most importantly for this discussion, he 
>can CANCEL his edit. 

ViewBid is managed by bidderViewBidManager (Stateful, CONVERSATION) but (in 
this use case) does not start or end any conversations. ReqCof is managed by 
bidderBidCorrectionManager (also Stateful, CONVERSATION). This conversation is 
started by an "s:link propagation=begin" link on the ViewBid page, and ended 
either with a save() action or the cancel() action.

This is the series of actions that cause the exception: ViewBid--link to 
-->ReqCorr--action cancel()-->ViewBid--link to -->ReqCorr (boom!)

I have tried to provide this a simple ascii flowchart :) :

  | Page View   ConversationType   CID
  | =      ===
  |   HomeNew tmp   2
  ||
  |V
  | ViewBid   tmp   2
  ||
  |begin (via s:link)
  ||
  |V
  | ReqCorr tmp prom. to long   4
  ||
  |end (cancel())
  ||
  |V
  | ViewBid long dem. to tmp  4
  ||
  |begin (via s:link)
  ||
  |V
  | ReqCorr  IllegalStateEx. long-running conversation already active
  | 

The cid is taken from Live HTTP Headers in FireFox. This is the comlplete 
interaction captured by Live HTTP Headers:


  | http://localhost:8080/MyApp/home.jsf?cid=2
  | 
  | GET /MyApp/home.jsf?cid=2 HTTP/1.1
  | Host: localhost:8080
  | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) 
Gecko/20070309 Firefox/2.0.0.3
  | Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
  | Accept-Language: en-us,en;q=0.8,sv;q=0.5,ar;q=0.3
  | Accept-Encoding: gzip,deflate
  | Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  | Keep-Alive: 300
  | Connection: keep-alive
  | Referer: http://localhost:8080/MyApp/home.jsf
  | Cookie: redirectViewNumber=1,; JSESSIONID=349D78AD4B524645E6CD3F62500FBD21
  | 
  | HTTP/1.x 200 OK
  | Server: Apache-Coyote/1.1
  | Cache-Control: must-revalidate
  | Pragma: no-cache
  | Expires: Thu, 01 Jan 1970 00:00:00 GMT
  | Content-Type: text/html;charset=UTF-8
  | Transfer-Encoding: chunked
  | Date: Sat, 07 Apr 2007 07:20:00 GMT
  | --
  | http://localhost:8080/MyApp/restricted/bidderViewBid.jsf
  | 
  | GET /MyApp/restricted/bidderViewBid.jsf HTTP/1.1
  | Host: localhost:8080
  | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) 
Gecko/20070309 Firefox/2.0.0.3
  | Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
  | Accept-Language: en-us,en;q=0.8,sv;q=0.5,ar;q=0.3
  | Accept-Encoding: gzip,deflate
  | Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  | Keep-Alive: 300
  | Connection: keep-alive
  | Referer: http://localhost:8080/MyApp/home.jsf?cid=2
  | Cookie: redirectViewNumber=1,; JSESSIONID=349D78AD4B524645E6CD3F62500FBD21
  | 
  | HTTP/1.x 200 OK
  | Server: Apache-Coyote/1.1
  | Cache-Control: must-revalidate
  | Pragma: no-cache
  | Expires: Thu, 01 Jan 1970 00:00:00 GMT
  | Content-Type: text/html;charset=UTF-8
  | Transfer-Encoding: chunked
  | Date: Sat, 07 Apr 2007 07:20:05 GMT
  | --
  | 
http://localhost:8080/MyApp/restricted/reqBidCorrection.jsf?bidId=950272&conversationPropagation=begin
  | 
  | GET 
/MyApp/restricted/reqBidCorrection.jsf?bidId=950272&conversationPropagation=begin
 HTTP/1.1
  | Host: localhost:8080
  | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) 
Gecko/20070309 Firefox/2.0.0.3
  | Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
  | Accept-Language: en-us,en;q=0.8,sv;q=0.5,ar;q=0.3
  | Accept-Encoding: gzip,deflate
  | Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  | Keep-Alive: 300
  | Connection: keep-alive
  | Referer: http://localhost:8080/MyApp/restric

[jboss-user] [JBoss Seam] - Re: Help with StaleObjectStateException needed

2007-03-06 Thread krica
Nobody?
...
Please?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025674#4025674

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025674
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Help with StaleObjectStateException needed

2007-03-06 Thread krica
I can't understand why I'm getting a StaleObjectStateException in my action. Or 
rather, I understand why, but I don't understand why the entity is not up to 
date.

This is a simplified version of my action:


  | @In(create = true)
  | EntityManager database;
  | 
  | @In
  | @Out
  | private User loggedInUser; //created by Authenticator
  | 
  | @DataModel
  | private List listBidItems = new ArrayList();
  | 
  | @Begin(join = true)
  | public void addBidItem(ActionEvent event){
  | ListBidItem newItem = new ListBidItem();
  | listBidItems.add(newItem);
  | }
  | 
  | @End
  | public void yesConfirmSave() {
  | confirming = false;
  | //database.refresh(loggedInUser); //doesn't seem to help
  | Date now = new Date();
  | Bid bid = new Bid();
  | bid.setCreatedOn(now);
  | bid.setCreatedBy(loggedInUser);
  | bid.setBidder((Bidder) loggedInUser);
  | ((Bidder) loggedInUser).setBid(bid);
  | 
  | for (ListBidItem lbi: listBidItems) {
  | BidItem bi = lbi.getBidItem();
  | bi.setCreatedBy(loggedInUser);
  | bi.setCreatedOn(now);
  | bi.setBid(bid);
  | bid.getBidItems().add(bi);
  | }
  | database.persist(bid);
  | loggedInUser = bookBuildingDatabase.merge(loggedInUser);
  | }
  | 

pages.xml is simple:

  | 
  | #{s:hasRole('Bidder')}
  | 
  | 
  | 
  | 
  | 
  | 

The User entity has a property:


  | @Version
  | @Column(name="VERSION")
  | protected int version;
  | 

Now, when yesConfirmSave is called the first time after log in, everything 
works fine. When the user trues to save a second Bid, however, the 
StaleObjectStateException is thrown. From debugging the addition of the second 
bid, I can see that the the loggedInUser's Bid is correctly set, but the 
version number is not up to date. Adding the database.refresh() call does not 
seem to help either.

(I know the use case does not make sense, seeing as a user can only have one 
bid, but please disregard that :) )

Thanks


Here's the stack trace:

  | [2007-03-06 18:20:25,781] ERROR 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/TTS-BookBuilding].[Blocking
 Servlet] Servlet.service() for servlet Blocking Servlet threw exception 
  | javax.faces.FacesException: Error calling action method of component with 
id bidForm:_id64
  | at 
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
  | at javax.faces.component.UICommand.broadcast(UICommand.java:106)
  | at 
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
  | at 
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
  | at 
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
  | at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
  | at 
com.icesoft.faces.webapp.xmlhttp.BlockingServlet.renderCyclePartial(BlockingServlet.java:473)
  | at 
com.icesoft.faces.webapp.xmlhttp.BlockingServlet.receiveUpdates(BlockingServlet.java:442)
  | at 
com.icesoft.faces.webapp.xmlhttp.BlockingServlet.executeRequest(BlockingServlet.java:324)
  | at 
com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:186)
  | at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  | at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
  | at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
  | at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
  | at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  | at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
  | at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  | at 
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
  | at 
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
  | at 
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
  | at java.lang.Thread.run(Thread.java:595)
  | Caused by: javax.faces.el.EvaluationException: /restricted/createBid.xhtml 
@90,154 action="#{bidderBidManager.yesConfirmSave}": javax.ejb.EJBException: 
javax.persistence.OptimisticLockException: 
org.hibernate.StaleObjectStateException: Row was updated or deleted by another 
transaction (or unsaved-value mapping was incorrect): 
[com.ttsme.bb.e

[jboss-user] [JBoss Seam] - Re: Problem: Custom validate methods in EJBs crash

2007-03-05 Thread krica
I know this is an old thread, but I ran into the same problem with the 
ValidatorException causing the crash. After much trial and error, this is the 
solution I have come up with. I thought it may be useful for others, at least 
once I get the last little niggle out of it, which I don't think is relevant to 
the problem at hand.

At the bottom of my form, I create a hidden input field, with a dummy value and 
a bound validator method. In this method, I then get the components I'm 
interested in and validate the values. If a field is deemed invalid, the flag 
it as such and add a message to the context. E.g.


  | public void validateForm(FacesContext context, UIComponent component, 
Object value) throws ValidatorException {
  | HtmlInputText theInputText = (HtmlInputText) 
context.getViewRoot().findComponent("myForm:myInputId");
  | String theValue = (String) faxInputText.getValue();
  | if ("anError".equals(theValue)) {
  | theInputText.setValid(false);
  | context.addMessage(theInputText.getClientId(context), 
FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR, "This is an 
error!"));
  | }
  | }
  | 
  | 

My only problem left is that sometimes, for some reason, the method does not 
get called.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025041#4025041

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025041
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Excel support in Seam: any interest?

2007-03-04 Thread krica
Mike, 

This would be a most welcome feature! Almost every application we build has 
extensive reporting requirements, and these are *always* Excel reports. Not 
OpenOffice and not CrystalReport but Excel straight from the app.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024907#4024907

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024907
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: si:selectItem error parsing

2006-12-13 Thread krica
I just saw that it was released! :) Congratulations!



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993497#3993497

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993497
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: si:selectItem error parsing

2006-12-13 Thread krica
Figures :)

Thanks for you guidance Pete. There's a lot to learn and your component as well 
as you responding to this thread helps. Thanks!

/Kris

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993488#3993488

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993488
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: si:selectItem error parsing

2006-12-13 Thread krica
I'm using 1.0.1GA

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993483#3993483

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993483
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: si:selectItem error parsing

2006-12-13 Thread krica
Well, nope, it was not.

This problem obviously stems from an apparent lack of understanding of the 
@Factory annotation. I looked at your examples and saw your factory methods not 
being accompanied by a property, but instead just returning the created lists. 
So I thought "well, that's cool, I don't need a property for this List". Alas, 
it did not work. Adding a "List companyTypes" property with an @Out annotation 
solved the problem.

Anybody care to educate me in why your example code doesn't need to do so?

/Kris

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993479#3993479

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993479
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: si:selectItem error parsing

2006-12-13 Thread krica
Oh, forgot something else. When I debug that method, the array as well as the 
List is populated (not null). Also, for some reason, it is called six times! 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993433#3993433

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993433
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: si:selectItem error parsing

2006-12-13 Thread krica
Hi Pete,

Sorry, I forgot to add that code to my OP. As far as I can see, this is just as 
you do in your examples. I tried adding an @Out as well, but the same thing 
happens.


  | @Factory("companyTypes")
  | public List buildCompanyTypes() {
  | CompanyType[] companyTypes = CompanyType.values();
  | return Arrays.asList(companyTypes);
  | }
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993431#3993431

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993431
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: si:selectItem error parsing

2006-12-13 Thread krica
Pete,

I'm getting the same error here, using you latest build (linked from this 
thread). However, I'm using an Enum.

Error is:

  | java.lang.IllegalArgumentException: selectItems' value="#{companyTypes}" 
must implement java.lang.Iteratable but it is null (null)
  | at 
org.jboss.seam.selectitems.ui.UISeamSelectItems.createSelectItems(UISeamSelectItems.java:225)
  | at 
org.jboss.seam.selectitems.ui.UISeamSelectItems.getValue(UISeamSelectItems.java:204)
  | at 
org.apache.myfaces.shared_impl.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:102)
  | at 
org.apache.myfaces.shared_impl.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:477)
  | 


  | 
  | 
  | 
  | 


  | public enum CompanyType {
  | MAIN("Main"),
  | BRANCH("Branch");
  | 
  | private final String name;
  | private final String labelKey;
  | 
  | private CompanyType(String name) {
  | this.name = name;
  | labelKey = "label_companyType_" + name;
  | }
  | 
  | public String getLabelKey() {
  | return labelKey;
  | }
  | 
  | public String getName() {
  | return name;
  | }
  | 
  | public String toString() {
  | return name;
  | }
  | }
  | 

I just followed you wiki article and looked at the examples. Any idea what's 
wrong?

/Kris

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993403#3993403

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993403
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Can't get Seam managed persistance working in an app sco

2006-12-13 Thread krica
OK, that's clear enough :)

Thanks!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993326#3993326

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993326
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Can't get Seam managed persistance working in an app scoped

2006-12-12 Thread krica
OK, this is not really a big deal, because it works when I change it to EJB 
managed (i.e. @PersistenceContext), but I'ld like to understand why it doesn't 
work.

I have an application-scoped bean that should be initialized at startup:


  | @Stateful
  | @Name("anonUserFactory")
  | @Startup(depends="org.jboss.seam.core.ejb")
  | @Scope(ScopeType.APPLICATION)
  | public class AnonUserFactory implements AnonUserFactoryInterface {
  | 
  | @Logger
  | protected Log log;
  | 
  | private User anonUser;
  | 
  | @In(create = true)
  | EntityManager theDatabase;
  | 
  | @Create
  | public void createAnonUser() {
  | try {
  | anonUser = (User) theDatabase.createQuery("blah 
blah").getSingleResult();
  | anonUser.populatePermissions();
  | }
  | catch (NoResultException e) {
  | log.fatal("Could not load anonymous user", e);
  | throw e;
  | }
  | }
  | 
  | @TransactionAttribute(NOT_SUPPORTED)
  | public User getAnonUser() {
  | return anonUser;
  | }
  | 
  | @Remove
  | @Destroy
  | public void destroy() {
  | }
  | }
  | 

For some reason, theDatabase is null when I try to use it. This same injected 
EntityManager works in other (non-startup) classes, so the datasource and all 
that is set up correctly. I get no exception, except of course the NPE when 
trying to use the EntityManager.

If I may throw in a related question. Seeing as this EntityManager is not 
needed after the @Create method, how can I close it. If I do, I get the 
exception stating that I cannot call close() on injected components. I've tried 
to get it via "Component.getInstance("em", true)" and all sorts of things, but 
it always returns null.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993268#3993268

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993268
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Why do none of the samples work in Tomcat?

2006-12-09 Thread krica
Thanks Norman. I tried that what feels like a hundred times, which is when I 
went with the new download of Seam.

In my frustration, I decided to try it with JBoss AS 4.0.5, but surprise, 
surprise, none of them work there either. In AS, it deploys fine as well but on 
accessing the home page (same as in OP) all I get is a 404 error. No exception 
or error messages in console or any log file...just dead.

I'm going to upgrade my JDK from 1.5.0_09 to 1.5.0_10 to see if it helps.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992492#3992492

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992492
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Why do none of the samples work in Tomcat?

2006-12-09 Thread krica
I simply cannot get ANY of the samples to run in Tomcat.

I started from a clean slate. New fresh download of Seam 1.0.1GA, new fresh 
install of Tomcat 5.5.20.

Edit build.properties and point to my newly installed Tomcat (tried with 
jbossHasMyFacesLifecycleBug = true and false)

>cd examples/issues
>ant
>ant deploy.tomcat
>cd .../MyTomcat
>startup.sh/bat

Tomcat starts up fine and deploys jboss-seam-issues.war without errors. 
However, on first access of http://localhost:8080/jboss-seam-issues/home.jsf, I 
get the following error (sorry...long)


  | ERROR 09-12 20:08:33,593 (Log4JLogger.java:error:119)  -Exception in 
PhaseListener RESTORE_VIEW(1) beforePhase.
  | java.lang.IllegalStateException: Could not start transaction
  | at 
org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.begin(SeamExtendedManagedPersistencePhaseListener.java:77)
  | at 
org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.beforePhase(SeamExtendedManagedPersistencePhaseListener.java:35)
  | at 
org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
  | at 
org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:103)
  | at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
  | at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
  | at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | at 
org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
  | at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
  | at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
  | at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
  | at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  | at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
  | at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  | at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
  | at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
  | at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
  | at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
  | at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
  | at java.lang.Thread.run(Thread.java:595)
  | Caused by: javax.naming.NamingException: Local server is not initialized
  | at 
org.jnp.interfaces.LocalOnlyContextFactory.getInitialContext(LocalOnlyContextFactory.java:45)
  | at 
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
  | at 
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
  | at javax.naming.InitialContext.init(InitialContext.java:223)
  | at javax.naming.InitialContext.(InitialContext.java:197)
  | at org.jboss.seam.util.Naming.getInitialContext(Naming.java:26)
  | at org.jboss.seam.util.Naming.getInitialContext(Naming.java:37)
  | at 
org.jboss.seam.util.Transactions.getUserTransaction(Transactions.java:48)
  | at 
org.jboss.seam.util.Transactions.isTransactionActiveOrMarkedRollback(Transactions.java:30)
  | at 
org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.begin(SeamExtendedManagedPersistencePhaseListener.java:68)
  | ... 22 more
  | ERROR 09-12 20:08:33,609 (Log4JLogger.java:error:119)  -Exception in 
PhaseListener RENDER_RESPONSE(6) beforePhase.
  | java.lang.IllegalStateException: No active application scope
  | at org.jboss.seam.core.Init.instance(Init.java:48)
  | at 
org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.beforePhase(SeamExtendedManagedPersistencePhaseListener.java:30)
  | at 
org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
  | at 
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
  | at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
  | at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(Applica