package web service client together with another service websphere - websphere

I have two legacy web services running on WebSphere 8.5.5.
Call them serviceOne and serviceTwo. ServiceOne is invoking serviceTwo.
To do that, serviceOne ear contains the serviceTwo client.
We have a requirement to authenticate serviceTwo. We are trying to use PolicySets/Bindings to configure the username and password and have the serviceTwoClient pass them to the serviceTwo provider.
The way they are packaged right now is:
-- serviceOne.ear
|
-- serviceOneEJB.jar
| |
| -- serviceTwoClient.jar
-- serviceOneWeb.war
The problem we have is with packaging the serviceOne ear in order for WebSphere to detect the serviceTwo client within it and list it under Services -> Client Providers so we can attach the PolicySet.
With the current packaging scheme, the serviceTwo client is not detected.
So I tried pulling the serviceTwoClient.jar at the root level of the ear file. This doesn't help, the serviceTwo client is not listed under Client Providers.
Then I tried to package the serviceTwo client as a war file and pack it at the top level of the ear. This helps, the client gets listed in the client providers on the admin console; but I have two alternatives:
- leave the old jar file packed with the serviceOneEJB. In this case the service invocation works fine but the policyBindings do not send the auth information with the request. I guess that's because the actual call goes through the jar and does not invoke the war, and the policyBinding is not invoked.
- remove the old jar from the serviceOneEJB.jar. In this case the service call fails because application context is not loaded properly (is actually null).
Any help/ideas are greatly appreciated.

so after some more digging I found the solution; add the following to the web.xml of the serviceOneWeb app:
<service-ref>
<service-ref-name>serviceTwo_Service</service-ref-name>
<service-interface>ServiceTwo class name</service-interface>
<wsdl-file>ServiceTwo.wsdl</wsdl-file>
<service-qname xmlns:pfx="service_two_ url">pfx:ServiceTwo</service-qname>
<port-component-ref>
<service-endpoint-interface>ServiceTwoClient_Service class</service-endpoint-interface>
<enable-mtom>false</enable-mtom>
</port-component-ref>
</service-ref>
<security-constraint>
<display-name>SERVICE_ACCESS</display-name>
<web-resource-collection>
<web-resource-name>SERVICE_URLS</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>HEAD</http-method>
<http-method>TRACE</http-method>
<http-method>POST</http-method>
<http-method>DELETE</http-method>
<http-method>OPTIONS</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>SERVICE_TWO_USER</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>SERVICE_TWO_USER</role-name>
</security-role>

Related

Spring Websocket and 404 status on connection

