[EJB 3.0] - Re: Quartz Classpath issues. How to configure.
by jfrankman
I don't think hibernate is seeing the persistence.xml file because I get the following:
08:56:00,017 INFO [QuartzTst2] class path=C:\dev\jdk\5.0/lib/tools.jar;C:\dev\jboss-4.0.5.ejb3/bin/run.jar
| 08:56:00,017 INFO [QuartzTst2] Class loader:org.jboss.mx.loading.UnifiedClassLoader3@bb0257{ url=file:/C:/dev/jboss-4.0.5.ejb3/server/default/tmp/deploy/tmp20982quartz-ra.rar ,addedOrder=42}
| 08:56:00,033 INFO [Ejb3Configuration] Could not find any META-INF/persistence.xml file in the classpath
| 08:56:00,033 WARN [UserSuppliedConnectionProvider] No connection properties specified - the user must supply JDBC connections
It says it cannot find persistence.xml in the classpath. Also notice that I logged the class path and the classloader. What I don't understand is how it can find my class, but not the persistence.xml as they are in the same directory. This is really getting frustrating. All I want to do is schedule a job to run on a regular basis.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071225#4071225
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071225
18Â years, 8Â months
[Messaging, JMS & JBossMQ] - MDB and long time tasks
by jc7442
I have a MDB that listen on a queue. MDB is in charge to perform a time consuming tasks. It invokes another EJB session.
I have two problems:
- MDB is transaction required. My task exceed the default timeout. How can I configure by XML the timeout for the MDB ? I have try to add some stuff in jboss.xml, nut it looks to be ignored.
- Task is long, so MDB does not commit quick enough and the message is redelivered. I'd like to acknowledge the message at the beginning of my MDB as soon as I know that I will be able to process the message. I try message.acknowledge(). it looks to be ignored. Message is acknowlege only when onMessage method returns. Is it possible to programmatically acknowledge a message before MDB return ?
I have tried to move to a bean managed transaction. I start my own transaction and set the timeout on a UserTransaction. That's not a good solution because timeout is hardcoded in the bean. And I still have the redeliver problem.
Help will be appreciate
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071224#4071224
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071224
18Â years, 8Â months
[JBoss Seam] - Target Unreachable, identifier 'expre' resolved to null
by Jeilong
I'm tearing my hair out over this simple thing I'd like to do: a conversation spanning two pages. Basically I have a table in which the user can click "edit" on a certain row. This will redirect the user to an edit page and the edit page gets populated with the selected item. So far so good. Upon clicking either save or cancel in the edit page the exception below comes up. It seems that the "supplierX" entity is nulled upon clicking either save or cancel. Am I missing some obvious logic or is this a configuration issue? We deployed this on JBoss 4.2.0.GA.
The stack trace:
anonymous wrote : javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
| org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:63)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
| org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
| org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
| org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
| org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
| org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| java.lang.Thread.run(Thread.java:595)
|
| Caused by javax.el.PropertyNotFoundException with message: "/stemtables/supplier/edit_supplier.xhtml @30,59 value="#{suppplierX.phone}": Target Unreachable, identifier 'suppplierX' resolved to null"
|
| com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
| com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
| javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
| javax.faces.component.UIInput.validate(UIInput.java:860)
| javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
| javax.faces.component.UIInput.processValidators(UIInput.java:666)
| javax.faces.component.UIForm.processValidators(UIForm.java:229)
| javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1030)
| javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
| com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
| com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
| com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
| javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
| org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:63)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
| org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
| org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
| org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
| org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
| org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
| org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| java.lang.Thread.run(Thread.java:595)
The SFSB:
@Stateful
| @Name("supplierMaintenance")
| @Scope(ScopeType.CONVERSATION)
| public class SupplierMaintenanceAction implements SupplierMaintenance {
|
| @PersistenceContext(type = PersistenceContextType.EXTENDED)
| private EntityManager entityManager;
|
| @EJB
| private SupplierFacadeLocal supplierFacade;
|
| @DataModel
| private List<Supplier> suppliers;
|
| @DataModelSelection
| @Out(value = "supplierX", required = false) // works
| @In(value = "supplierX", required = false) // doesn't work! why?
| private Supplier selectedSupplier;
|
| @Logger
| private Log log;
|
| @Begin
| @Factory("suppliers")
| public void findSuppliers() {
| log.debug("Entering findSuppliers.");
| try {
| suppliers = supplierFacade.findAllSuppliers();
| } catch (Exception e) {
| log.error("Failed to find suppliers.", e);
| }
| log.debug("Leaving findSupplier.");
| }
|
| public String edit() {
| return null;
| }
|
| @End
| public String delete() {
| Supplier toDelete = entityManager.merge(selectedSupplier);
| entityManager.remove(toDelete);
| findSuppliers();
| return null;
| }
|
| @End
| public String save() {
| Supplier toStore = entityManager.merge(selectedSupplier);
| entityManager.persist(toStore);
| findSuppliers();
| return null;
| }
|
| @End
| public String cancel() {
| return null;
| }
|
| @Remove // remove method is mandated by EJB3 specification for stateful session beans
| public void remove() {}
|
| @Destroy // destroy method is mandated by EJB3 specification for stateful session beans
| public void destroy() {}
| }
pages.xml
<pages
| xmlns="http://jboss.com/products/seam/pages"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd"
| no-conversation-view-id="/login.xhtml" login-view-id="/login.xhtml">
|
| <page view-id="*">
| <navigation from-action="#{identity.logout}">
| <redirect view-id="/login.xhtml" />
| </navigation>
| </page>
|
| <page view-id="/login.xhtml">
| <navigation>
| <rule if="#{identity.loggedIn}">
| <redirect view-id="/welcome.xhtml" />
| </rule>
| </navigation>
| </page>
|
| <page view-id="/welcome.xhtml" login-required="true"></page>
|
| <!-- SUPPLIER MAINTAINCE -->
| <page view-id="/stemtables/supplier/supplier.xhtml" login-required="true">
| <navigation from-action="#{supplierMaintenance.delete}">
| <redirect view-id="/stemtables/supplier/supplier.xhtml" />
| </navigation>
| </page>
|
| <page view-id="/stemtables/supplier/supplier.xhtml" login-required="true">
| <navigation from-action="#{supplierMaintenance.edit}">
| <redirect view-id="/stemtables/supplier/edit_supplier.xhtml" />
| </navigation>
| </page>
|
| <page view-id="/stemtables/supplier/edit_supplier.xhtml" login-required="true">
| <navigation from-action="#{supplierMaintenance.save}">
| <redirect view-id="/stemtables/supplier/supplier.xhtml" />
| </navigation>
| </page>
|
| <page view-id="/stemtables/supplier/edit_supplier.xhtml" login-required="true">
| <navigation from-action="#{supplierMaintenance.cancel}">
| <redirect view-id="/stemtables/supplier/supplier.xhtml" />
| </navigation>
| </page>
|
| <!-- EXCEPTION HANDLING -->
| <exception class="org.jboss.seam.security.NotLoggedInException">
| <redirect view-id="/login.xhtml">
| <message severity="warn">You must be logged in to use this feature.</message>
| </redirect>
| </exception>
| </pages>
web.xml
<web-app version="2.5"
| metadata-complete="true"
| xmlns="http://java.sun.com/xml/ns/javaee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
|
| <!-- Seam configuration -->
| <listener>
| <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
| </listener>
|
| <!-- Propagate conversations across redirects -->
| <filter>
| <filter-name>Seam Redirect Filter</filter-name>
| <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
| </filter>
|
| <filter-mapping>
| <filter-name>Seam Redirect Filter</filter-name>
| <url-pattern>*.seam</url-pattern>
| </filter-mapping>
|
| <servlet>
| <servlet-name>Seam Resource Servlet</servlet-name>
| <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>Seam Resource Servlet</servlet-name>
| <url-pattern>/seam/resource/*</url-pattern>
| </servlet-mapping>
|
| <filter>
| <filter-name>Seam Filter</filter-name>
| <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
| </filter>
|
| <filter-mapping>
| <filter-name>Seam Filter</filter-name>
| <url-pattern>/*</url-pattern>
| </filter-mapping>
|
| <!-- JSF -->
| <context-param>
| <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
| <param-value>client</param-value>
| </context-param>
|
| <context-param>
| <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
| <param-value>.xhtml</param-value>
| </context-param>
|
| <context-param>
| <param-name>facelets.DEVELOPMENT</param-name>
| <param-value>true</param-value>
| </context-param>
|
| <servlet>
| <servlet-name>Faces Servlet</servlet-name>
| <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>Faces Servlet</servlet-name>
| <url-pattern>*.seam</url-pattern>
| </servlet-mapping>
|
| <!-- JSF RI -->
| <listener>
| <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
| </listener>
|
| <session-config>
| <session-timeout>10</session-timeout>
| </session-config>
| </web-app>
/stemtables/supplier/supplier.xhtml
<ui:composition 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:s="http://jboss.com/products/seam/taglib"
| xmlns:a="https://ajax4jsf.dev.java.net/ajax"
| template="../../template.xhtml">
|
| <!-- content -->
| <ui:define name="content">
| <div class="section">
| <h:form>
|
| <h:dataTable value="#{suppliers}" var="supplier">
| <h:column>#{supplier.supplierName}</h:column>
| <h:column>#{supplier.address}</h:column>
| <h:column>#{supplier.phone}</h:column>
| <h:column>#{supplier.URL}</h:column>
| <h:column>
| <h:commandButton value="Edit" action="#{supplierMaintenance.edit}" />
| </h:column>
| <h:column>
| <h:commandButton value="Delete" action="#{supplierMaintenance.delete}" />
| </h:column>
| </h:dataTable>
|
| <span class="errors">
| <h:messages globalOnly="true"/>
| </span>
|
| </h:form>
| </div>
| </ui:define>
|
| <!-- sidebar -->
| <ui:define name="sidebar">
| <h1>SIDEBAR SECTION</h1>
| </ui:define>
| </ui:composition>
/stemtables/supplier/edit_supplier.xhtml
<ui:composition 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:s="http://jboss.com/products/seam/taglib"
| template="../../template.xhtml">
|
| <!-- content -->
| <ui:define name="content">
| <div class="section">
| <h:form>
| <fieldset>
| <div>
| <h:outputLabel for="supplierName">Name: </h:outputLabel>
| <h:inputText id="username" value="#{supplierX.supplierName}" required="true">
| <s:validate />
| </h:inputText>
| <div class="errors"><h:message for="supplierName" /></div>
| </div>
| <div>
| <h:outputLabel for="address">Address: </h:outputLabel>
| <h:inputText id="address" value="#{supplierX.address}">
| <s:validate />
| </h:inputText>
| <div class="errors"><h:message for="address" /></div>
| </div>
| <div>
| <h:outputLabel for="phone">Phone: </h:outputLabel>
| <h:inputText id="phone" value="#{suppplierX.phone}">
| <s:validate />
| </h:inputText>
| <div class="errors"><h:message for="phone" /></div>
| </div>
| <div>
| <h:outputLabel for="URL">URL: </h:outputLabel>
| <h:inputText id="URL" value="#{supplierX.URL}">
| <s:validate />
| </h:inputText>
| <div class="errors"><h:message for="URL" /></div>
| </div>
| <div class="errors"><h:messages globalOnly="true" /></div>
| <div class="buttonBox">
| <h:commandButton action="#{supplierMaintenance.save}" value="Save">
| <s:conversationPropagation type="join" />
| </h:commandButton>
| </div>
| <div class="buttonBox"><h:commandButton action="#{supplierMaintenance.cancel}" value="Cancel" /></div>
| </fieldset>
| </h:form>
|
| <span class="errors">
| <h:messages globalOnly="true" />
| </span>
| </div>
| </ui:define>
|
| <!-- sidebar -->
| <ui:define name="sidebar">
| <h1>SIDEBAR SECTION</h1>
| </ui:define>
| </ui:composition>
EAR structure:
anonymous wrote :
| EAR:
| + jboss-seam-2.0.0.beta1.jar
| + jboss-el-seam-2.0.0.beta1.jar
| + ejb.jar
| + web.war
|
| web.war:
| WEB-INF/components.xml
| WEB-INF/faces-config.xml
| WEB-INF/pages.xml
| WEB-INF/web.xml
| WEB-INF/libjboss-seam-ui-2.0.0.beta1.jar
| WEB-INF/lib/jboss-seam-debug-2.0.0.beta1.jar
| WEB-INF/lib/jsf-facelets-1.1.13.jar
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071220#4071220
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071220
18Â years, 8Â months