FF4J with Spring Boot in IBM WebSphere 8.5.11 server giving Error 500( SESN0008E) while accessing static resources(css,img) - spring-boot

I am using FF4J-Web as a maven jar dependency in my Spring Boot application. I am able to run the application in local environment without any issues( embedded tomcat and IBM Liberty Servers). However I am facing some issues in rendering view components when I promote the changes to development environment server(IBM WebSphere 8.5.X) which seems to be due to authorization issue. Please find below responses I got while accessing static contents.
Response Code 200: https://dummyserverlink.com/rootcontext/ff4j-web-console/static/js/jquery.dataTables.min.js
Response Code 500: https://dummyserverlink.com/rootcontext/ff4j-web-console/static/css/bootstrap.min.css
Response Code 500: https://dummyserverlink.com/rootcontext/ff4j-web-console/static/png/ff4j.png
As you can see above, .js files are downloading without any issues. But .css and .img files are not authorized and accessible in the browser(Error Code Status 500). But all resources are present under static folder only. Please note that since I have added FF4J as a maven dependency all the static contents are present inside WEB-INF/lib folder
So if I try to access the .css/.png resource directly from browser, I am getting error ‘Error 500: SESN0008E: A user authenticated as anonymous has attempted to access a session owned by loggedUserName.’
Disabling the security configuration in Websphere is not an option we can go with as the same server is used for multiple applications. Also I am using third party login API for authentication at server level.
Is there any other way that you can share you expertise to bypass the authorization error for static resources(css,img) that are inside the WEBINF folder?
Regards
Dinesh

Related

No response when trying to publish the project on to the WAS Server

I have imported a project into the eclipse and it has different modules like
Audit
AuditEJB
Common
CommonLoginConsumer
Core
Db2Integration
EJB
InitWeb
Integration EAR
MDMIntegration
PrepackagedApps
Properties
SchedulerEJB
ScreensWeb
WebServiceConsumer
WebServiceProvider
Provider
CCWSTest (Gradle module)
CTest
CUiWeb
UtilityTestEAR
UtilityTestWeb
Configured build Path, solved all the Java Problems. In the company that I'm working to configure WAS Server 8.0, we need to configure DSC which has all the deployment frameworks.
In Servers (Right click)> Add and Remove, I have IntegrationEAR and UtilityTestEAR
UtilityTestEAR contains Properties, and UtilityTestWeb
Integration EAR has apsclient-source.jar, Adit, AuditEJB, Common, CommonLoginConsumer, Core, Db2Integration, EJB, InitWeb, MDMIntegration, Properties, SchedulerEJB, ScreensWeb, WebServiceConsumer, WebServiceProvider, Provider, org.apache.soap.encoding61.jar
When I added UtilityTestEAR to the WAS Server, Server started Successfully and when I try to publish there was no response.
When I added IntegrationEAR to the WAS Server, when I started the server, there was an error saying:
The publish encountered some problems and the application may not have been installed or it may have been successfully installed but was unable to start.
The application contains validation errors. Correct the errors in the Problems view before publishing the application on the server.
If you want to allow applications containing errors to be published on the server, enable the Allow applications containing errors to be published on a server check box (Windows > Preferences > Servers > WebSphere).
CHKJ2802E: class com.ford.mss.cdr.cib.mdb.CdrAuditLogMDB, or one of its supertypes, cannot be reflected. Check the classpath.
I am trying to deploy to my localhost.
Please Suggest

Spring RestTemplate GET: reading directories from Apache

apache server is used for static contents. We are able to GET required resource having fully qualified path:(e.g. http://cmsTest.com/content/otp.txt). However, now we need to scan all folder available under
http://cmsTest.com/content
I need to access directories available at particular location via Spring REST GET api. When I am trying to access(http://cmsTest.com/content) it, getting 404 error.
Could you please provide suggestion for the same?

Tomcat Context Root - Tiles Exception when deploy a Spring app to Tomcat

I have a Spring MVC 4 application deployed in tomcat. It works fine. I have to clone this app to have several applications with same behaviour but different configurations: database instance and folders for file management. Each for different customers. When I deploy de original application to Linux Tomcat it works fine (https://hostname:8443/app1).
Then I change the db connection settings (database name, username, and folders to manage some generated files) and change the name of the artefact to customername. But when I get into the application, it shows the login page right, but when login into the app, I'm getting the following error:
Status HTTP 500 - Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: java.io.IOException: JSPException including path '/WEB-INF/layout/header.jsp'
javax.servlet.ServletException: File [/WEB-INF/layout/header.jsp] not found
when accessing to https://hostname:8443/customername, which it's part of tiles template. Files exist in the deployed application, It's able to reach the login page, so it seems to be resolved the tiles config, but I don't know why is not able to reach the jsp files. It's working fine in local windows without secure Tomcat (port 8080).
EDITED
If I change the name of customername.war to app1.war it's working fine. Anybody knows where the war file keep a reference to the base application app1? It seems that there a reference to app1 in somewhere that makes that If I change the application name (artifact id) it does not reference to customername path.
Seems that it's a context root issue. I have changed it in STS (Project > Properties > Web Project Settings > Context root), deployed on Tomcat but still not working. It's supposed that only with changing the war file name, the context root of the application should be updated, but it's not working.
Upgrading Tomcat from 8.0 to 8.5.5 solves the issue. I don't know why, but there's an issue in 8.0 because no way to force context root for an application, not context.xml application file neither other configuration.
Just upgrade to 8.5.5 and deploy applications without context issue.
BR

How to run JAX-RS in Maven project of JAVA EE?

This is what I did on NetBeans.
New Project -> Maven -> Web Application
and gave my project name
And, created new RESTFUL Web services from patterns
selected Simple Root Resource
Assigned path "foo"
and hit finish
And now, I tried to access it from browser as
localhost:8084/context/webresources/foo
And, it shows 404 resources not found error.
I checked if it works with non-maven based projects, and it does. Accessing the resource was possible on those but, not on maven based.
I must have missed something.
I also tried to see if it is accessible from netbeans by doing right-click on the RESTful Web Services and clicking TestResource Uri,
It shows error
Unable to open resource url.
the uri of the rest location
Make sure project has been deployed successfully and the server is running.
While both have been done!!

WAS Liberty not serving images, css, js

I have an application which is working fine on Websphere server (as war and Eclipse Project).
Direct deploy on Liberty through WAR is also working fine.
I was trying to deploy it on WAS Liberty through Eclipse project. There are no console errors but once the application loads, none of the following files are getting loaded in the web page: js, gif, css
Because of this the page is looking distorted and most of the functionality is lost.
Surprisingly there are some JSPs in the js folder and these are getting loaded, so looks like the folders are published properly. But for all the mentioned files (js etc), I get following error in the browser console: 500 (Internal Server Error) .
There are no errors and the server log is also clean.
My setup: WAS Liberty 8.5, RHEL 6.5. Eclipse Luna, WDT 8.5.5.2. Project having Eclipse structure, not maven.
I have tried both loose config and 'from workspace' settings
Edit1: I noticed that Spring beans are not getting initialized properly. Getting null pointer on applicationContext.getBean.
OK, found the problem.
As I guessed this was related to spring initialization, though the problem was more code related.
Due to wrong implementation of REST implementation, where the base path was set as root application path (“/”), rest API classes were getting instantiated on application load and were then making calls to code which was instantiating few Spring beans.
But at this point the Spring listeners had not fired, hence the appcontext was empty. Some of the base application object were getting initialized with empty beans and hence spring security context and related classes were failing to serve the application content properly. (Problem is spring related code is created by another team and we just get the jar, hence I am not even able to debug it properly, so I don't know where it was failing exactly)
The thing that makes it Liberty specific is: The same problematic code is working fine on Websphere full profile and Weblogic and even on Liberty if we deploy as WAR. Not sure what classloading difference is causing difference in behaviour.
Thanks to all who took time and efforts for replying.
I am facing the same issue using open liberty and Eclipse Krazo when the base path is
application path (“/”)
so i have changed the path as shown below
package io.openliberty.sample;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
#ApplicationPath("")
public class ConfigApplication extends Application {
}
Now the CSS and imgs are loading with no issues.

Resources