[Tomcat, HTTPD, Servlets & JSP] - Struts Mystery
by shadowrunner
I have a Struts 1.2 application running on JBoss 4.0.3SP1 on WinXPSP2. The application works fine except for one repeatable instance. I click a link on the page to update some information (this makes a call to the action servlet and returns to the same page) then when I try to save the form data my browser flips to a partially loaded page with the correct URI (ProcessData.do). No exceptions or other errors are thrown. I have found that my custom request processor gets called and returns true but my action servlet never gets called. Somewhere between the request processor and the action servlet something is breaking down.
Has anyone experienced this before? Any suggestions on how to troubleshoot this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976041#3976041
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976041
19 years, 7 months
[JBoss Seam] - Outjection problem(s)
by Newlukai
Hi,
I didn't know how to search for this specific problem, so I started a new thread. I hope you don't mind.
I have a form which allows the user to enter some values, which are attached to a bean (called testactionToCreate). As the name says, this form should allow the user to create a new testaction. To specify a testaction the user can choose a testcase from a dropdown-list, but he doesn't need to. But as soon as he chooses a testcase, some fields on the page should be filled with the values of the testcase. Then the user adds some data and submits the form.
That's the idea.
The dropdown-list gets its entries from a stateful bean, the testcaseSelector. In this bean I defined a valueChangeListener which sets some values of the injected testactionToCreate. This works fine. After those values are set, the testactionToCreate is outjected.
Now comes my problem: I only see the attributes set by testcaseSelector if they are displayed in an output field like h:outputText.
Next step would be to save the testactionToCreate. The save method is defined in a third bean, called createTestaction. When the save method is invoked all attributes set by the testcaseSelector are null. And that's a problem, too. But I think it's related to the first problem.
Here is some code:
The entity bean (testactionToCreate):
@Entity
| @Table(name="TESTACTIONS")
| @Name("testaction")
| @Scope(ScopeType.SESSION)
| public class Testaction implements Serializable, Cloneable {
| private long m_ID;
| //... the attribute list is too long. Ask me, if you need more
| private Long m_TCaseID;
| private Long m_TObjID;
The bean saving the entitiy bean (createTestaction):
@Stateless
| @LoggedIn
| @Name("createTestaction")
| public class CreateTestactionAction implements CreateTestaction, Serializable {
| @PersistenceContext(unitName = "aresDatabase")
| private EntityManager em;
|
| @In
| @Valid
| private User user;
|
| @Valid
| @In(required=false)
| @Out(required=false)
| private Testaction testactionToCreate;
|
| @In(required=false)
| private Release selectedRelease;
|
| @Factory("testactionToCreate")
| public void initTestactionToCreate() {
| if(testactionToCreate != null) {
| return;
| }
| testactionToCreate = new Testaction();
| testactionToCreate.setTesterUsrID(user.getID());
| testactionToCreate.setValidatorUsrID(user.getID());
| }
|
| @IfInvalid(outcome=Outcome.REDISPLAY)
| public String createTestaction() {
| // do something and return an outcome
| }
The bean managing the dropdown-list (testcaseSelector):
@Stateful
| @Scope(ScopeType.SESSION)
| @LoggedIn
| @Name("testcaseSelector")
| public class TestcaseSelection implements TestcaseSelector, Serializable {
| @PersistenceContext(unitName = "aresDatabase")
| private EntityManager em;
|
| @In(required=false)
| private Release selectedRelease;
|
| @In(required=false) @Out(required=false)
| private Testaction testactionToCreate;
|
| private Long lastSelectedReleaseID;
|
| @In(required=false) @Out(required=false, scope=ScopeType.SESSION)
| private Testcase selectedTestcase;
|
| private List<Testcase> testcases;
|
|
| public void valueChanged(ValueChangeEvent event) {
| setSelectedTestcaseNumber((Long) event.getNewValue());
| if(selectedTestcase != null && testactionToCreate != null) {
| testactionToCreate.setTObjID(selectedTestcase.getTObjID());
| testactionToCreate.setTCaseToken(selectedTestcase.getToken());
| testactionToCreate.setTCaseDescr(selectedTestcase.getDescr());
| }
| }
And the form:
<h:form>
| <div id="errors"><h:messages layout="table" /></div>
| <div class="buttonLine">
| <h:commandButton action="#{createTestaction.createTestaction}" />
| </div>
|
| <div id="release">
| <h:outputText value="#{ares_messages.filter_release}: " />
| <h:selectOneMenu value="#{releaseSelector.selectedReleaseNumberOnly}" onchange="submit()">
| <f:selectItems value="#{releaseSelector.releaseItemsOnly}" />
| </h:selectOneMenu>
| </div>
|
| <table cellpadding="0" cellspacing="0" border="0">
| <tr>
| <th><h:outputText value="#{ares_messages.label_testaction_TesterUsrID}" /></th>
| <th><h:outputText value="#{ares_messages.label_testaction_TCaseID}" /></th>
| <th><h:outputText value="#{ares_messages.label_testaction_TObjID}" /></th>
| <th><h:outputText value="#{ares_messages.label_testaction_QATID}" /></th>
| <th><h:outputText value="#{ares_messages.label_testaction_SevID}" /></th>
| <th><h:outputText value="#{ares_messages.label_testaction_DevUsrID}" /></th>
| <th><h:outputText value="#{ares_messages.label_testaction_CompID}" /></th>
| <th> </th>
| </tr>
| <tr>
| <td>
| <h:selectOneMenu value="#{testactionToCreate.testerUsrID}">
| <f:selectItems value="#{selectMenuHelper.testersWithEmptyEntry}" />
| </h:selectOneMenu>
| </td>
| <td>
| <h:selectOneMenu value="#{testcaseSelector.selectedTestcaseNumber}"
| onchange="submit()"
| valueChangeListener="#{testcaseSelector.valueChanged}">
| <f:selectItems value="#{testcaseSelector.testcaseItems}" />
| </h:selectOneMenu>
| </td>
| <td><h:outputText value="#{testactionToCreate.TObjID}" /></td>
| <td><h:outputText value="#{testactionToCreate.QATID}" /></td>
| <td>
| <h:selectOneMenu value="#{testactionToCreate.sevID}">
| <f:selectItems value="#{selectMenuHelper.severities}" />
| </h:selectOneMenu>
| </td>
| <td>
| <h:selectOneMenu value="#{testactionToCreate.devUsrID}">
| <f:selectItems value="#{selectMenuHelper.developers}" />
| </h:selectOneMenu>
| </td>
| <td><h:outputText value="#{testactionToCreate.compID}" /></td>
| <td> </td>
| </tr>
| </table>
|
| <table cellpadding="0" cellspacing="0" border="0">
| <tr>
| <th><h:outputText value="#{ares_messages.label_testobject_Token}" /></th>
| <th><h:outputText value="#{ares_messages.label_testaction_TCaseToken}" /></th>
| </tr>
| <tr>
| <td><h:outputText value="pending" /></td>
| <td><h:inputText value="#{testactionToCreate.TCaseToken}" style="width: 100%;" /></td>
| </tr>
| </table>
I tried several SessionTypes (PAGE, EVENT, SESSION and CONVERSATION) for the outjection of the bean testactionToCreate. I tried also to define testactionToCreate as a @Role of Testaction. Anything worked.
Has anybody an idea how to solve this problem?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976039#3976039
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976039
19 years, 7 months
[JBoss Seam] - Re: Problems using JSF Converters in Seam app
by smartbinary
An update, as promised...
Updating the bean to use the correct attribute type did indeed resolve the problem. I had started out that way, but backed off when Hibernate Validation & JPA annotations were creating a whole slew of other problems.
So...here are the mods:
1) Converter (just changed to be EVENT scope):
| package org.jboss.seam.example.hibernate;
|
| import java.io.Serializable;
|
| import javax.faces.component.UIComponent;
| import javax.faces.context.FacesContext;
| import javax.faces.convert.Converter;
| import javax.faces.convert.ConverterException;
|
| import org.jboss.seam.InterceptionType;
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Intercept;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
|
| @Scope(ScopeType.EVENT)
| @Name("fullNameConverter")
| @Intercept(InterceptionType.ALWAYS)
| public class FullNameConverter implements Serializable, Converter {
|
| public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2)
| throws ConverterException {
|
| FullName fullName;
| fullName = new FullName(arg2);
|
| return fullName;
| }
|
| public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2)
| throws ConverterException {
| String returnString;
|
| FullName fullName;
| fullName = (FullName) arg2;
|
| returnString = (fullName==null ? null : fullName.toString());
|
| return returnString;
| }
|
| }
|
2) Bean (just added transient attribute for testing converter):
| .............
|
| @Entity
| @Name("appUser")
| @Scope(SESSION)
| public class AppUser implements Serializable
| {
| private String username;
| private String password;
| private String name;
| private FullName fullName;
|
| .............
|
| @NotNull
| @Length(max=100)
| public String getName()
| {
| return name;
| }
| public void setName(String name)
| {
| this.name = name;
| }
|
| @Transient
| public FullName getFullName()
| {
| return fullName;
| }
| public void setFullName(FullName fullName)
| {
| this.fullName = fullName;
| }
|
| .............
|
3) register.xhtml (now converting new field & Ajax-enabled via Ajax4jsf)
| .............
| <s:validateAll>
|
| .............
|
| <div class="entry">
| <div class="label"><h:outputLabel for="name">Name:</h:outputLabel></div>
| <div class="input">
| <h:inputText id="name" value="#{appUser.name}" required="true">
| <a4j:support event="onkeyup" reRender="nameErrors" />
| </h:inputText>
| <br/>
| <a4j:outputPanel id="nameErrors">
| <span class="errors"><h:message for="name" /></span>
| </a4j:outputPanel>
| </div>
| </div>
| <div class="entry">
| <div class="label"><h:outputLabel for="fullName">Name (converted):</h:outputLabel></div>
| <div class="input">
| <a4j:outputPanel id="fullNamePanel">
| <h:inputText id="fullName" value="#{appUser.fullName}" required="true" converter="#{fullNameConverter}" >
| <a4j:support event="onchange" reRender="fullName" />
| </h:inputText>
| </a4j:outputPanel>
| </div>
| </div>
|
| .............
|
| </s:validateAll>
|
| .............
|
|
Regards,
Todd
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976038#3976038
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976038
19 years, 7 months
[JBossCache] - PojoCacheMBean getObject(fqn); throws java.lang.IllegalA
by sting_hz
Hi there,
I'm using PojoCacheMBean with JBoss AS.
In the deploy\mycache-service.xml, I use the following lines to add the pojocache service:
<mbean code="org.jboss.cache.aop.PojoCache"
| name="jboss.cache:service=testPojoCache">
In the java code, I use the following lines to get the cache object:
MBeanServer server=MBeanServerLocator.locateJBoss();
| cache_=(PojoCacheMBean)MBeanProxyExt.create(PojoCacheMBean.class, "jboss.cache:service=testPojoCache", server);
To get an object in the cache:
PojoCacheMBean cache = BaseCacheManager.getCache();
| String fqnStr = "/test";
| Fqn fqn = Fqn.fromString(fqnStr);
| Object obj = cache.getObject(fqn);
Then I got the following exception, which is caused by the line "Object obj = cache.getObject(fqn) " :
java.lang.IllegalArgumentException: argument type mismatch
| --------------------------------------------------------------------------------
| java.lang.IllegalArgumentException: argument type mismatch
| 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:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
| at $Proxy65.gutObject(Unknown Source)
| at com.letu.netprint.modules.bos.base.BaseBO.getObject(BaseBO.java:280)
If I change the last line from
Object obj = cache.getObject(fqn);
to
Object obj = cache.getObject(fqnStr);
Thinks become OK.
Why this could happen?
My evironment is :
jdk1.5.0_09
jboss-4.0.4.GA
jboss-cache.jar is from JBossCache-1.4.0.SP1
Any help or remind will be very appreciating, thanks in advance!
Steven Si
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976036#3976036
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976036
19 years, 7 months