Announcement Announcement Module
Collapse
No announcement yet.
Bean Dependancy Null Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bean Dependancy Null

    Before you lambast me, I've been through the sticky & that's an opinion poll on dependancy checking.

    I am checking in my business logic (time & all that jazz) & while the bean definitions load fine, the dependancy is null;
    The chequeManager dependancy on the utilParams bean. The utilParams bean is null when checked in the logic ....

    Code:
        <!-- cheques -->
        <bean id="chequeManager" class="service.cheques.RetrieveChequeManager">
    	<property name="utilParams" ref="utilityParameters"/>
        </bean>
        
        <bean name="/retrievecheques.htm" class="web.cheques.RetrieveChequeController">
            <property name="sessionForm" value="true"/>
            <property name="commandName" value="retrieveCheques"/>
            <property name="commandClass" value="domain.cheques.Cheque"/>
            <property name="validator">
                <bean class="service.cheques.RetrieveChequeValidator"/>
            </property>
            <property name="formView" value="retrievecheques"/>
            <property name="successView" value="retrievecheques.htm"/>
            <property name="chequeManager" ref="chequeManager"/>
        </bean>
        
        
    <bean id="utilityParameters" class="util.UtilParams">
            <property name="keyStore" value="src-web/WEB-INF/certstores/al_keystore_cl.jks"/>
            <property name="keyStorePassword" value="A"/>
            <property name="trustStore" value="src-web/WEB-INF/certstores/al_truststore_cl.jks"/>
            <property name="trustStorePassword" value="B"/>
            <property name="urlEndPoint" value="https://localhost:8443/accesslayer/"/>
            <property name="chequeSearchOutputLoc" value="src-web/WEB-INF/output/SearchDocData/Cheque"/>
        </bean>
    the UtilParams bean

    Code:
    package util;
    
    public class UtilParams {
    
    	private String urlEndPoint;
    	private String keyStore;
    	private String keyStorePassword;
    	private String trustStore;
    	private String trustStorePassword;
    	private String chequeSearchOutputLoc;
    	
    	
    	public String getChequeSearchOutputLoc() {
    		return chequeSearchOutputLoc;
    	}
    	public void setChequeSearchOutputLoc(String chequeOutputLoc) {
    		this.chequeSearchOutputLoc = chequeOutputLoc;
    	}
    	public String getUrlEndPoint() {
    		return urlEndPoint;
    	}
    	public void setUrlEndPoint(String endPoint) {
    		this.urlEndPoint = endPoint;
    	}
    	public String getKeyStore() {
    		return keyStore;
    	}
    	public void setKeyStore(String keyStore) {
    		this.keyStore = keyStore;
    	}
    	public String getKeyStorePassword() {
    		return keyStorePassword;
    	}
    	public void setKeyStorePassword(String keyStorePassword) {
    		this.keyStorePassword = keyStorePassword;
    	}
    	public String getTrustStore() {
    		return trustStore;
    	}
    	public void setTrustStore(String trustStore) {
    		this.trustStore = trustStore;
    	}
    	public String getTrustStorePassword() {
    		return trustStorePassword;
    	}
    	public void setTrustStorePassword(String trustStorePassword) {
    		this.trustStorePassword = trustStorePassword;
    	}
    	
    	public String toString(){
    		StringBuffer buffer = new StringBuffer();
    		buffer.append("keyStore   				: " + keyStore + ";");
    		buffer.append("keyStorePassword       	: " + keyStorePassword + ";");
    		buffer.append("trustStore				: " + trustStore + ";");
    		buffer.append("trustStorePassword   	: " + trustStorePassword + ";");
    		buffer.append("urlEndPoint				: " + urlEndPoint + ";");
    		buffer.append("chequeSearchOutputLoc	: " + chequeSearchOutputLoc + ";");
    		
    		return buffer.toString();
    	}
    	
    }

  • #2
    How do you load your context file? Post your logic/code.

    Comment


    • #3
      uhmmm ... i'm not loading anything specific. Thought the context was for persistence reasons ....

      Comment


      • #4
        uhmmm ... i'm not loading anything specific. Thought the context was for persistence reasons ....
        ?! Ehr you have an applicationContext.xml and don't load it?

        How are you accessing your configured bean or are you creating a new one?

        Code:
        new RetrieveChequeManager().doSomething()
        If the above is the case then it is logical what happens you need to use the spring configured instance not an instance created by yourself...
        [/code]

        Comment


        • #5
          No, I'm not instantiating the bean. here's the entire project-servlet.xml

          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          
          <beans xmlns="http://www.springframework.org/schema/beans"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://www.springframework.org/schema/beans
                 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
          
              <!-- the application context definition for the springtestapp DispatcherServlet -->
          
              <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
                  <property name="basename" value="messages"/>
              </bean>
              
              <!-- Main Menu -->	
              <bean id="menuManager" class="service.menu.MenuManagerImpl">
             	  <property name="menuMap">
          	    <map>
          		  <entry>
          		    <key><value>Main Menu</value></key>
          		      <list>
          		        <ref bean="retrievecheques"/>
          		        <ref bean="depositslips"/>
          		        <ref bean="signaturecards"/>
          		      </list>
          		  </entry>
          		</map>
          	  </property>    	
              </bean>
              
              <bean name="/mainmenu.htm" class="web.menu.MenuController">
          	<property name="menuID" value="menu"/>    
              	<property name="menuName" value="Main Menu"/>
              	<property name="parentMenu" value="Main Menu"/>    	
                       <property name="menuManager" ref="menuManager"/>
              </bean>
              
          	<bean id="retrievecheques" class="domain.menu.Menu">
          	    <property name="id" value="retrievecheques"/>
                           <property name="name" value="Cheques"/>
                           <property name="description" value="Retrieve Cheques"/>
                           <property name="parentMenu" value="Main Menu"/>
                      </bean>
          	
          <bean id="depositslips" class="domain.menu.Menu">
          		<property name="id" value="depositslips"/>
                  <property name="name" value="Deposit Slips"/>
                  <property name="description" value="Retrieve Deposit Slips"/>
                  <property name="parentMenu" value="Main Menu"/>
              </bean>
          	<bean id="signaturecards" class="domain.menu.Menu">
          		<property name="id" value="signaturecards"/>
                  <property name="name" value="Signature Cards"/>
                  <property name="description" value="Retrieve Signature Cards"/>
                  <property name="parentMenu" value="Main Menu"/>    
              </bean>
              
              
              <!-- cheques -->
              <bean id="chequeManager" class="service.cheques.RetrieveChequeManager">
          	    <property name="utilParams" ref="utilityParameters"/>
              </bean>
              
              <bean name="/retrievecheques.htm" class="web.cheques.RetrieveChequeController">
                  <property name="sessionForm" value="true"/>
                  <property name="commandName" value="retrieveCheques"/>
                  <property name="commandClass" value="domain.cheques.Cheque"/>
                  <property name="validator">
                      <bean class="service.cheques.RetrieveChequeValidator"/>
                  </property>
                  <property name="formView" value="retrievecheques"/>
                  <property name="successView" value="retrievecheques.htm"/>
                  <property name="chequeManager" ref="chequeManager"/>
              </bean>
              
              
          	<bean id="utilityParameters" class="util.UtilParams">
          		<property name="keyStore" value="src-web/WEB-INF/certstores/al_keystore_cl.jks"/>
                  <property name="keyStorePassword" value="A"/>
                  <property name="trustStore" value="src-web/WEB-INF/certstores/al_truststore_cl.jks"/>
                  <property name="trustStorePassword" value="B"/>
                  <property name="urlEndPoint" value="https://localhost:8443/accesslayer/"/>
                  <property name="chequeSearchOutputLoc" value="src-web/WEB-INF/output/SearchDocData/Cheque"/>
              </bean>
              
                          
              <!-- view resolver decouples the form from the controller -->
              <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
                  <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
                  <property name="prefix" value="/WEB-INF/jsp/"></property>
                  <property name="suffix" value=".jsp"></property>        
              </bean>
          
          </beans>

          You'll notice the menu implementation. The menu controller defines the menu manager as a dependancy & the menu manager defines a map of beans as a dependancy.

          The cheque controller defines the cheque manager as a dependancy which in turn defines a bean as a dependancy.

          Can't understand why menu implementation works but not the cheque ....

          Comment


          • #6
            nobody ..?

            Comment


            • #7
              Bumping your thread every 2 hours isn't going to get you a solution faster. Post your RetrieveChequeController and RetrieveChequeManager code.

              Comment


              • #8
                Code:
                /**
                 * 
                 */
                package web.cheques;
                
                import java.util.HashMap;
                import java.util.Map;
                
                import javax.servlet.ServletException;
                
                import org.springframework.web.servlet.ModelAndView;
                import org.springframework.web.servlet.mvc.SimpleFormController;
                
                import domain.cheques.Cheque;
                import service.cheques.ChequeManager;
                
                
                public class RetrieveChequeController extends SimpleFormController {
                
                	private ChequeManager chequeManager;
                             private static final Logger logger = Logger.getLogger(RetrieveChequeController.class.getName());
                
                	public ModelAndView onSubmit(Object command) throws ServletException {
                		Cheque cheque = (Cheque) command;
                
                       logger.log(Level.INFO, "Checking bean dependency utilParams Controller: " + chequeManager.getUtilParams().toString());	
                
                       Map model = new HashMap();
                                         
                        model.put("activecheques", this.chequeManager.retrieveCheques(cheque));
                        
                        return new ModelAndView("activecheques", "chequemodel", model);		
                	}
                
                	public void setChequeManager(ChequeManager chequeManager) {
                		this.chequeManager = chequeManager;
                	}
                }
                Code:
                package za.co.fnb.egami.alaccess.service.cheques;
                
                import java.io.FileNotFoundException;
                import java.io.IOException;
                import java.text.MessageFormat;
                import java.util.ArrayList;
                import java.util.Iterator;
                import java.util.List;
                
                import javax.xml.soap.SOAPElement;
                import javax.xml.soap.SOAPException;
                import javax.xml.soap.SOAPFactory;
                
                import domain.cheques.Cheque;
                import util.UtilParams;
                
                public class RetrieveChequeManager implements ChequeManager {
                	
                	private UtilParams utilParams;
                	private List cheques;
                	private static final Logger logger = Logger.getLogger(RetrieveChequeManager.class.getName());
                
                	public RetrieveChequeManager(){
                		
                	}
                	
                	/**
                	 * 
                	 */
                	public List retrieveCheques(Cheque requestCheque) {
                		logger.log(Level.INFO, "Checking bean dependency utilParams Manager: " + utilParams.toString());
                	}
                
                	public UtilParams getUtilParams() {
                		return utilParams;
                	}
                
                	public void setUtilParams(UtilParams utilParams) {
                		utilParams = utilParams;
                	}
                }

                Comment


                • #9
                  The error is in your code.

                  Code:
                  public void setUtilParams(UtilParams utilParams) {
                  	utilParams = utilParams;
                  }
                  You probably want to assign it to 'this.utilParams'....

                  Comment


                  • #10
                    heh .... ooops ... yep

                    i'm getting this now:

                    Code:
                    java.net.SocketException: Default SSL context init failed: null
                    	at javax.net.ssl.DefaultSSLSocketFactory.createSocket(DashoA6275)
                    	at sun.net.www.protocol.https.HttpsClient.doConnect(DashoA6275)
                    	at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
                    	at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
                    	at sun.net.www.protocol.https.HttpsClient.<init>(DashoA6275)
                    	at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
                    	at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
                    	at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
                    	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.plainConnect(DashoA6275)
                    	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
                    	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:558)
                    	at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl.getOutputStream(DashoA6275)
                    	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:263)
                    	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:151)
                    	at java.security.AccessController.doPrivileged(Native Method)
                    	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:121)
                    	at za.co.fnb.egami.alaccess.util.MessageUtil.retrieveResponse(MessageUtil.java:110)
                    	at za.co.fnb.egami.alaccess.service.cheques.RetrieveChequeManager.retrieveCheques(RetrieveChequeManager.java:42)
                    	at za.co.fnb.egami.alaccess.web.cheques.RetrieveChequeController.onSubmit(RetrieveChequeController.java:46)
                    	at org.springframework.web.servlet.mvc.SimpleFormController.onSubmit(SimpleFormController.java:409)
                    	at org.springframework.web.servlet.mvc.SimpleFormController.onSubmit(SimpleFormController.java:381)
                    	at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267)
                    	at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:265)
                    	at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
                    	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
                    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874)
                    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:808)
                    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
                    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
                    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
                    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
                    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
                    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
                    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                    	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
                    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
                    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
                    	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
                    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
                    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
                    	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
                    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
                    	at java.lang.Thread.run(Thread.java:534)
                    2008/01/30 06:35:00 com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection post
                    SEVERE: SAAJ0009: Message send failed
                    java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Message send failed
                    	at java.security.AccessController.doPrivileged(Native Method)
                    	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:121)
                    	at za.co.fnb.egami.alaccess.util.MessageUtil.retrieveResponse(MessageUtil.java:110)
                    	at za.co.fnb.egami.alaccess.service.cheques.RetrieveChequeManager.retrieveCheques(RetrieveChequeManager.java:42)
                    	at za.co.fnb.egami.alaccess.web.cheques.RetrieveChequeController.onSubmit(RetrieveChequeController.java:46)
                    	at org.springframework.web.servlet.mvc.SimpleFormController.onSubmit(SimpleFormController.java:409)
                    	at org.springframework.web.servlet.mvc.SimpleFormController.onSubmit(SimpleFormController.java:381)
                    	at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267)
                    	at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:265)
                    	at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
                    	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
                    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874)
                    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:808)
                    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
                    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
                    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
                    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
                    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
                    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
                    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                    	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
                    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
                    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
                    	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
                    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
                    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
                    	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
                    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
                    	at java.lang.Thread.run(Thread.java:534)

                    Comment


                    • #11
                      source

                      Code:
                      		SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
                      		 SOAPConnection soapConnection = soapConnectionFactory.createConnection();
                      
                      		 MessageFactory messageFactory = MessageFactory.newInstance();
                      		 SOAPMessage soapRequest = messageFactory.createMessage();
                      
                      		SOAPMessage soapResponse = soapConnection.call(soapRequest,  utilParams.getUrlEndPoint());

                      Comment


                      • #12
                        Well, something in your properties.

                        Code:
                        <bean id="utilityParameters" class="util.UtilParams">
                          <property name="keyStore" value="src-web/WEB-INF/certstores/al_keystore_cl.jks"/>
                          <property name="keyStorePassword" value="A"/>
                          <property name="trustStore" value="src-web/WEB-INF/certstores/al_truststore_cl.jks"/>
                          <property name="trustStorePassword" value="B"/>
                          <property name="urlEndPoint" value="https://localhost:8443/accesslayer/"/>
                          <property name="chequeSearchOutputLoc" value="src-web/WEB-INF/output/SearchDocData/Cheque"/>
                        </bean>
                        src-web prefix for live application settings doesn't seem right for some reason...

                        Comment


                        • #13
                          Code:
                          		<property name="keyStore" value="certstores/al_keystore_cl.jks"/>
                                  <property name="keyStorePassword" value="AbLayer"/>
                                  <property name="trustStore" value="certstores/al_truststore_cl.jks"/>
                                  <property name="trustStorePassword" value="AbLayer"/>
                                  <property name="urlEndPoint" value="https://egami-test:8443/abstract_layer/AbstractLayer"/>
                                  <property name="chequeSearchOutputLoc" value="output/SearchDocData/Cheque"/>
                          changed them all ....

                          time to go & kill something I think

                          Comment


                          • #14
                            doesn't like the relative path ....

                            absolute path had it locate the info. yuk

                            must be setting the relative path incorrectly. will check.

                            Comment

                            Working...
                            X