facebook

JBoss and Struts

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #261391 Reply

    David
    Member

    I have a Struts1.1 with EJB application running on JBoss 4.0.2 and a mySQL database. I have a single EAR file that contains the entire application and I am dropping this in /jboss-4.0.2/server/default/deploy/. Here is the EAR strutcture:

    product.ear
    -default.jar <- where the ValueBean class is
    -default.war <-Webapp that uses ValueBean
    -admin.war <-Webapp that uses ValueBean
    – someEJB.jars
    – jakarta-oro.2.0.6.jar
    – commons-validator.1.0.1
    – struts-1.1.jar

    On my JSP I have this:
    <%@ taglib uri=”/WEB-INF/struts-html.tld” prefix=”html” %>
    ..
    <html:options collection=”states” property=”value” labelProperty=”value”/>

    I have System.out’s to show me that the collection is populated with a ValueBean object and put in the session, so I know its there. If I swap out the ValueBean with ValueLabelBeans, it works. But I need to use the ValueBean because it holds a list of values (and I can’t refactor something that works elsewhere).

    So what I can’t figure out is why JBoss won’t recognize the collection being populated with ValueBeans. That class file is in the default.jar contained in the EAR file. There are no errors on deployment or startup, only when that page is rendered.

    My best guess is that the JSP cannot see the proper class for some reason.

    This is driving me mental and I would really appreciate any help you can offer

    #261432 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    (Also, I don’t have an explanation for you right now, but I’ll see if I can dig osmething up)

    #261459 Reply

    David
    Member

    Here are some further developments. I would really appreciate any pointers here, I am completely stumped to this behavior.

    In my EAR/META-INF/MANIFEST.MF I have tried to include the jar file where the missing class is: Class-Path: ./default.jar but apparently this didn’t make a difference.

    what is odd is that on the same JSP I have this:
    <%@page import=”com.xxx.yyy.ui.member.EnrollHelper” %>
    <%@page import=”com.xxx.yyy.bean.ValueBean” %>

    pageContext.setAttribute(“states”, EnrollHelper.getCoveredStateList());

    And here is the offending line:
    html:options collection=”states” property=”value” labelProperty=”label” />

    And finally, here is the ValueBean that is in the collection of states.
    public class ValueBean extends ObjectBean implements java.io.Serializable {
    private String[] values; //for using bean to hold multiple values
    public String getValue()
    …}

    What I can’t understand is that the JSP can use the EnrollHelper class (System.out’s prove this) but not the ValueBean. I know this currently works in production, and the EAR files appear to be identical.

    Again, this is a completely baffling issue and I would really appreciate any advice or pointers you can help me out with.

    #261475 Reply

    Riyad Kalla
    Member

    I’m really rusty on my Struts property stuff but don’t you need a way to get the entire ‘values’ array and not just one value at a time? I’m not sure what your String getValue() method represents (since it takes no argument, I don’t know what it returns).

    #261477 Reply

    David
    Member

    The ValueBean actually stores an array of Objects:

    ValueBean
    public values[]

    public String getValue() {
    return (String)value[0];
    }

    public Object[] getValues() {
    return values;
    }

    Since the tag is calling value, it should return the String stored in the Object. I would say 99% of the code uses it this way. However, there are a few places where the entire array is used. If I need to rewrite all that, I can.

    But – that still leaves me with the question of why this is failing when the other classes are obviously being used. Do you think that perhaps when this bean is called, introspection is failing to find this one method since its private attribute is an array and not a String? I thought the collections used the method signature and not the attributes?

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: JBoss and Struts

You must be logged in to post in the forum log in