[EJB 3.0] - Failure with EJB on JBoss : is this a bug ?
by fredatwork
Hello,
I'm using JBoss Seam 2.0.0 GA on top of a JBoss AS 4.2.1 GA.
I developed a simple web page with a seam component referencing a POJO retrieved by hibernate (EJB 3.0 entity bean). This component has 'page' scope, that is, it is serialized into the page (as JSF state).
The serialization fails with this exception :
WARN [lifecycle] executePhase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@1ecab7c) threw exception
| java.lang.ClassCastException: cannot assign instance of org.hibernate.proxy.pojo.javassist.SerializableProxy to field com.rubis.equity.domain.EqtDaoEquity.market of type com.rubis.market.domain.EqtDaoMarket in instance of com.rubis.equity.domain.EqtDaoStock
It may be a JBoss AS bug. Please check a similar issue : http://jira.jboss.com/jira/browse/JBAS-3952.
My Seam component that is serialized with the JSF holds a serializable EJB entity with a non-initializzed lazy many-to-one relationship. This is totally similar to the JIRA bug. However, in my case, this has nothing to do with java JRE: my JBoss AS server and JSF client are running on the same 1.5.0 JRE.
Is this a bug ? Should I open a JIRA issue ?
Fred
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105918#4105918
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105918
18 years, 8 months
[JBossCache] - Cache loader questions
by aditsu
Hi, I previously had a lot of issues with cache loaders, so I decided not to use them *at all*, in favor of manual preloading, listeners for persisting changes, and cache replication with memory state transfer.
This has worked pretty well, however we're running into problems when trying to ensure failover and add/remove caches in a running cluster. It seems that JBC has a lot of built-in functionality (related to cache loaders) for dealing with this kind of situations, so it seems difficult and somewhat pointless to rewrite these features using different mechanisms. Therefore I'm (reluctantly) looking again at using a cache loader.
Before I can do that, I need to understand some details about how cache loaders work and what they can/can't do. The idea is to use a custom cache loader that uses a database as a persistent store. Here are the most important questions:
1. Is it possible to do reads and writes in batches? Obviously, if I have 1 million records and I want to preload them all, it's better to do one "SELECT *" rather than one "SELECT ID" followed by 1 million "SELECT * WHERE ID=?".
Similarly, if I have 1 million updates to perform, it's better to group them in batches (asynchronously), and reduce the number of db transactions.
2. When I add a new cache to the replicated cluster (with a shared cache loader), can it preload all the necessary data from the cache loader (not blocking the cluster in any way during this operation), and then get the latest changes from the cluster (*all* and *only* the changes) so that it is up to date?
Specifically:
2.1. Can writes (in the cluster and cache loader) happen while the new cache is loading data?
2.2. Can the new cache get from the cluster all the changes that happened while it was loading data (from db) and also all the changes that happened before but were not flushed yet because of the async operation, but without getting any data that it already has (i.e. identical in cache and db)?
3. I understand that with a shared cache loader, the cache that originates a change is also the one that writes it to the cache loader. What happens if the cache loader writes asynchronously, and that cache instance goes down after completing the transaction but before flushing the data to the db? Is it possible to have another cache write it instead?
Thanks
Adrian
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105916#4105916
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105916
18 years, 8 months
[Installation, Configuration & DEPLOYMENT] - Does Postgres work with JBoss 4.2.2?
by EricJava
No matter what I try, I get:
08:18:52,213 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
|
| --- Packages waiting for a deployer ---
| org.jboss.deployment.DeploymentInfo@56b0df96 { url=file:/usr/java/jboss/server/default/deploy/postgres-dsl.xml }
| deployer: null
| status: null
| state: INIT_WAITING_DEPLOYER
| watch: file:/usr/java/jboss/server/default/deploy/postgres-dsl.xml
| altDD: null
| lastDeployed: 1195460332212
| lastModified: 1195460331000
| mbeans:
|
| --- Incompletely deployed packages ---
| org.jboss.deployment.DeploymentInfo@56b0df96 { url=file:/usr/java/jboss/server/default/deploy/postgres-dsl.xml }
| deployer: null
| status: null
| state: INIT_WAITING_DEPLOYER
| watch: file:/usr/java/jboss/server/default/deploy/postgres-dsl.xml
| altDD: null
| lastDeployed: 1195460332212
| lastModified: 1195460331000
| mbeans:
|
I know Postgres worked nicely with JBoss AS 4.2.1 but it seems to not work with 4.2.2. Any ideas?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105912#4105912
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105912
18 years, 8 months
[JBoss Seam] - PDF - is there a way?
by Kragoth
Hi all,
I'm experiencing a little difficulty in getting SEAM's PDF functionality to work.
I can get what I want if I put all my variables into a SESSION scope. But as soon as I want to try use a CONVERSATION scope the PDF has no data in it.
Now I'm assuming that this is because of the way that PDF's are handled. So, I guess my question is, What is the work around?
I have a page where users search for records based on some criteria. My aim is to have a button on the page which will generate a PDF document with these results in them and display them in an iframe or equivalent below, allowing them to get a print friendly version of the records.
Currently I'm experiencing considerable difficulty in passing data to the xhtml page where my pdf is defined.
here is some of the more necessary code
Don't worry too much about the reference to GekkoReport it is just a bunch of getters and setters at the moment.
| package gekko.web.actionbean.enquiry;
|
| import static org.jboss.seam.ScopeType.CONVERSATION;
| import static org.jboss.seam.ScopeType.PAGE;
| import static org.jboss.seam.ScopeType.SESSION;
| import gekko.domain.calculator.ltlr.UvAveraging;
| import gekko.domain.reference.ltl.SubcategoryCode;
| import gekko.web.actionbean.search.CatSubcatDateSearch;
| import gekko.web.services.GekkoReport;
|
| import java.util.HashMap;
| import java.util.List;
|
| import org.jboss.seam.annotations.Begin;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.annotations.datamodel.DataModel;
| import org.jboss.seam.annotations.datamodel.DataModelSelection;
|
|
| @Name("averagingEnquiry")
| @Scope(PAGE)
| public class AveragingEnquiry {
|
| @Out(required=false, scope=SESSION, value="gekkoPDFReport")
| @In(create=true, value="gekkoReport")
| private GekkoReport gekkoPDFReport;
|
| @Out(required=false, scope=SESSION, value="searchResults")
| private List<UvAveraging> searchResults;
|
| @In(value="#{catSubcatDateSearch}", create=true, scope=CONVERSATION)
| private CatSubcatDateSearch searchBean; //NOPMD
|
| @DataModel(value="averagingEnquiry_uvAveragings")
| private List<UvAveraging> uvAveragingList;
|
| @DataModelSelection(value="averagingEnquiry_uvAveragings")
| @Out(required=false, scope=CONVERSATION, value="averagingEnquiry_uvAveraging")
| private UvAveraging uvAveraging;
|
| @Out(required=false, scope=CONVERSATION, value="selectedSubcategory")
| private SubcategoryCode selectedSubcategory;
|
| private boolean showReport = false;
|
| ....getters and setters...
|
| @Begin(join=true)
| public String editUvAveraging() {
| selectedSubcategory = uvAveraging.getSubcategory();
| return "createEditAveraging";
| }
|
| @Begin(join=true)
| public String createUvAveraging() {
| uvAveraging = new UvAveraging();
| selectedSubcategory = new SubcategoryCode();
| return "createEditAveraging";
| }
|
| public boolean getShowReport() {
| return showReport;
| }
|
| @Begin(join=true)
| public void displayReport() {
| HashMap<String, String> criteria = new HashMap<String, String>();
| criteria.put("Category", searchBean.getCatSubcatEnquiry().getCategoryCode().getName());
|
| //TODO: do criteria a better way
|
| gekkoPDFReport.setCriteria(criteria);
| searchResults = uvAveragingList;
|
| showReport = true;
| }
|
| public void hideReport() {
| showReport = false;
| }
|
| }
|
The search page
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:rich="http://richfaces.org/rich"
| xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:gekko="http://gekkoTagLibs.com"
| xmlns:c="http://java.sun.com/jstl/core">
|
| <ui:composition template="/web/templates/gekkoTemplate.xhtml">
| <ui:define name="title">Average Years Enquiry</ui:define>
| <ui:define name="titlebar">Average Years Enquiry</ui:define>
| <ui:define name="content">
| <ui:decorate template="/web/compositions/search/catSubcatDateSearch.xhtml">
| <ui:define name="cScSearchCommand">
| <h:commandButton id="averagingCScSearchCommand"
| value="Search"
| action="#{averagingEnquiry.getUvAveragings}">
| <gekko:defaultAction/>
| </h:commandButton>
| </ui:define>
| </ui:decorate>
|
| <h:form id="results" styleClass="resultsForm">
| <rich:panel header="Averagings">
| <rich:dataTable id="averagingTable"
| value="#{averagingEnquiry_uvAveragings}"
| var="uvAveraging"
| style="width:100%;"
| rows="20">
| <f:facet name="header">
| <rich:columnGroup>
| <rich:column>
| <rich:spacer width="2px;"/>
| </rich:column>
| <rich:column>
| <h:outputText value="Num Years"/>
| </rich:column>
| <rich:column>
| <h:outputText value="Effective Date"/>
| </rich:column>
| <rich:column>
| <h:outputText value="Expiry Date"/>
| </rich:column>
| <rich:column>
| <h:outputText value="Comment"/>
| </rich:column>
| </rich:columnGroup>
| </f:facet>
|
| <rich:column>
| <h:commandLink value="Edit" action="#{averagingEnquiry.editUvAveraging}"/>
| </rich:column>
| <rich:column>
| <h:outputText value="#{uvAveraging.years}"/>
| </rich:column>
| <rich:column>
| <h:outputText value="#{uvAveraging.effective}"/>
| </rich:column>
| <rich:column>
| <h:outputText value="#{uvAveraging.expiry}"/>
| </rich:column>
| <rich:column>
| <h:outputText value="#{uvAveraging.comment}"/>
| <rich:spacer rendered="#{empty uvAveraging.comment}"/>
| </rich:column>
|
| <f:facet name="footer">
| <rich:columnGroup>
| <rich:column colspan="5">
| <rich:datascroller align="left" for="averagingTable" renderIfSinglePage="false"/>
| </rich:column>
| </rich:columnGroup>
| </f:facet>
|
| </rich:dataTable>
|
| <a4j:commandButton id="reportButton" value="Report" reRender="pdfReportForm" action="#{averagingEnquiry.displayReport}"/>
| <h:commandButton id="newButton" action="#{averagingEnquiry.createUvAveraging}" value="New"/>
| </rich:panel>
| </h:form>
| <a4j:log/>
| </ui:define>
|
|
| <ui:define name="pdfReport">
| <h:form id="pdfReportForm">
| <rich:panel header="Report" rendered="#{averagingEnquiry.showReport}">
| <f:facet name="header">
| <h:outputText value="Report"/>
| <a4j:commandLink action="#{averagingEnquiry.hideReport}"
| value="Hide Report"
| reRender="pdfReportForm"/>
| </f:facet>
| <iframe frameborder="0" width="98%" height="600" src="/gekko-tje/web/reports/averageYearsReport.jsf" />
| </rich:panel>
| </h:form>
| </ui:define>
| </ui:composition>
| </html>
|
And finally the pdf xhtml file
| <p:document xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:p="http://jboss.com/products/seam/pdf"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:f="http://java.sun.com/jsf/core"
| pageSize="A4">
|
| <f:facet name="header">
| <p:font size="12">
| <p:footer borderWidthTop="1" borderColorTop="Gray" borderWidthBottom="0" alignment="center">
| <p:pageNumber/>
| </p:footer>
| </p:font>
| </f:facet>
|
| <p:font size="18">
| <p:paragraph>Average Years</p:paragraph>
| </p:font>
|
| <p:table columns="2" headerRows="1">
| <p:cell colspan="2">
| <p:font size="14">
| <p:paragraph>Search Criteria</p:paragraph>
| </p:font>
| </p:cell>
|
| <ui:repeat value="#{gekkoReport.criteria.keySet}" var="key">
| <p:cell>#{key}</p:cell>
| <p:cell>#{gekkoReport.criteria.get(key)}</p:cell>
| </ui:repeat>
| </p:table>
|
| <p:table columns="4" headerRows="1">
|
| <ui:repeat value="#{gekkoReport.columns}" var="column">
| <p:font size="14">
| <p:cell>#{column}</p:cell>
| </p:font>
| </ui:repeat>
|
| <ui:repeat value="#{searchResults}" var="uvAveraging">
| <p:cell>#{uvAveraging.years}</p:cell>
| <p:cell>#{uvAveraging.effective}</p:cell>
| <p:cell>#{uvAveraging.expiry}</p:cell>
| <p:cell>#{empty uvAveraging.comment}</p:cell>
| </ui:repeat>
| </p:table>
|
| </p:document>
|
That code is the best implementation I've had so far in that I at least get results on my page but...... I don't want to be putting all this data into my SESSION scope.
I'll keep looking for some decent examples and reading doco but... any ideas would be great. :)
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105908#4105908
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105908
18 years, 8 months