Wicket encoding issue on Google App Engine - google-app-engine

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" ?>

Related

Ubuntu upgrade (14.04.3) and solr upgrade (5.3) breaks solr3/jetty setup

While upgrading our production server to ubuntu 14 the solr/jetty broke.
To fix i tried:
- upgraded java version to 8.
- upgraded solr to 5.3
My earlier config used .war files. realized that now its stopped supporting .war files, so now cannot use my earlier config.
This was the steps i used earlier:
copy the solr.war file from the downloaded and untarred solr to the webapps folder, and make jetty owner:
sudo cp ~/x/apache-solr-3.6.1/dist/apache-solr-3.6.1.war /usr/share/jetty/webapps/solr.war
sudo chown jetty:jetty /usr/share/jetty/webapps/solr.war
create a context file in JETTY_HOME/contexts (sudo vim /usr/share/jetty/contexts/solr.xml)
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- Set the solr.solr.home system property -->
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Call name="setProperty" class="java.lang.System">
<Arg type="String">solr.solr.home</Arg>
<Arg type="String">/usr/share/solr</Arg>
</Call>
</Configure>
tell solr how many cores we have and what those are in SOLR_HOME (sudo vim /usr/share/solr/solr.xml):
<solr persistent="true" sharedLib="lib">
<cores adminPath="/admin/cores">
<core name="demo" instanceDir="demo" />
<core name="dev" instanceDir="dev" />
<core name="qa" instanceDir="qa" />
<core name="www" instanceDir="www" />
</cores>
</solr>
etc.
Don't want to use the solr instance that comes with rsolr (4), if i can help it. But can't find corresponding info for solr 5.3
Running rails 3.2.21. and solr_sunspot gem 2.2.0
Thanks in advance!

Getting "missing core name in path" when trying to access Solr admin installed on Glassfish

I've installed Solr 3.1 on Glassfish, and that part passed smoothly, as when I visit<host>:<port>/solr, I get that "Welcome to Solr!" page, along with "Solr Admin" link.
Problems start when I try to opet admin panel, I get "HTTP Status 404 - missing core name in path". I have no clue why is that happening. Previously, I've been testing that default Solr example (single core) at localhost, but using Jetty, shipped with Solr release in form of that start.jar.
I've set system property solr.solr.home to point to the folder where solr.xml and conf folder is located, and here's the content of mentioned solr.xml:
<solr persistent="false"
<cores adminPath="/admin/cores" defaultCoreName="collection1">
<core name="collection1" instanceDir="." />
</cores>
</solr>
As you can see, just simple single core setup.
Any idea?
Thanks in advance
<solr persistent="false"
<cores adminPath="/admin/cores" defaultCoreName="collection1">
<core name="collection1" instanceDir="collection1" />
</cores>
</solr>
and a directory structure of:
collection1 (containing dirs, conf and data)
solr.xml
is the proper way to do it.

How can I place multiple project dlls in the same Assembly Cache zip for Silverlight?

I'm using the very helpful MvvmLight toolkit and want to package both dlls into a single zip with Assembly Caching turned on. I tried to set the for both the main and the Extras.dll, but the app can no find the Extras dll in the zip. Is this possible to do with Silverlight?
EDIT: I'm using Assembly Caching so that the toolkit (and other dlls) are not in the XAP. Then the user will only need to download these one time, instead of once for every Silverlight app. We have a ASP.NET app with several different pages exposing different Silverlight apps.
I've found that I can use the same zip file in each extmap file now. I'm not sure if I did it wrong before or what...
<?xml version="1.0"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<assembly>
<name>GalaSoft.MvvmLight.Extras.SL4</name>
<version>3.0.0.30106</version>
<publickeytoken>918f02b0f4b4b116</publickeytoken>
<relpath>GalaSoft.MvvmLight.SL4.Extras.dll</relpath>
<extension downloadUri="GalaSoft.MvvmLight.SL4.zip" />
</assembly>
</manifest>
<?xml version="1.0"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<assembly>
<name>GalaSoft.MvvmLight.SL4</name>
<version>3.0.0.30106</version>
<publickeytoken>918f02b0f4b4b116</publickeytoken>
<relpath>GalaSoft.MvvmLight.SL4.dll</relpath>
<extension downloadUri="GalaSoft.MvvmLight.SL4.zip" />
</assembly>
</manifest>

Using Lift 2.1 on Google App Engine with Scala 2.8

I'm trying to use Lift 2.1-SNAPSHOT on Google App Engine but the lift snippets in the HTML are not being processed. It simply returns the HTML file.
This is the lift.html file (just a simple test):
<lift:surround with="default" at="content">
Welcome to your Lift application
</lift:surround>
The web.xml has:
<filter>
<filter-name>LiftFilter</filter-name>
<display-name>Lift Filter</display-name>
<description>The Filter that intercepts lift calls</description>
<filter-class>net.liftweb.http.LiftFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LiftFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
The appengine-web.xml contains:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>kivanotify</application>
<version>6</version>
<static-files/>
<resource-files/>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/classes/logging.properties"/>
<property name="in.gae.j" value="true" />
</system-properties>
<sessions-enabled>true</sessions-enabled>
<static-files>
<exclude path="/static/**" />
</static-files>
</appengine-web-app>
When running the project using " /opt/appengine-java-sdk-1.3.6/bin/dev_appserver.sh target/kivanotify" and accessing the url http://localhost:8080/lift.html is simple returns the lift.html as is without processing the tags.
Any idea why the tags are not being processed? There is no logging that hints at a problem.
Regards,
Gero
I remember you need the following setting in appengine-web-app.xml.
<static-files>
<exclude path="/**" />
</static-files>
BTW, I found stax.net is much Lift-friendly then GAE.

From Netbeans Dev to Tomcat Production: DB Connection Not Found

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.

Resources