WebOrb / Spring integration not working - apache-flex

I've tried copying the weborb config files across to an existing Spring app, and for some reason my spring services aren't being exposed to WebOrb.
I don't see the spring services shown in the WebOrb console, and when I hit the server methods, I get instances of the service that aren't spring wired.
Although this app uses spring annotations heavily, I've tried hitting my services declared in the following ways (always trying to hit "servicesFacade" as my destination):
#Service
public class ServicesFacade ...
#Service("servicesFacade")
public class ServicesFacade ...
<bean id="servicesFacade" class="com.mangofactory.grapevine.service.ServicesFacade" />
I must have missed a config step, but I've compared everything with the example, and can't think what it is.
** Note - I haven't copied any other jars from the web-orb folder (notably, I've exlcuded the spring jars), as I already have a working Spring 3.0 install running on my web app. Could this be the cause?
Steps taken:
Copied from %WEBORB_INSTALL%:
/webapp/WEB-INF/classes -> WEB-INF/classes
/webapp/WEB-INF/flex -> WEB-INF/flex
/webapp/WEB-INF/lib/weborb.jar & jdom-1.1.jar -> WEB-INF/lib
Updated web.xml as follows:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Grapevine</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>weborb.ORBServletContextListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>grapevine</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>weborb</servlet-name>
<servlet-class>weborb.ORBServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>rds</servlet-name>
<servlet-class>weborb.rds.handler.FrontEndHttpServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>grapevine</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>weborb</servlet-name>
<url-pattern>*.wo</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rds</servlet-name>
<url-pattern>/rds.wo</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
I have the following spring-related classes in my lib folder:
org.springframework.aop-3.0.4.RELEASE.jar
org.springframework.asm-3.0.4.RELEASE.jar
org.springframework.beans-3.0.4.RELEASE.jar
org.springframework.context-3.0.4.RELEASE.jar
org.springframework.context.support-3.0.4.RELEASE.jar
org.springframework.core-3.0.4.RELEASE.jar
org.springframework.expression-3.0.4.RELEASE.jar
org.springframework.jdbc-3.0.4.RELEASE.jar
org.springframework.jms-3.0.4.RELEASE.jar
org.springframework.orm-3.0.4.RELEASE.jar
org.springframework.oxm-3.0.4.RELEASE.jar
org.springframework.security.config-3.0.3.RELEASE.jar
org.springframework.security.core-3.0.3.RELEASE.jar
org.springframework.security.web-3.0.3.RELEASE.jar
org.springframework.transaction-3.0.4.RELEASE.jar
org.springframework.web-3.0.4.RELEASE.jar
org.springframework.web.portlet-3.0.4.RELEASE.jar
org.springframework.web.servlet-3.0.4.RELEASE.jar
spring-flex-1.0.3.RELEASE.jar
Any help would be greatly appreciated
Marty

Please check if your weborb-config.xml (it is in WEB-INF/classes) contains the following line:
<serviceInvoker>weborb.handler.SpringBeanHandler</serviceInvoker>
Mark

Related

<context-param> in java based configuration

Below is the web.xml of my project.
<web-app> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/config/applicationContext-service.xml /WEB-INF/config/applicationContext-dao.xml </param-value> </context-param> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/config/servlet-context.xml ***/WEB-INF/config/applicationContext.xml*** </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> </web-app>
If I want to convert my project into java based configuration, I know that webapplicationcontext can be configured by using AbstractAnnotationConfigDispatcherServletInitializer or webapplicationinitializer.
But how can i configure context-param using java configuration ?
What you can do is you can use servlet context to store the param name and param values by using setattribute and getattribute methods of servlet context by which you can acess them any where throughout your application and check this for more clarification.
https://www.javatpoint.com/servletcontext

IntelliJ IDEA shows error for Jersey quick start in web.xml

