PlayFramework2: css not loading on heroku - java

I have a play2 application and have tried to deploy it on heroku .After deployment, the application does not have styles at all. I've re-tested the application on my local/dev machine and all is working fine.
So, Could some one told me how to fix play2 issues with css ?

Thanks to all, I've found problem and fixed it. So, short description:
After log analysis I've found some issues in urls like next path=/assets//stylesheets/style.css, so, after deleting one / symbol from url all is started working.
So, as conclusion , local version can work and load resources with additional / symbols in path but heroku cant.

Related

Spring Boot in Intellij won't load image

I'm just starting to learn Spring reading "Spring In Action" and I cannot get my image to load on anything other than port 8080 (where tomcat launches). This would be fine normally, but I have to keep restarting the program to load any changes to my webpage.
Intellij tries to run my web program on port 63342, but no images load, only text. I believe this is an issue with Thymeleaf. I tried pointing tomcat to port 63342 but it won't load (port is in use?)
I would like it to where I can get the reload on save feature to work, and especially being able to use the shortcuts in intellij to launch the web page.
Any suggestions?
Basically the problem is, as I understand, that you're trying to open your .html template directly from IDEA. Which means you're not using the thymeleaf engine to render it - you're just opening the template itself and not the resulting page. If you open the source code of this page using your browser's dev tools, you will see that all your expressions stay unprocessed which leads to it trying to fetch the resources on the wrong port (e.g. 63342 instead of 8080 where your application is really running and is ready to serve the resources).
Thus, you cannot edit your templates like this. But Thymeleaf does have an option to do that. If you're running your Spring Boot application from the IDE directly (e.g. a profile in Intellij IDEA Ultimate) you can add the following to your application.properties:
spring.thymeleaf.cache=false
This will tell your Spring template resolver that you do not want to cache your .html templates and it will load the files from disk every time, so if you modify your template and then hit IDE's build button it should re-package your template and when you refresh your page in browser it will load (and process!) the edited one.
Caution! Only use this for development builds, set value to true for production environments to prevent unnecessary re-reading.
See Spring Boot Docs on Hot Swapping for more.
if you want intelj to display your image you have to add a regular src and add a th:src to show the image when the program is run. Try adding both
<img th:src="#{/assets/img/image.svg}" src="../static/assets/img/image.svg"/>

Loading an external class folder in eclipse - java

I am trying to use the LPsolver on a project I am working on. (it contains both jar and DLLs).
When I ran it locally it worked (System.loadLibrary("lpsolver"))
But now I am trying to upload it to an amazon server which is running tomcat.
I can't get the tomcat server to load class library correctly.
Tried to include it in all kind of different locations and loading it but non seemed to work.
Any idea how I can accomplish it ?
Thanks!
EDIT:
Tried lots of stuff I found on the web, mainly ways to include the class library I need inside the project and not a reference through the local vars.but my project does not seem to recognize it. Also wanted to upload it to my amazon web server ( to system32) but I guess because I use the free version that option is not included...

SO libraries not loading when running as Java web application

I searched a lot in So. But could not find a proper solution. Here is the problem
I have some .so files to load in my java application.
I created a Java class with main method and loading it using System.load();
System.load("/home/myfolder/TFS-SDK-11.0.0/redist/native/linux/x86_64/libnative_auth.so");
System.load("/home/myfolder/TFS-SDK-11.0.0/redist/native/linux/x86_64/libnative_console.so");
And then my Java codes. When I run the class as Java application, it is working fine.
Then I added the same code in my Java web application. And I run it in tomcat. But It is showing some error
Exception in thread "main" java.lang.UnsatisfiedLinkError
I found that this is because it is not loading the library files.
When I searched in google, I found some solutions but it didnt help me. I tried adding the so file location in
setenv.sh, catalina.sh in JAVA_OPTS. But none worked.
Some solutions I don't even understood.
Can someone give the step by step proces of
Where to put the so files in tomcat?
Which file I should edit and What should I add?
I searched a lot. But most answers I don't understand.
When you run your app in a web container such as Tomcat, your main method will NOT be called.
If you want to load these libraries when the container starts, then I'd suggest using a ContextListener.
Try googleing "context listener example in java" - you'll get plenty of hits and plenty of examples to follow.
You will probably also need to add these libraries on to your Unix Library Path. It's usually convenient to do this in your tomcat start up script. The name of the library path variable is unix flavour dependent, so I can't tell you what that path is I'm afraid.

Sudden 404 not found error on all files in my Java GAE app without any changes to files or configurations

I'm running a paid GAE app written in Java and it's id is clip-share, so the url is http://clip-share.appspot.com/.
I've run it for more than 10 months, and since 2 days ago, it starts not working with 404 not found error on all static and dynamic URL.
When I connect to my app's URL, it just throws this message that there is no index.html file which really does exist.
Error: Not Found
The requested URL /index.html was not found on this server.
I tried re-deploy this app for a few times, but it works with no problem just only for a few minutes right after the deploy, but doesn't work after that.
And also searched for the 404 not found problem, I found this thread but there is no specific information about the cause and some way to solve it.
https://groups.google.com/d/topic/google-appengine/8liP4T-wbSo/discussion
So, what's happening? and how can I handle it?
EDIT:
I found a workaround for this problem, that is making another version, say version 2, and set it as default. But you can still see the problem in this URL for version 1, just put 1. just before the URL. (I want to show you the full URL to the version 1, but I'm rather new to stackoverflow.com, and not permitted to post more than 2 URLs in one question.)
So, the same code and configuration in two different versions, but only version 2, the newer one works.
in web.xml should be welcome file tag. Perhaps you have there /index.html. Find in web.xml "/index.html" and change it to "index.html".
index.html file should be in war folder: /war/index.html
It turns out to be that there was a configuration problem in Google App Engine plugin of Eclipse. That I have several GAE projects in one Eclipse workspace, and other GAE project accidentally deployed to the clip-share. So it looks like that there was 404 not found problems happening, suddenly. Anyway, thank you guys.

channel.connect.failed error when deploy flex/java project to linux redhat server

i keep getting this error ive been looking at it for a day now and im just beat. i was wondering if anyone can help me.
this is the error
Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:8080/Learn/messagebroker/amf'
when i do this locally on tomcat server on local development machine it works fine when i brought it over to linux im getting this error.
i dont know what to do anymore it should be straight forward but i'm having no luck.
i do have a web.xml and i see a broker for my remote access so i just dont know what it could possibly be. i would appreciate any help anyone can offer.
Miguel
ok i figuered it out. when i brougth my project over to linux tomcat expects to see all the java classes, flex config files and web.xml file under the root/web-inf. I wish i can change that but thats just the way it works. I was hoping with blazeds i can just put my files on a server and it would all work but thats not the case so if your like me and are new to the whole blazeds scene. Be careful you will nee to change the server web.xml file along with adding additional files under the ROOT/WEB-INF directory. One thing that helped me alot was the LOG files under tomcat_instal/LOG/logfilename.
Good luck to you

Categories

Resources