struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wbchm...@Ensign-BickfordInd.com
Subject Its back -> RE: Problem with Populate the way I want to use it...
Date Mon, 01 Jul 2002 19:35:02 GMT

Okay, I cleared all my compiled files and everything and now the problem 
is back...

Here is the error that is displayed:
javax.servlet.ServletException
	at 
org.apache.struts.action.RequestProcessor.processException(RequestProces
sor.java:499)
	at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:440)
	at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
265)
	at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1217)
	at 
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:479)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:243)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:190)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:475)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:234
3)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468
)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:
368)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.j
ava:1012)
	at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:
1107)
	at java.lang.Thread.run(Thread.java:484)


root cause 

java.lang.NullPointerException
	at 
com.ebind.plantsec.search.actionSearch.perform(actionSearch.java:98)
	at org.apache.struts.action.Action.execute(Action.java:399)
	at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:438)
	at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
265)
	at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1217)
	at 
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:479)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:243)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:190)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:475)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:234
3)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468
)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:
368)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)
	at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.j
ava:1012)
	at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:
1107)
	at java.lang.Thread.run(Thread.java:484)


Here is the code that it happens in:


    public static ArrayList getArrayList(Object target, ResultSet 
resultSet) throws SQLException {
         
        ResultSetMetaData metaData = resultSet.getMetaData();
        int cols = metaData.getColumnCount();
        ArrayList list = new ArrayList();
         
        Class c = target.getClass();
        String targetClass = c.getName();
        Class factory = target.getClass();
        
        while (resultSet.next()) {
           HashMap map = new HashMap(cols,1);
           map.put("id",resultSet.getString(1));
           map.put("requestCreatedDate",resultSet.getDate(2));
         map.put("employeeFirstName",resultSet.getString(3));
         map.put("employeeLastName",resultSet.getString(4));
         map.put("employeeContactInfo",resultSet.getString(5));
         map.put("vendorCompanyName",resultSet.getString(6));
         map.put("vendorEmployeeName",resultSet.getString(7));
         map.put("campus",resultSet.getString(8));
         map.put("startDate",resultSet.getDate(9));
         map.put("endDate",resultSet.getDate(10));
         map.put("accessAreas",resultSet.getString(11));
         map.put("note",resultSet.getString(12));
                 
         try {
             Object bean = factory.newInstance();
             
//BeanUtils.populate((com.ebind.plantsec.visitors.beanVisitorRequest) 
bean,map);
   
// ----> This is the line it blows up on...
          BeanUtils.populate(bean,map);
             list.add(bean);
          
         } catch (Exception e) {
             e.printStackTrace();
             throw new SQLException("RequestUtils.getArrayList: " + 
e.toString());
         }
      }
     return (list);
 } 






-----Original Message-----
From: Laird.Nelson [mailto:Laird.Nelson@FMR.COM]
Sent: Wednesday, June 26, 2002 3:16 PM
To: struts-user
Subject: RE: Problem with Populate the way I want to use it...


> -----Original Message-----
> From: wbchmura@Ensign-BickfordInd.com
> If I remove the cast then it blows up with an argument mismatch 
> somewhere in the bowels of the beanutils...
> 
>     Class factory = target.getClass();
>     Object bean = factory.newInstance();
>     BeanUtils.populate(bean,map);
>     list.add(bean);
> 
> How can I fix this?  I have this method in my base class so I want to 
> keep it as generic as possible...

I know that Java reflection does not perform the same kind of method 
search
that the JVM does.  So when you look up a method with a signature like, 
for
example, "foo(SubClass)", you will not find the "foo(BaseClass)" method.

Without digging, I'm going to hazard a guess that BeanUtils.populate()
relies on Java reflection to find the proper method, and hence does not 
take
subtypes into account.

Cheers,
Laird

--
To unsubscribe, e-mail:   
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: 
<mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message