I created a webapp using the maven archetype for Jersey 2.27 quick start, but IntelliJ IDEA show the following error:
Error:(7, 24) 'org.glassfish.jersey.servlet.ServletContainer' is not assignable to 'javax.servlet.Servlet'
This is the generated web.xml:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.myaddress</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/webapi/*</url-pattern>
</servlet-mapping>
</web-app>
How can I fix this?

J2EE - filters `doFilter` method doesn't getting invoked

This is web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>servlets.Login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/reg/login</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>register</servlet-name>
<servlet-class>servlets.Register</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>register</servlet-name>
<url-pattern>/reg/signup</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>dashboard</servlet-name>
<servlet-class>servlets.Dashboard</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dashboard</servlet-name>
<url-pattern>/user/dashboard</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>logout</servlet-name>
<servlet-class>servlets.Logout</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>logout</servlet-name>
<url-pattern>/reg/logout</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>edit</servlet-name>
<servlet-class>servlets.EditProfile</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>edit</servlet-name>
<url-pattern>/user/controlpanel/edit</url-pattern>
</servlet-mapping>
<!--####################################################-->
<filter>
<filter-name>regAuth</filter-name>
<filter-class>filters.RegPathAuthFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>regAuth</filter-name>
<url-pattern>/myWebApp/reg/login.html</url-pattern>
<url-pattern>/myWebApp/reg/signup.html</url-pattern>
</filter-mapping>
<filter>
<filter-name>regAccess</filter-name>
<filter-class>filters.RegPathAccessFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>regAccess</filter-name>
<url-pattern>/myWebApp/reg/login</url-pattern>
<url-pattern>/myWebApp/reg/signup</url-pattern>
</filter-mapping>
<filter>
<filter-name>userAuth</filter-name>
<filter-class>filters.UserPathAuthFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>userAuth</filter-name>
<url-pattern>/myWebApp/user/*</url-pattern>
<url-pattern>/myWebApp/user/controlpanel/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>userAccess</filter-name>
<filter-class>filters.UserPathAccessFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>userAccess</filter-name>
<url-pattern>/myWebApp/user/dashboard.html</url-pattern>
<url-pattern>/myWebApp/user/controlpanel/edit.html</url-pattern>
</filter-mapping>
</web-app>
I have checked everything and debugged the project several times and haven't figured out the problem. the init method of all 4 filters will be invoked but when a request is sent, the doFilter method won't be invoked. I can't find any clue what's the problem.
So, How can I fix this problem? Where am I doing wrong?
If you need filters implementation, let me know.
Regards

HDIV parameter do not exist

I am trying to integrate HDIV with my web application using HDIV struts 1.jar
I encounter the below error when trying to load the login page.
(self-tuning)'][][](org.hdiv.logs.Logger) - HDIV_PARAMETER_DOES_NOT_EXIST;/abc/def/index.do;_HDIV_STATE_;;;127.0.0.1;127.0.0.1;anonymous;
Possible checks I did:
tried with addition of struts--el tag lib with HDIV--el tag lib
tried with filter mapping pattern to all url
Not sure where I am going wrong. Many searches do not provide me a proper solution. Any guidance is highly appreciated. Thank you
Here are my config files.
hdiv-config.xml. I named it as struts-config-hdiv.xml
<hdiv:config excludedExtensions="css,png,gif,jpg,html,js" protectedExtensions=".*.do">
</hdiv:config>
<hdiv:config>
<hdiv:startPages>/index.html</hdiv:startPages>
<hdiv:startPages>/fsm/efsm/index.do</hdiv:startPages>
</hdiv:config>
<hdiv:config errorPage="/fsm/jsp/tiles/common/ErrorPage.jsp">
<hdiv:startPages>/index.html</hdiv:startPages>
<hdiv:startPages>/fsm/efsm/index.do</hdiv:startPages>
</hdiv:config>
<hdiv:editableValidations registerDefaults="true">
<hdiv:validationRule url=".*"></hdiv:validationRule>
</hdiv:editableValidations>
<hdiv:config showErrorPageOnEditableValidation="true">
</hdiv:config>
<hdiv:config maxPagesPerSession="5">
</hdiv:config>
<hdiv:config avoidValidationInUrlsWithoutParams="true">
</hdiv:config>
`
web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/struts-config/struts-config-hdiv.xml</param-value>
</context-param>
<filter>
<filter-name>ValidatorFilter</filter-name>
<filter-class>org.hdiv.filter.ValidatorFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ValidatorFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.hdiv.listener.InitListener</listener-class>
</listener>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/struts-config/struts-config-default.xml
</param-value>
</init-param>
<init-param>
<param-name>config/hdiv</param-name>
<param-value>
/WEB-INF/struts-config/struts-config-hdiv.xml
</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>validating</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/WEB-INF/tld/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/hdiv-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tld/struts-nested.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/hdiv-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tld/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/hdiv-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tld/struts-html-el.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/hdiv-html-el.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tld/struts-logic-el.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/hdiv-logic-el.tld</taglib-location>
</taglib>
`
pom.xml
<dependency>
<groupId>org.hdiv</groupId>
<artifactId>hdiv-config</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.hdiv</groupId>
<artifactId>hdiv-struts-1</artifactId>
<version>3.3.0</version>
</dependency>
According to your post I see two possible solutions:
You must process the reported URL at server side using the custom tags offered by Struts 1 to render linksr. In that way Hdiv will include the additional hdiv parameter.
If the URL is a start page (the entry point to the application) where the user starts the browsing (in that case you are not rendering the link) you must define a start page within Hdiv configuration.
<hdiv:config>
<hdiv:startPages>XXX the URL XX</hdiv:startPages>
Regards,
Roberto Velasco (Hdiv Security)

RDSDispatchServlet is not available

I have web.xml as follows
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>HibDemo</display-name>
<description>HibDemo Application</description>
<!-- Http Flex Session attribute and binding listener support -->
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<!-- MessageBroker Servlet -->
<servlet>
<servlet-name>MessageBrokerServlet</servlet-name>
<display-name>MessageBrokerServlet</display-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>RDSDispatchServlet</servlet-name>
<servlet-class>flex.rds.server.servlet.FrontEndServlet</servlet-class>
<init-param>
<param-name>messageBrokerId</param-name>
<param-value>_messageBroker</param-value>
</init-param>
<init-param>
<param-name>useAppserverSecurity</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>10</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<servlet-mapping id="RDS_DISPATCH_MAPPING">
<servlet-name>RDSDispatchServlet</servlet-name>
<url-pattern>/CFIDE/main/ide.cfm</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
<!-- for WebSphere deployment, please uncomment -->
<!--
<resource-ref>
<description>Flex Messaging WorkManager</description>
<res-ref-name>wm/MessagingWorkManager</res-ref-name>
<res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
-->
I have downloaded blazeds3.3 and copied all the lib files my lib folder and added the above web.xml file.
Then I have created the Flex 4 project with BlazeDS support. it has been created without any error. Then I have added the datagrid in the code. While using data-centric driven feature of flex 4 it is asking me username and password. I have checked "No Password Require"
Then it gives me Error Like
Error Executing RDS command. Status code 404, Reason: Servlet RDSDispatchServlet is not available
Please help me.
It looks like the RDS stuff isn't in BlazeDS 3.3. As far as I can see, its v4 and above.
So your server is likely not starting the servlet due to the class not being found on the classpath.

Resources