We are developing a web application using
Oracle ADF
jDeveloper
Tomcat
The application is running fine on Integrated WebLogic Server. But when we are trying to run this application in tomcat, browser showing xml code of index.jsf instead of actual output, as follows
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:document title="index.jsf" id="d1">
<af:form id="f1">
<af:region value="#{bindings.loginflowdefinition1.regionModel}" id="r1"/>
</af:form>
</af:document>
</f:view>
Please help us.
Thanks in advance.
Related
I use Solarium to access Solr with Symfony. It works without problem on my computer and dev computer but not on prod server.
On the prod server, Sorl is running with the same configuration, same port, same logins.
Do you have any idea of what can be the problem?
Here is the error
Solr HTTP error: OK (404)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Not Found</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Not Found</h2>
<hr><p>HTTP Error 404. The requested resource is not found.</p>
</BODY></HTML>
Problem solved. There was a wrong proxy installed on the windows server.
I am trying to import cvs file data into remote Solr.
My command is:
curl "http://mydomain.io/solr/#/qacheck/update?commit=true" --data-binary "d:\maincat.csv" -H "Content-type:application/csv"
I am getting output like this:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 405 HTTP method POST is not supported by this URL</title>
</head>
<body><h2>HTTP ERROR 405</h2>
<p>Problem accessing /solr/index.html. Reason:
<pre> HTTP method POST is not supported by this URL</pre></p>
</body>
</html>
And after I tried like this:
curl "http://proxy.sip.solr.qacheck1.test9.mcc.gb-lon1.metroscales.io/solr/qacheck/update?commit=true" --data-binary "d:\maincat.csv" -H "Content-type:application/csv"
Now I am getting this response. I verified, no data imported.
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">3</int></
lst>
</response>
# in URLs indicates a local anchor. This value is never exposed to the server, and is only used internally in the browser to link to a specific part of a page - or in many modern web applications, to keep some local state about the current javascript context. In the first URL above, you've included the browser part of the URL and not used the actual URL to the update handler.
In your second attempt you're not including the file, just the verbatim text d:\maincat.csv. If you want curl to read a file and submit its content (instead of submitting the verbatim path), you have to prefix the value with #. So --data-binary "#d:\maincat.csv" should do what you want.
It is quite strange when I add faces-config.xml file in WEB-INF in my project it cause me an error "RES_NOT_FOUND"
note: I have try <link type="text/css" rel="stylesheet" href="style.css" />
and it's working fine without the faces-config.xml. I also try to move it inside resources folder
I have try to use this code to add a css file for my .xhtml page
<h:head>
<h:outputStylesheet name="styles.css" />
</h:head>
it will generate the following
<link type="text/css" rel="stylesheet" href="RES_NOT_FOUND">
I am using JSF 2.2 + Google App Engine as I follow the tutorial from this site
http://java.wildstartech.com/Java-Platform-Enterprise-Edition/JavaServer-Faces/javaserver-faces-22/configuring-jsf-22-to-run-on-the-google-app-engine-using-eclipse
the tutorial went good except until I try to import a external files like .css, .js, and image files; and when I access it directly from the link like localhost:8080/style.css the css file will display correctly.
here is my code
the web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>
My App
</display-name>
<description>
Template JSF 2.2 application configured to run on the Google
AppEngine for Java.
</description>
<!-- ***** Designate client-side state saving. ***** -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<!-- Set the default suffix for JSF pages to .xhtml -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- Disable use of threading for single-threaded environments such as the Google AppEngine. -->
<context-param>
<param-name>com.sun.faces.enableThreading</param-name>
<param-value>false</param-value>
<!-- <description>
When enabled, the runtime initialization and default ResourceHandler
implementation will use threads to perform their functions. Set this
value to false if threads aren't desired (as in the case of running
within the Google Application Engine).
Note that when this option is disabled, the ResourceHandler will not
pick up new versions of resources when ProjectStage is development.
</description>-->
</context-param>
<!-- ***** Specify JBoss Expression Language Over Default -->
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
<!-- ***** Load the JavaServer Faces Servlet ***** -->
<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>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>primefaces.UPLOADER</param-name>
<param-value>commons</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config1.xml</param-value>
</context-param>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>2147483647</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
</web-app>
the index.xhtml
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<f:facet name="first">
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
<title>There is Hope!</title>
</f:facet>
<h:outputStylesheet name="style.css" />
</h:head>
<h:body>
<h:graphicImage url="logo.png"/>//this line works!
<br />
Hello from Facelets
<br />
<h:link outcome="welcomePrimefaces" value="Primefaces welcome page" />
</h:body>
</html>
the appengine-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://kenai.com/projects/nbappengine/downloads/download/schema/appengine-web.xsd appengine-web.xsd'>
<application>RetailSmarts</application>
<version>1</version>
<!--Allows App Engine to send multiple requests to one instance in parallel:-->
<threadsafe>true</threadsafe>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<sessions-enabled>true</sessions-enabled>
<async-session-persistence enabled="true"></async-session-persistence>
</appengine-web-app>
the faces-config.xml(without this my web project works fine but I plan to use it later for these What is the use of faces-config.xml in JSF 2?
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<lifecycle>
<phase-listener>package.SessionPhaseListener</phase-listener>
</lifecycle>
</application>
</faces-config>
the SessionPhaseListener.java
public class SessionPhaseListener implements PhaseListener, Serializable {
private static final long serialVersionUID = 1L;
#Override
public void afterPhase(PhaseEvent arg0) {
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("CURRENT_TIME", System.currentTimeMillis());
}
#Override
public void beforePhase(PhaseEvent arg0) {
}
#Override
public PhaseId getPhaseId() {
return PhaseId.ANY_PHASE;
}
}
the tutorial stated I need to add the PhaseListener to Ensure the Contents of HttpSession Are Saved
Can anyone point which part of my project causes the error. I really want to use faces-config.xml without having a error. My whole point is, I cannot import css, js and other file with faces-config.xml present in my project. Is there any configuration or information I missed for JSF and GAE setup.
I am a google app engine newbie.
I have an encoding issue with a wicket application in GAE.
(see http://ristorante-lastoria.appspot.com/wicket/home )
My IDE is configured to save the HTML template files in UTF-8.
I ve printed out the default file.encoding used by GAE JVM and it's ASCII.
I 've tried to set the following parameters in the appengine-web.xml.
<system-properties>
<property name="file.encoding" value="UTF-8" />
</system-properties>
<env-variables>
<env-var name="DEFAULT_ENCODING" value="UTF-8" />
<env-var name="APP_ENCODING" value="UTF-8" />
</env-variables>
I ve tried to set the flag --compile-encoding=UTF-8 when uploading the war content to the server.
At the build level(using maven), I tried to escape the unicode characters in the build using the native2ascii tool.
No luck so far :-(
Wicket version: 1.4.17
TIA
Add a xml declaration wirh encoding to all your templates:
<?xml version="1.0" encoding="UTF-8" ?>
I developed a Java web application in Netbeans 6.5 using a MySQL database and Hibernate. Both the development database server and development application server (Tomcat 6) reside on my development machine. Everything works; the application pulls data from the database correctly.
Now, I'm ready to move it to the production server. Again, the DB server and app server are on the same machine. I deploy the WAR file and try to access the application; I can access the static pages but the Servlets that use the database error out with the exception:
org.hibernate.exception.JDBCConnectionException: Cannot open connection
I'm pretty sure the problem relates to Tomcat not knowing about the data source. It seems as if Netbeans handles this for me. I've read that I might need to add a RESOURCE entry so I took some advice from this site which gave me a context.xml of:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/EmployeeDirectory">
<Resource
name="jdbc/employeedirectory" auth="Container"
type="javax.sql.DataSource" username="EmployeeDir"
password="EmployeeDirectory" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/EmployeeDirectory?autoReconnect=true"
maxActive="15" maxIdle="7"
validationQuery="Select 1" />
</Context>
a web.xml of:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Omit Servlet Info -->
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/employeedirectory</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
and a hibernate.cfg.xml of:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/employeedirectory</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Omit other Mappings -->
<mapping class="EmployeeDirectory.data.PhoneNumber" resource="EmployeeDirectory/data/PhoneNumber.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Now, I get a org.hibernate.HibernateException: Could not find datasource error.
Am I on the right path for moving from development to production? What am I missing?
I think you are on the right track. I would first set up the datasource and verify it out side of hibernate. Here is a good article on that: http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.htm and some examples here: http://www.mbaworld.com/docs/jndi-datasource-examples-howto.html
Then, I would configure hibernate to use the datsource. From looking at your hibernate.cfg.xml file I think you should try changing hibernate.connection.datasource to jdbc/employeedirectory
the jndi datasource should be defined in /tomcat/server.xml see Tomcat JNDI Datasource how-to and not in webapp/context.xml
Tomcat 6 requires that you add the resource tag to the context.xml, not the server.xml. You could in Tomcat 5.x. I have it working fine in a separate install of Tomcat, but I'm still trying to use connection pooling inside NB 6.5.
That same Apache site has a link to the Tomcat 6 version of JNDI and it tells you to add the resource tag to the context.xml.