A very strange issue happening.
I have developed an application under JSF and Primefaces on tomcat 6 on my local computer. Everything works perfect.
But when I deploy the application on remote tomcat 6 (Under enterprise RedHat Linux), the primefaces stops working. The funniest part:
the response takes a lot of time, and it returns the generated html (so it seems like it calls the lifecycle). But no components are rendered (there is plain lot of html intermixed with javascript functions) - p:tabView and other components` contents are rendered as simple lines of text.
But as for the Javascript, it states - ReferenceError: PrimeFaces is not defined.
Catalina log file states nothing.
I have no idea what it can be. Is there any idea?
1) Check what dependencies your project has in eclipse build path. Verify all of them are available in your remote server . All the dependencies in build path should be copied to the lib folder in war file you are generating(unless they are runtime like tomcat,jdk etc).
2) Verify your web.xml and faces-config.xml is same in your eclipse and war deployed in remote.
If it doesn't work then you can compare the temp folder in your eclipse to the war you are deploying contains everything that is in local.
You can find your local war by searching for your project file in eclipse under your workspace
The problem was security for Tomcat. It did not allow any redirections so the js-files were listed in the links but nothing was fetched. Problem was solved by reinstalling tomcat.
Related
I deployed a portlet in liferay 7 and it got deployed successfully and was available for use. I want to replace the jsp file, in earlier version I could see my application in tomcat/webapps folder and replace it quickly.
Now I am unable to locate the exploded war in liferay 7. I can only see the war in osgi/war folder.
Can someone help me with that.
Thanks in advance.
While I mostly agree with what Olaf wrote, I do understand the need to be able to make changes in JSP files and try them quickly during development. I'm afraid I don't have the solution for that yet.
However, let me answer the question you asked:
where is war exploded in Liferay 7 tomcat after getting copied in osgi folder
It is NOT (at least not the way it was done by application servers)! When you deploy a WAR file in Liferay 7, it will automatically (on the fly) convert it into OSGi bundle and install it in OSGi runtime. This way now Liferay is fully in charge of deploying plugins and does not need to rely on various application servers.
PLEASE NOTE: Every bundle has it's own state folder. In Liferay those are in <LIFERAY_HOME>/osgi/state. If you know the bundle ID you can easily find it. It may be (I haven't checked) that you'll find some JSP files there. The reason I'm writing this is to warn you (in case you figured it yourself) to NEVER modify bundle's state folder manually. Doing so may brake the whole environment. In worse case scenario you may have to redeploy everything in clean environment.
You should not rely on behavior like this. In previous versions it was the task of the application server to compile changed JSPs at runtime. However, this is bad practice in production systems and totally screws up your maintainability. If you need to update some UI code frequently, I'm suggesting you change your implementation to utilize ADT (Application Display Templates), e.g. through Freemarker or Velocity. Those are meant to be updated at runtime, where the JSP updates were a side effect of Tomcat's default (development friendly, production hostile) configuration
The default for Eclipse EE seems to be to build java code in build/classes not in WEB-INF/classes or WEB-INF/lib/my.jar. I can create a .war file which has the entire project, but then every time I build, I have to manually generate the war file. My current setup which has the WebContents directory symbolic linked to /var/lib/tomcat7/webapps/ROOT, in which case all the web pages are by definition in the right place, but the code is not there.
I'm willing to take a suggestion on how to get this to happen automatically, but I would like to know WHY there should be the need in the first place? Why would I want to have my build directory for a web application anywhere other than the directory where it should be executed? Is there any way to get eclipse to build the !%*#% class files in a sane place, or is there in fact a reason why an EE app would have code that does not go on the server? Is there something simple that I can add to trigger a rule in ant or mvn to move the code to the right place?
Compounding this problem, I am switching over to Ubuntu (Not that this works under windows at the moment either).
I was getting weird errors, and it turns out I didn't have jdk7 installed.
So I installed it, but how do I even know what java is being used to run tomcat and eclipse? How do I know it will use jdk7 and not the one that was used before? On windows, when I tried to run Eclipse, it gave a straightforward error when Java wasn't installed so this never happened.
I type javac -version and get the correct one, but this does not guarantee that some service like tomcat7 will use the same one.
The error (same on Windows)
An error occurred at line: 3 in the jsp file: /demos/post.jsp
ReadBody cannot be resolved to a type
1: <%# page import="org.adastraeducation.liquiz.servlet.*" %>
2: <%
3: ReadBody b;
4: %>
5: <html>
6: <body>
The current (ridiculous) way to stop this error is:
cd build/classes
jar -cf my.jar org
sudo mv my.jar /var/lib/tomcat7/webapps/ROOT/WEB-INF/lib
sudo service tomcat7 restart
Eclipse Web Tools can manage building and packaging a web-app (WAR) and automatically running it on a local server of your choice. This includes re-deployment when changes are made, debugging, etc. But you have to create or configure your project as a Dynamic Web project for Eclipse to know to do that for you.
For starters, you'll need to either download the Eclipse IDE for Java EE Developers package or use the Eclipse Installer to get it. Then you can peruse the Web Tools help (for example, start here).
I'm very new on Java Web dev. On intellij Idea 14, I started a new project with plain Java, JSF support (no JavaEE, will add Spring later). Tomcat 7.0.59 as server. When I hit run on the IDE, firefox opens up and hits on 'http://localhost:8080/index.xhtml', it should display the hello world in index.xhtml that the IDE makes on new project, but the page just displays 'HTTP 404'.
I think the problem is path on the browser, how can I find the correct path and configure it on IDE deploy settings?, how can I debug on tomcat?, where can I start looking?
http://localhost:8080/index.xhtml is an incomplete address. Where is the context root? It should be the name of your project/webapplication, where you would have
"http://localhost:8080/{application-name}/index.xhtml".
Unless you've set your application to be the default tomcat application (which I highly doubt), you should have the name of your project in there in the URL
%CATALINA_HOME% is Tomcat install directory. Use %CATALINA_HOME%\logs to read Tomcat log for debugging.
When you create a new Java web project, It also means you are diving to Java EE (Enterprise Edition).
Create new JSF web application by IntelliJ IDEA:
Offical tutorial for you: http://docs.oracle.com/javaee/7/tutorial/partwebtier.htm#BNADP .
You should use GlassFish 4 application server for simplicity at first one.
move the lib directory into WEB-INF
When I deploy the jar file or Zip file it displays and error message saying there is no installed container capable of handling this application(I use admin console)
Primefaces is a JSF library, not an EAR/WAR/EJB-jar module. It is supposed to be deployed along with the application (i.e. within an EAR/WAR), not separately on the server. Include it in you application and it will available after deployment.
I have a Seam application running on:
Linux CentOS
Tomcat 6.0.32
Java 6
JBoss Seam 2.2.1
RichFaces 3.3.3
When I run my application locally, everything works fine (Windows 7 here). But when I put the exactly same files on my server (VPS), the Tomcat starts with no errors, but the application do not load RichFaces components.
I've searching the solution for this problem for a few days, but didn't found nothing that can help me. I thought could be a permission problem (application's folder permission), so I've tried to change it too many ways, but RF components keep not loading.
Anyone can imagine what is happening?
Thanks in advance!
Fabricio Braga
I have solved the problem. The point is that in my case I have an Apache HTTP Server before Tomcat, and RichFaces add some JS files from JAR files. So, we need to map, editing apache config files to redirect also this JS files to Tomcat.
Then, I just edited this Apache mappings to point RichFaces JS files to Tomcat, for example:
"/my-domain-name/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js" mapped there: "/my-domain-name/a4j/*" for the Tomcat. And the same for the others files.
After that, the problem was over.
Regards,
Fabricio Braga