Results 1 to 3 of 3

Thread: Did not receive successful HTTP response: status code = 404

  1. #1
    Join Date
    Mar 2007
    Location
    Stockhom
    Posts
    2

    Default Did not receive successful HTTP response: status code = 404

    Hello,
    I'm a newbie with Spring Framework, and I have a pb where I need help. I check a lot but I don't find any solution. I use hibernate3, Spring2, and tomcat5
    I create a Service application on an Apache server and I want call this service with httpinvoker. The service is call by a jsp application on the same Apache server.

    The Client send the request to the service server but it dont' have any reply. The server have no pb to start (mapping and Factory) and address seem correct, it's perhaps my transactionProxy.
    Thanks you for your help.

    Except that, spring is very powerfull.

    trace:

    Code:
    Caused by: org.springframework.remoting.RemoteAccessException: Cannot access HTTP invoker remote service at http://localhost:8080/wishit-service/searchProductService]; nested exception is java.io.IOException: Did not receive successful HTTP response: status code = 404, status message = [/wishit-service/searchProductService]
    	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:196)
    	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:157)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	at $Proxy13.searchInOneClass(Unknown Source)
    	at wishIT.commands.SearchCommand.execute(SearchCommand.java:51)
    	at wishIT.commands.CommandManager.executeCommand(CommandManager.java:50)
    	at wishIT.jsf.request.JSFRequestManager.executeRequest(JSFRequestManager.java:65)
    	at wishIT.jsf.request.JSFRequestManager.sendRequest(JSFRequestManager.java:54)
    	at wishIT.jsf.beans.BaseBean.setRequest(BaseBean.java:42)
    	... 32 more
    Caused by: java.io.IOException: Did not receive successful HTTP response: status code = 404, status message = [/wishit-service/searchProductService]
    	at org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor.validateResponse(SimpleHttpInvokerRequestExecutor.java:139)
    	at org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor.doExecuteRequest(SimpleHttpInvokerRequestExecutor.java:62)
    	at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.executeRequest(AbstractHttpInvokerRequestExecutor.java:134)
    	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:177)
    	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:154)
    	... 40 more
    Configuration files

    Service side:
    Service declaration : http-wishIT-service.xml
    Code:
    <beans>
    	<bean name="/searchProductService" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter" lazy-init="false">
    	<property name="service" ref="searchProductService"/>
    	<property name="serviceInterface" value="wishIT.service.SearchProductService"/>
    	</bean>
    </beans>
    Application context: service.xml
    Code:
    	<bean id="wishITtransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        	<property name="sessionFactory" ref="wishITsessionFactory"/>
      	</bean>	
      	
    	<bean id="wishITtransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true">
    		<property name="transactionManager" ref="wishITtransactionManager"/>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="insert*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
    			</props>
    		</property>
    	</bean>
      	  	
      	<bean id="searchProductService" parent="wishITtransactionProxy">
        <property name="proxyInterfaces" value="wishIT.service.SearchProductService"/>
        <property name="target">
            <bean class="wishIT.service.impl.SearchProductServiceImpl">
    			<property name="classesDAO" ref="wishITclassesDAO" />
    			<property name="productsDAO" ref="wishITproductsDAO" />		
    			<property name="propertiesDAO" ref="wishITpropertiesDAO" />			
    			<property name="linkProductPropertyDAO" ref="wishITlinkProductPropertyDAO" />			
    		</bean>
        </property>
      </bean>
    web.xml:
    Code:
    	
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			WEB-INF/application-context/hibernate.xml, 
    			WEB-INF/application-context/service.xml,
    			WEB-INF/application-context/dao.xml
    		</param-value>
    	</context-param>
    
    <!-- Listener Spring -->
    	<listener>
    		<listener-class>
    			org.springframework.web.context.ContextLoaderListener
    		</listener-class>
    	</listener>
    
    	<!-- Service -->
    	<servlet>
    		<servlet-name>wishit-service</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value>WEB-INF/http-wishIT-service.xml</param-value>
    		</init-param>	
    		<load-on-startup>4</load-on-startup>
    	</servlet>
    	
    	<servlet-mapping>
    		<servlet-name>wishit-service</servlet-name>
    		<url-pattern>/wishit-service/*</url-pattern>
    	</servlet-mapping>
    Client side:

    SearchProductService searchProductService = (SearchProductService)sessionWhisIT.getBeanFactory ().getBean("searchProductService");

    Code:
    <bean id="searchProductService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    		<property name="serviceUrl" value="http://localhost:8080/wishit-service/searchProductService"/>
    		<property name="serviceInterface" value="wishIT.service.SearchProductService"/>	
    	</bean>

  2. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    It looks like your client-side URL might be missing a context root?

  3. #3
    Join Date
    Mar 2007
    Location
    Stockhom
    Posts
    2

    Default

    What do you mean by context root? in the web.xml of my client?

    to initialise my context I use a BeanFactory
    BeanFactoryLocator beanFactoryLocator = SingletonBeanFactoryLocator.getInstance("wishIT-bean-factory.xml");
    BeanFactoryReference beanFactoryReference = beanFactoryLocator.useBeanFactory("beanFactory");
    beanFactory = beanFactoryReference.getFactory();
    wishIT-bean-factory.xml
    <beans>
    <bean id="beanFactory" class="org.springframework.context.support.ClassPa thXmlApplicationContext">
    <constructor-arg>
    <list> <value>http-wishIT-service-client.xml</value> </list>
    </constructor-arg>
    </bean>
    </beans>
    >
    and then

    SearchProductService searchProductService = (SearchProductService)beanFactory.getBean("searchP roductService");
    Last edited by syl.brau; Apr 2nd, 2007 at 10:47 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •