I'm trying to work out a proof of concept with SSO using JOSSO. However, i'm having issue installing JOSSO on my server, which is a Weblogic 10 instance.
I have managed to install JOSSO in my domain. However when i start the server, there's an error saying it failed to parse one of the configuration XML file on the server because the file is not found. I double check the directory and the XML file is actually there.
The exception:
SEVERE: IOException parsing XML document from class path resource
[josso-gateway-config.xml]; nested exception is
java.io.FileNotFoundException: class path resource
[josso-gateway-config.xml] cannot be opened because it does not exist
Also another issue i'm facing is, on my production server, the webapp directory is actually in a separate partition as the Weblogic home folder. I found that the JOSSO installation program will assume that both of them are located in the same directory. Is there any way i can customize this?
Thanks in advance.
Managed to get it solved. Posting it here in case can help someone.
Due to the setup of my weblogic environment, i have decided to explode the war file, and deploy it as an exploded directory. Steps i followed:
Use WinRAR and unrar the war file into a directory
Copy all the xml configuration files into the classes folder
Rename one of the stores configuration file into josso-gateway-stores.xml
Deploy the exploded directory
Related
We have a war file that uses java, spring etc. I have to deploy this war file in Websphere 9. I had setup datasource. I am getting the following error when I try to deploy the war file.
com.ibm.websphere.management.application.client.AppDeploymentException: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.NestedJarException: IWAE0008E An error occurred reading WEB-INF/lib/spring-context-5.0.16.RELEASE.jar from /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/wstemp/92668751/upload/awdcs.war [Root exception is org.eclipse.jst.j2ee.commonarchivecore.internal.exception.NestedJarException: IWAE0008E An error occurred reading WEB-INF/lib/spring-context-5.0.16.RELEASE.jar from /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/wstemp/92668751/upload/awdcs.war]
Any thoughts on what is causing this issue and how to proceed further?
It may be a class-loading order issue. Try changing the order from parent_first to parent_last from the settings of the server. Check out How Does WebSphere Choose the Classloading Order in a Folder (WEB-INF/lib) and https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.base.doc/ae/crun_classload.html
Check if the jar dependency "spring-context-5.0.16.RELEASE.jar" is part of the war file "awdcs.war". You can unzip the WAR file and inspect.
Make sure the jar is included in the war when it is built or worst-case add the jar as part of the websphere runtime.
My case was with spring-core-4.2.4.RELEASE.jar, the solution for me was extract of WEB-INF/lib and put in classes/spring-core-4.2.4.RELEASE.jar. Was necesary delete of lib
I have been testing my tomcat 8 setup on debian 9. Everything seems fine until I try to deploy a helloServlet WAR file through tomcat 8 manager. I created the very simple example program following the instruction here.
I use tomcat manager to upload the HellowServlet.war from my working directory. Then I can access it though http://localhost:8080/HelloServlet/sayhello
The program works just fine. However, no matter how I search (/etc/tomecat8 /usr/share/tomcat*), I just can not find the war file or any components inside of it. I really want to know the exact location of my application file. Anyone may tell me where the application files are stored by the tomcat 8 mananger?
More update:
I just tried to upload the same war file again, and I got following message from tomcat
FAIL - War file "HelloServlet.war" already exists on server
That means the war file is sitting somewhere on the server, but the path is unknown to me.
Found it.... it's inside /var/lib/tomcat8/webapps
However, I can not find any configuration file in tomcat 8 describing that it uses /var/lib/tomcat8 as one of its working directory.
I have an application running fine on localhost but I am having issues when It is deployed on tomcat
The code I am using to read the file is :
File jasperFile = new File(getClass().getClassLoader().getResource("reports/Header.jasper").getFile());
I get this error in catalina :
net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: file:/usr/local/apache-tomcat9/webapps/com.peek.facture.server/WEB-INF/lib/facture.server-1.0.0-SNAPSHOT.jar!/reports/Header.jasper
What triggers me is the "!" at the end of the jar name, where does it come from?
Also I have tried to download the jar, extract it, and my Header.jasper is correctly in the resources/reports/ folder
When you run on your local a stand-alone physical file Header.jasper exists (you can physically see it when you browse the reports directory).
However when you deploy to a tomcat server, that stand-alone physical file no longer exists. Instead, if you set-up your build correctly, when you open up your jar (facture.server-1.0.0-SNAPSHOT.jar), there should be a directory called reports in it with the file Header.jasper within that directory.
So when your try get a resource via getClass().getClassLoader().getResource(...).getFile() you are actually trying to access a stand-alone physical file. Instead you need to get the resource as an InputStream and then work with if from there...
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("reports/Header.jasper");
When working with resources, it's always better to rather access them this way. Especially if you are planning to deploy anywhere with a single artifact, because your resources should be packaged in with your artifact.
Question 1: May I ask what is the difference between deploying a java webapp with it's WAR file vs just copy/pasting the build folder into tomcat webapp folder?
Question 2: Somehow I am told to deploy my project just by renaming my /build/web folder to /build/, then copy and paste this folder into tomcat/webapp folder. Tomcat did serve the web app and I could access it via url. But the problem is that I suspect my System variables were not set. I start up a servlet and put this code in this init(ServletConfig config) method:
System.setProperty("LogPath","D:/Test/logs");
And doing this in my log4j.properties
log4j.appender.file.FILE=${LogPath}/wrapper.log
wrapper.log is not found in the designated directory but a stdout.log is found in tomcat/logs folder.
I am sure the init() method was fired because I have a quartz scheduler there. I am suspecting that my System.setProperty was not set. Any hint?
Update: With all the same source code, I have no problem if I am deploying with a WAR file. The ${LogPath} in log4j.properties work as expected.
Let me answer you the first question.
WAR file is a zip archive with different name. When you deploy this file to the Tomcat server, it unpacks this file to its folder as you would do it by copy-paste. If you are just developing your own project in your own environment and you don't want to distribute it, you don't need to create a war file. But if you want to distribute this project, I recommend you to create a war file. One file is easier to be sent.
Read more on Wikipedia http://en.wikipedia.org/wiki/WAR_%28file_format%29
I have an application/war deployed in server. Now at runtime I want to add an xml document to the war/application. can I do that? if yes, what is the path of an war/application for it to be added.
You have to repackage the WAR, redeploy, and bounce the server. It's not that simple.
You can make that data available without the hassle if you put it in a database and have your application access it there.
in the webapps/WEB-INF folder you can find the xml files
It depends on the servlet container/application server.
If you are using Tomcat, wars are getting unpacked to the webapps directory inside the Tomcat directory.
Move webapps/app directory outside the webapps directory, what will cause an undeploy of app
Put your xml file into the app directory
Move app back to webapps what will cause a deploy