wrong encoding with JSF input - jsf

I use java 6 jsf1.2 and rich faces 3.3.3 on jboss 7 linux.
Everything worked fine on windows + tomcat but when I moved to linux + jboss I got a problem where h:inputText in hebrew would get to the server side as jibrish( ###!# ) instead of the hebrew letters. all of the files are utf-8.
How do I fix this encoding problem?

This needs to be configured in /standalone/configuration/standalone.xml. Add the following piece right after the </extensions>:
<system-properties>
<property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
<property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>
</system-properties>

Related

Deploying Custom theme in production server

I'm working on a Liferay project.
I'm developing a new Liferay theme using Plugins SDK.
I wonder is it better to use ANT or MAVEN for the project?
Because I managed to run both projects in eclipse.
Also is there any way to deploy automatically the theme in the production server ? (Distant server using tomcat).
For now I'm just using auto deployment, copying the war file to the /deploy file.
Regards
You can add remote server to your Eclipse with Plugins SDK, check https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/developing-apps-with-liferay-ide-liferay-portal-6-2-dev-guide-02-en
(this may be helpful for older versions of plugins-sdk)
Assuming that you have ssh access to the remote server, the following ant target can be added and used in /liferay-plugins-sdk/build-common-plugin.xml
<property name="web-server" value="11.11.11.11" />
<property name="web-server-username" value="yourusername" />
<property name="web-server-password" value="yourpassword" />
<property name="web-server-deploy-folder-path" value="/liferay-x.x/deploy" />
<target name="remote-deploy" depends="war">
<echo message="Copying plugin to remote server ..." />
<scp
file="${plugin.file}"
todir="${web-server-username}:${web-server-password}#${web-server}:${web-server-deploy-folder-path}"
trust="true"
/>
<echo message="Done!" />
</target>

How do I enable page compression for Jboss EAP6.2

How can I enable page/gzip compression for JBoss EAP 6.2?
I have found information online for older JBoss AS, but nothing for EAP.
you can do this by:
file : standalone.xml (JBoss AS 7+ )
Position : right after
<extensions>
</extensions>
<system-properties>
<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION" value="on"/>
<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES" value="text/javascript,text/css,text/html,text/xml,text/json"/> <!-- add other content types you want to gzip -->
</system-properties>

Cant Run Java FX Executable Jar or Native Bundle

I have created a java fx application on Netbeans 7.3.1 with fxml,hibernate. It works fine when run in Netbeans and when run the jar file from dist folder. Database operations are just fine. But I want export the app to another system in a portable form. So i created the native bundle using the tools Wix and Inno 5. But the produced app doesnt work in my own syntem or another system. Shows Exception while runnig application. I checked several times by changing the db ip address as localhost, 127.0.0.1 and my my physical ip. but no working.
My java version is Java 7 update 40 (jdk1.7.0_40)
This is the link for the screenshot showing error : http://i.imgur.com/popokhh.jpg
my build.xml contains
<target name="-post-jfx-deploy">
<fx:deploy width="${javafx.run.width}" height="${javafx.run.height}"
nativeBundles="all"
outdir="${basedir}/${dist.dir}" outfile="${application.title}">
<fx:application name="${application.title}" mainClass="${javafx.main.class}"/>
<fx:resources>
<fx:fileset dir="${basedir}/${dist.dir}" includes="*.jar"/>
</fx:resources>
<fx:info title="${application.title}" vendor="${application.vendor}"/>
</fx:deploy>
</target>
And my hibernate cfg file contains
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sample?zeroDateTimeBehavior=convertToNull</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<mapping resource="entity/Sample.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Is there any extra configuration for the application to work independently??
I got it fixed...
All i need to do was include the lib folder in the build... My bad.

JavaFx 2.0 application referencing external jars

I'm developing a JavaFx 2.0 application using Netbeans 7.
The main application references another class library project added by rightclicking the 'Libraries' folder and selecting 'Add Project...'. Executing the application from netbeans works fine.
When deploying it to a jar file by 'Clean and build' and trying to execute it via console with
java -jar TestApp.jar
I get
Exception in thread "JavaFX-Launcher" java.lang.NoClassDefFoundError: net/pmoule/SomeClass
...
The dist/lib folder of my application contains the referenced library. So IMHO everything should be fine. Looking at the Manifest.MF contained in my application jar I get this
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_23-b05 (Sun Microsystems Inc.)
Implementation-Vendor: pmoule
Implementation-Title: TestApp
Implementation-Version: 1.0
Main-Class: com/javafx/main/Main
JavaFX-Application-Class: testapp.TestApp
JavaFX-Version: 2.0
Where is my class path? How do I get Netbeans to add the correct classpath?
I tried adding it manually to the Manifest.MF by editing the one contained in the jar
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_23-b05 (Sun Microsystems Inc.)
Implementation-Vendor: pmoule
Implementation-Title: TestApp
Implementation-Version: 1.0
Class-Path: lib/MyLib.jar //THIS IS NEW
Main-Class: com/javafx/main/Main
JavaFX-Application-Class: testapp.TestApp
JavaFX-Version: 2.0
No success and same error.
All samples delivered with the JavaFX 2.0 SDK work by doubleclicking in WindowsExplorer or from the console by entering e.g.
java -jar PathAnimation.jar
But not any of these examples makes a reference to an external jar.
Some research lead me to this question: Netbeans JavaFX 2.0 Application
But without any solution so far.
Thanks for any help!
Found a working solution by myself.
All the external libraries in the dist/lin folder had a size of 0kb. So the exception was correct, of course.
To get my application running I did the following in the project's jfx-impl.xml:
Add the classpath to manifest.mf
<fxjar destfile="${jfx.deployment.dir}/${jfx.deployment.jar}" applicationClass="${main.class}" >
<fileset dir="${build.classes.dir}"/>
<manifest>
<attribute name="Implementation-Vendor" value="${application.vendor}"/>
<attribute name="Implementation-Title" value="${application.title}"/>
<!-- NEW --> <attribute name="Class-Path" value="${jar.classpath}"/> <!-- NEW -->
<attribute name="Implementation-Version" value="1.0"/>
</manifest>
</fxjar>
Create an output dir for web deployment
<property name="jfx.deployment.web.dir" location="${jfx.deployment.dir}/web" />
<mkdir dir="${jfx.deployment.web.dir}" />
Set output dir for fxdeploy task
<fxdeploy width="${jfx.applet.width}" height="${jfx.applet.height}"
outdir="${jfx.deployment.web.dir}" <!-- NEW DIR -->
embedJNLP="true"
outfile="${application.title}">
<info title="${application.title}"
vendor="${application.vendor}"/>
<application name="${application.title}"
appclass="${main.class}"/>
<resources type="eager">
<fileset dir="${jfx.deployment.web.dir}"> <!-- NEW DIR -->
<include name="${jfx.deployment.jar}"/>
<include name="lib/*.jar"/>
<exclude name="**/jfxrt.jar"/>
</fileset>
</resources>
</fxdeploy>
Now, I can deploy my desktop application and execute ist via doubleclick from windows explorer or by entering
java -jar TestApp.jar
There still exists some issue with the content of my newly created web-dir.
The TestApp.jar ist not copied zo dist/web
The referenced external jars are not copied to dist/web
This is fine for me and will be fixed some time later.
Hope this helps anyone else.
In Netbeans, under project => properties => Build => Packaging, did you check "Copy Dependent Libraries" ?
You need to tell the fx:jar task what your classpath dependencies are:
<fxjar destfile="${jfx.deployment.dir}/${jfx.deployment.jar}" applicationClass="${main.class}" >
<fileset dir="${build.classes.dir}"/>
<manifest>
<attribute name="Implementation-Vendor" value="${application.vendor}"/>
<attribute name="Implementation-Title" value="${application.title}"/>
<attribute name="Implementation-Version" value="1.0"/>
</manifest>
<!-- Setup the classpath for the generated .jar here -->
<fx:resources>
<fx:fileset type="jar" dir="lib" includes="MyLib.jar"/>
</fx:resources>
</fxjar>
You also need to use fx:resources tag in your fx:deploy task instead of just resources. That should resolve the last two problems left in your answer.

Running JWS remotely on 64-bit machine

The problem is that my JNLP file works locally on my 64-bit machine (running on my own machine), and locally and remotely on my 32-bit machine - but not remotely on the 64-bit machine (you see the Java 6... message for a looong time, and then it just terminates!). Any suggestions about how to trouble-shoot this? Should I specify different libraries for 64-bit and 32-bit? FWIW the jnlp file looks like this (maybe quite wrong!):
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+"
codebase="http://www.jpaulmorrison.com/graphicsstuff/">
<information>
<title>DrawFBP</title>
<vendor>J.P. Morrison Enterprises, Ltd.</vendor>
<description>FBP Diagramming Tool</description>
<icon href="DrawFBP-logo.jpg"/>
</information>
<security>
<all-permissions/>
</security>
<offline-allowed/>
<resources>
<j2se version="1.6+"/>
<j2se version="1.5"/>
<jar href="DrawFBP_signed-2.3.jar" main="true"/>
<extension name="javahelp" href="javahelp.jnlp">
</extension>
</resources>
<application-desc/>
</jnlp>
and javahelp.jnlp is as follows:
<!-- Java Network Launching Protocol file for JavaHelp
(requires Java Web Start http://www.java.com/) - thanks to www.koders.com -->
<jnlp codebase="https://jwindows.dev.java.net/" href="javahelp.jnlp" spec="1.0+">
<information>
<title>Java Help</title>
<vendor>Sun Microsystems</vendor>
<homepage href="http://java.sun.com/products/javahelp/"/>
<description>Java Help 2.0</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+"/>
<jar href="lib/jhall.jar" part="javahelp"/>
<package name="javax.help" part="javahelp" recursive="true"/>
</resources>
<component-desc/>
</jnlp>
TIA
Turns out you have to install both the 32-bit version of Java and the 64-bit version. Very confusing, but apparently Java can figure out which to use! It would be nice (but not essential) if someone could tell me why this works...?
PS I posted this to the Oracle forum, and nobody answered it either :-) I will post this answer there too.

Resources