In a working Spring MVC 4.0.2 project running under Tomcat 7.0.50, I'm trying to implement Spring Websocket with simple broker and sockjs stomp endpoint, following the official reference. So, in the contextConfigLocation (DistpacherServlet property) I've add a value "websocket-config.xml" which contains:
> <websocket:message-broker application-destination-prefix="/app" >
> <websocket:stomp-endpoint path="/monitor">
> <websocket:sockjs />
> </websocket:stomp-endpoint>
> <websocket:simple-broker prefix="/topic"/>
> </websocket:message-broker>
In eclipse console (catalina log) when I start Tomcat, appear the rows
Initializing ExecutorService 'clientInboundChannelExecutor'
Initializing ExecutorService 'clientOutboundChannelExecutor'
Initializing ExecutorService 'messageBrokerSockJsScheduler'
Mapped URL path [/monitor/**] onto handler of type [class org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler]
In the jsp page I put the code
. . . .
var socket = new SockJS("monitor");
var stompClient = Stomp.over(socket);
. . . .
Unfortunately when I load the jsp page from Chrome (v32), I get this error:
Failed to load resource: the server responded with a status of 404 (Not Found)
http ://localhost:8080/(ProjectName)/monitor/info
Obviously I'm doing this test locally, then all other webapp resources are reachable at http ://localhost/(ProjectName) correctly.
What's wrong?
**** Update 20 Feb 2014
I've tried to follow this resolved stack question, which suggests to use Tomcat8 for Spring Websocket, unfortunately it doesn't work
Any log output on the server side as a result of the request to /monitor/info? How is the DispatcherServlet itself mapped? I would expect to "/" from what you have above.
The SockJS endpoint is basically a URL mapped in Spring MVC (with a SimpleUrlHandlerMapping) so try other Spring MVC mapped controller methods. And turn up logging, could there be a filter or something else returning the 404?
For those who struggle with this issue this might helps.
I had following in web.xml:
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
And had 404 response for this url:
http ://localhost:8080/(ProjectName)/monitor
But this one works like charm:
http ://localhost:8080/(ProjectName)/rest/monitor
Cheers!

Session not save in bea weblogic 10.3

How to config my web application to work with sessions in bea weblogic?
In the web.xml there are this lines:
<session-config>
<session-timeout>60</session-timeout>
</session-config>
In the weblogic.xml:
<session-descriptor>
<persistent-store-type>memory</persistent-store-type>
<sharing-enabled>true</sharing-enabled>
</session-descriptor>
My question is how to config the server to work with session and when I do this:
_sess.setAttribute("user",user);
...............................
User user = (User ) _sess.getAttribute("user");
The variable user not to be null?

Adding Web App to WebSphere Liberty Profile via Eclipse plugin tools

I'm attempting to get an existing web application working with 'WebSphere Application Server Liberty Profile v8.5 Beta' using the 'IBM WebSphere Liberty Profile Tools for Eclipse'.
I have installed the developer tools for Eclipse as well as the liberty profile runtime by following instructions here:
https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/download?lang=en#comment-1321558450546
I then proceed to create the Liberty Profile Server by following the instructions here:
http://publib.boulder.ibm.com/infocenter/wasinfo/beta/index.jsp?topic=%2Fcom.ibm.websphere.w4d.nd.doc%2Ftopics%2Frw4d_dirs.html
I add my web app to the server and start it with the following console output:
Launching TEST (was4d-1.0.0.20111202-0614/websphere-kernel_1.0.0) on Java HotSpot(TM) 64-Bit Server VM, version 1.6.0_26-b03
Boot properties: file:/home/tbuckley/work/WAS/was4d/usr/servers/TEST/bootstrap.properties
Config document: file:/home/tbuckley/work/WAS/was4d/usr/servers/TEST/server.xml
[AUDIT ] CWWKE0001I: The kernel was launched.
[AUDIT ] CWWKE0002I: The kernel started after 0.91
[AUDIT ] CWWKF0007I: A feature update is starting after 0.92 seconds.
[AUDIT ] CWWKZ0058I: Application monitor started after 1.218 seconds.
[AUDIT ] CWWKO0219I: TCP Channel http-default has been started and is now listening for requests on host localhost (IPv4: 127.0.0.1) port 9080.
[AUDIT ] SRVE9998A: Application myWebApp added to web container.
[AUDIT ] CWWKZ0001I: The application myWebApp has started successfully.
[AUDIT ] CWWKF0008I: The feature update is complete after 2.141 seconds.
When I hit the web app url http://localhost:9080/myWebApp/ via a browser I get a blank page and the following console info:
[ERROR ] SRVE0015E: Failure to initialize Web application myWebApp
If I reload the page I get the following:
[WARNING ] SRVE0274W: Error while adding servlet mapping for path-->/login/*, wrapper-->ServletWrapper[Application Servlet:[/login/*]], application-->myWebApp.
[ERROR ] SRVE0015E: Failure to initialize Web application myWebApp
I also have the following servlets/mappings under my web.xml:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Application Servlet</servlet-name>
<url-pattern>/login/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
Any ideas what could be wrong here or how I could get more detailed debug info?
UPDATE
I just created a skeleton 'dynamic web project' there and put an index.html file in it. I added it to the liberty server and it worked by going to localhost:9080/simpleApp/index.html.
The exisiting dynamic web app I am trying to add is very large and complex.
I found the following under was4d/usr/servers/TEST/logs/ffdc/ffdc_12.02.16_16.40.33.0.log:
------Start of DE processing------ = 16/02/12 16:36:06:170 GMT, key = java.lang.NullPointerException com.ibm.ws.webcontainer.osgi.WebContainer 131
Exception = java.lang.NullPointerException
Source = com.ibm.ws.webcontainer.osgi.WebContainer
probeid = 131
S tack Dump = java.lang.NullPointerException
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:142)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:1860)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:499)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:5437)
at com.ibm.ws.webcontainer.osgi.WebContainer.discriminate(WebContainer.java:1095)
at com.ibm.ws.webcontainer.osgi.WebContainer.discriminate(WebContainer.java:1009)
at com.ibm.ws.dispatcher.http.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:143)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:444)
a t com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:378)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:278)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:249)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:502)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:550)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:899)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:981)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:662)
The spring setup in the web app appears to be causing some issue?
Thanks
Turns out it is an issue with Spring on certain platforms (WebSphere liberty 8.5 in my case).
Upgrading from Spring 3.1.0 M2 to Spring 3.1.1 fixes the issue:
https://jira.springsource.org/browse/SPR-8496

Exception when deploying a JSR 286 portlet into WebLogic+WebCenter 11g

I get the following exception when deploying a JSR 286 portlet into Oracle WebLogic Server 11g (to deploy it later in Oracle WebCenter 11g):
<19-ene-2010 13H32' CET> <Error> <oracle.portlet.server.containerimpl.PortletApplicationImpl> <BEA-000000> <Error al procesar el archivo "/WEB-INF/portlet.xml" en la lÝnea 6 columna 68.
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'portlet-app'
The error message is in spanish. It means:
"Error processing the file "/WEB-INF/portlet.xml at line 6 column 68"
The portlet.xml of my portlet seems to be correct and I've deployed it in other portal servers. So I don't understand the error message.
This is the portlet.xml of my portlet (eclipse XML validator said it was a valid XML)
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app version="2.0"
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:dnd="http://www.denodo.com/widget/portlet/portletjsr286">
<portlet>
<description>Test Inter Portlet Communication (JSR286)</description>
<portlet-name>Test IPC</portlet-name>
<display-name>Test IPC</display-name>
<portlet-class>com.denodo.ipc.TestIPCPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<resource-bundle>PortletMessages</resource-bundle>
<portlet-info>
<title>Test IPC</title>
<short-title>Test IPC</short-title>
<keywords>Test IPC,Denodo</keywords>
</portlet-info>
</portlet>
</portlet-app>
How do I deploy my portlet
I convert my portlet into to a WSRP portlet by executing
java -jar wsrp-predeploy.jar source EAR target EAR
as explained in http://download.oracle.com/docs/cd/E12839_01/webcenter.1111/e12405/wcadm_portlet_prod.htm#CHDECJHI)
I try to deploy it into WebLogic with the WebLogic Console and I get this exception.
My Environment
WebCenter Suite (11.1.1.2.0) + WebLogic Server (10.3.2) downloaded from the oracle.com. Default configuration
S.O: Windows XP SP3
Thanks in advance for your time.
Have you tried using the openPortal portlet-container? The doc says it will install onto weblogic: https://portlet-container.dev.java.net/public/Download.html
Update: I just installed the portlet-container into the weblogic container and successfully deployed one of the sample portlets from this page: \http://portlet-container.dev.java.net/public/Samples.html

JSF Faces Bridge get java.lang.NullPointerException when deploying to oc4j container

I am running JDeveloper 10.1.3.4 with the webcenter pre-configured oc4j.
I'm trying to portletize a vanilla JSF webcenter project.
I create a application using the webcenter application template.
Add a JSF JSP, simple called it index with all the default values.
Add a deployment profile and deploy to local oc4j
navigate to the jsf page and everything works.
right click on ViewController and add the library Portlet Faces Bridge
right click on ViewController and add a Portlet Deployment descriptor.
Edit portlet.xml with the values from link text
in portlet.xml i replace the Default page view with my /index.jspx
when i try to deploy to local oc4j i get the follow
---- Deployment started. ---- May 1, 2009 2:29:37 PM Target platform is
Standalone OC4J 10g 10.1.3
(localAppServer). Wrote WAR file to
C:\jdevstudio10134\jdev\mywork\test\ViewController\deploy\webapp2.war
Wrote EAR file to
C:\jdevstudio10134\jdev\mywork\test\ViewController\deploy\webapp2.ear
Backing up generic archive file
:/C:/jdevstudio10134/jdev/mywork/test/ViewController/deploy/webapp2_generic.ear
Creating WSDLs for the WSRP
Application WSDLs for the WSRP
Application have been created
Uploading file webapp2.ear ...
Uploading file webapp2.ear ...
Application Deployer for webapp2
STARTS. Copy the archive to
C:\jdevstudio10134\j2ee\home\applications\webapp2.ear
Initialize
C:\jdevstudio10134\j2ee\home\applications\webapp2.ear
begins... Unpacking webapp2.ear Done
unpacking webapp2.ear Unpacking
webapp2.war Done unpacking webapp2.war
Initialize
C:\jdevstudio10134\j2ee\home\applications\webapp2.ear
ends... Starting application : webapp2
Initializing ClassLoader(s)
application : webapp2 is in failed
state Operation failed with error:
java.lang.NullPointerException
Deployment failed Elapsed time for
deployment: 3 seconds
Deployment incomplete. #### May 1, 2009 2:29:40 PM
if i deploy the WAR file by hand and navigate to the page i get 500 internal server error.
09/05/01 14:49:21.984 webapp2: Servlet
error java.lang.NullPointerException
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
at oracle.portlet.server.bridges.jsf.PortletViewHandlerImpl.renderView(PortletViewHandlerImpl.java:73)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0)
].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher
.java:713)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0)
].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher
.java:370)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0)
].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler
.java:871)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0)
].server.http.HttpRequestHandler.processRequest(HttpRequestHandler
.java:453)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0)
].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler
.java:221)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0)
].server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0)
].server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0)
].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor
.java:303)
at java.lang.Thread.run(Thread.java:595)
My portlet.xml file looks like
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<portlet-app version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
<portlet>
<description>myapp</description>
<portlet-name>test</portlet-name>
<display-name>myapp</display-name>
<portlet-class>oracle.portlet.server.bridges.jsf.FacesPortlet
</portlet-class>
<init-param>
<name>DefaultPage.view</name>
<value>/index.jspx</value>
</init-param>
<init-param>
<name>BridgeLifecycleListeners</name>
<value>
oracle.portlet.server.bridges.jsf.adf.ADFFacesBridgeLifecycleListener,
oracle.portlet.server.bridges.jsf.adf.BindingFacesBridgeLifecycleListener
</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<portlet-info>
<title>myapp</title>
<short-title>test</short-title>
</portlet-info>
</portlet>
</portlet-app>
...if i delete the file and redeploy the jspx page works fine.
you should move to jdev 11g which uses wls which is much better than oc4j

Resources