X-Smiles FAQ
Running X-Smiles
Compiling X-Smiles
Content-type and Rendering issues
Security issues
Running X-Smiles
R1. Images in the toolbar, below the menus, are not visible
This is probable due running X-Smiles from somewhere else than where it was installed. The images used in the toolbar are found in the 'img' directory under the installation dir.
(Windows) Check xsmiles.bat, it should contain the following lines:
cd c:\xsmiles
c:
Change them to suit your installation directory.
R2. Starting X-Smiles produced the following error:
ERROR: java.lang.IllegalArgumentException: No attributes are implemented
JDK 1.2-1.3: This is a classpath problem regarding xerces.jar. Usually this happens when you have a different parser in the classpath before xerces.jar, or you have an older version of xerces.jar in the classpath.
-> remove jaxp.jar ja older xerces.jar from your classpath and try again. You may also have these jars in the java installation directory, and you should remove them.
JDK 1.4: This version ships with org.apache.crimson.jaxp.DocumentBuilderFactoryImpl, but X-Smiles needs org.apache.xerces.jaxp.DocumentBuilderFactoryImpl, so the easiest thing to do is to run X-Smiles with the following command line (this should be fixed in a future version of X-Smiles):
java
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -jar xsmiles.jar"
FULL ERROR MESSAGE:
ERROR: java.lang.IllegalArgumentException: No attributes are implemented
java.lang.IllegalArgumentException: No attributes are implemented
at org.apache.crimson.jaxp.DocumentBuilderFactoryImpl.setAttribute(DocumentBuilderFactoryImpl.java:93)
at fi.hut.tml.xsmiles.xml.JaxpXMLParser.openDocument(JaxpXMLParser.java: 114)
at fi.hut.tml.xsmiles.xml.JaxpXMLParser.openDocument(JaxpXMLParser.java: 79)
at fi.hut.tml.xsmiles.XMLConfigurer.readConfig(XMLConfigurer.java:222)
at fi.hut.tml.xsmiles.XMLConfigurer.<init>(XMLConfigurer.java:142)
at fi.hut.tml.xsmiles.Browser.<init>(Browser.java:156)
at fi.hut.tml.xsmiles.Xsmiles.main(Xsmiles.java:115)
R4. Running XML Signature produces the following error:
[Debug] c:\source\xsmiles\bin\cfg\defaultkey.jks
java.lang.VerifyError: (class: org/bouncycastle/jce/provider/JDKDSASigner, method: derDecode signature: ([B)[Ljava/math/BigInteger;) Incompatible object argument for function call
at java.lang.Class.getDeclaredConstructors0(Native Method)
This is because some overlapping classes in jxtamlfc and signaturemlfc. Current workaround: remove jxtamlfc.jar from bin/extensions when using signature.jar. (MH 18-Nov-02).
R4. Starting X-Smiles 0.5 or earlier first under JDK1.4 messes up the configuration file, after which, X-Smiles cannot be run, even on JDK 1.3. Bug is fixed since 0.6.
From a mail from Jukka Santala:
On Thu, 21 Feb 2002 thomas.nagel@materna.de wrote:
> i'm trying to use xsmiles 0.5 with the new JDK 1.4.0 Release Candidate 1,
> but it throws Null Pointers.
> I already used the Switch from the FAQ
> "-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentB
> uilderFactoryImpl"
> but it does not help.
If you start Xsmiles without the -D flag under JDK 1.4.0, it appears to
garble the cfg/config.xml file, which in turn leads to Xsmiles failing to
locate many important resources.
The solution is to re-extract config.xml from the original package, and
always run Xsmiles with the -D switch under JDK1.4.
Besides of that, Xsmiles 0.5 is not really supported under JDK1.4; there
are incompatibilities with some API that prevents use of CSS and SVG.
These have been fixed in the SVN version, so you either have to build and
run that, or wait for next release if you want to use those features under
JDK1.4.
Also, I think final release of JDK 1.4.0 is now out for all platforms, and
the pre-release versions have been giving some trouble with Xsmiles, so I
would recommend using the newest available version if you want to go 1.4.
Ps. Building Xsmiles should work fine if you have JMF in your CLASSPATH as
recommended for JMF install, set JAVA_HOME to the base path of your JDK
install (The path element with the JDK version) and use the src/build.sh
or src/build.bat scripts depending on architecture to launch the
build-tool.
-Jukka Santala
FULL ERROR MESSAGE
-*-=XSmiles ver 0.5 starting=-*-
Java version: 1.3.1
Current dir: E:\xsmiles\bin
[Debug] Browser Initializing...
...
[Debug] XSMilesUI.documentRequired
[Debug] XACombo.setText() : http://www.xsmiles.org/demo/demos.xml
[Debug] Adding http://www.xsmiles.org/demo/demos.xml
java.lang.NullPointerException
java.lang.NullPointerException
at fi.hut.tml.xsmiles.Xsmiles.setMLFCMappings(Xsmiles.java:152)
at fi.hut.tml.xsmiles.Browser.<init>(Browser.java:179)
at fi.hut.tml.xsmiles.Xsmiles.main(Xsmiles.java:126)
[Debug] *** New thread started, and retrieving a new document
-*-=XSmiles ver 0.5 starting=-*-
Java version: 1.4.0
Current dir: E:\xsmiles\bin
[Debug] Browser Initializing...
[Debug] *** PARSER: 'null'
ERROR: java.lang.IllegalArgumentException: No attributes are implemented
java.lang.IllegalArgumentException: No attributes are implemented
at org.apache.crimson.jaxp.DocumentBuilderFactoryImpl.setAttribute(DocumentBuilderFactoryImpl.java:93)
at fi.hut.tml.xsmiles.xml.JaxpXMLParser.openDocument(JaxpXMLParser.java:129)
at fi.hut.tml.xsmiles.xml.JaxpXMLParser.openDocument(JaxpXMLParser.java:78)
at fi.hut.tml.xsmiles.XMLConfigurer.readConfig(XMLConfigurer.java:215)
at fi.hut.tml.xsmiles.XMLConfigurer.<init>(XMLConfigurer.java:78)
at fi.hut.tml.xsmiles.Browser.<init>(Browser.java:148)
at fi.hut.tml.xsmiles.Xsmiles.main(Xsmiles.java:126)
ERROR: java.lang.IllegalArgumentException: No attributes are implemented
...
Compiling X-Smiles
How do I compile, debug and modify X-Smiles using Eclipse.org
Cause:
You want to modify X-Smiles to your purposes.
Solution:
- Download and install JDK 5.0 from http://java.sun.com/
- Download and install JMF from http://java.sun.com/products/java-media/jmf/
- Download latest Eclipse milestone (e.g. 3.1M4) from http://www.eclipse.org.
- Install Eclipse.
- Start Eclipse. Create the Workspace directory to your home dir and not to eclipse installation dir. Go to workbench.
- Set up cvs.tml.hut.fi SVN .
-
- Window -> Perspective -> SVN repository
- Add SVN repository
- Host: cvs.tml.hut.fi
- Repository path: /cvs
- User: anonymous or your SVN user
- Passwd: anonymous or your SVN passwd
- Connection type: ext or extssh
-
- The "ext" connection method can be configured on the Team/SVN/EXT Connection Method preference page<>
- Pull X-Smiles project from SVN:
-
- Open HEAD, go to "xsmiles"
- Right-click and select: Check out as...
- select "Check out as a new project configured using the new project wizard"
- select "HEAD"
- select "JAva project"
- Project name: xsmiles
- select "Create separate source and output folders"
- Click "Finish", the project will be pulled from the SVN
- Configure/compile project
-
- After x-smiles has been downloaded from the SVN, open the java perspective
- right click xsmiles, and select "Properties"
- Source tab - add the xsmiles/src/xsmiles dir as a source dir
- Source tab - select output folder to be xsmiles/build
- Libraries - add all jar's from xsmiles/bin/lib and xsmiles/bin/lib/endorsed
- Order tab: set xerces.jar, xml-apis.jar and xalan.jar on top, before the JDK classes
- Click "ok" and eclipse will start building x-smiles
- If you get errors about javax.media., open Properties again and add jmf.jar from your jmf installation to "Libraries" tab
- Run X-Smiles
-
- Create a new run profile
- Select fi.hut.tml.xsmiles.gui.gui2.swing.KickStartSwing as the main class
- select xsmiles/bin as the working directory
- set VM option: "-Djava.endorsed.dirs=lib/endorsed "
- Run X-SMiles
(Eclipse Instructions written by Mikko Honkala)
How do I compile and run the J2ME Personal Profile version of X-Smiles?
Cause:
X-Smiles needs to be compiled with a different build target using the build script for J2ME Personal Profile.
Solution:
- First, you need to download and unpack or install the SUN Personal Profile Reference implementation.
- Ackquire the X-Smiles SVN version using the instructions in the SVN access page. Also downloading both the binary and source distibutions and unpacking them to the same dir should suffice.
- Try to comple X-Smiles using the instructions in the compiling page. (Basically "cd {xsmiles}/src ; sh build.sh clean compile-debug" )
- If the previous step worked, try to compile the personal profile version by:
"cd {xsmiles}src; sh build.sh clean jar-personaljava"
- in {xsmiles}/dist/bin there should now be a directory called personaljava. Change to that dir. There is all the jars needed to run the personal java version.
- Change the path to the J2ME virtual machine (cvm) in runxsmiles shell script
or type "export PATH=$PATH:/PATH_TO_MY_INSTALLATION/j2me-pp1.0/bin/"
- type "sh runxsmiles"
How do I compile and run the XINE players version of X-Smiles?
Checkout the xsmiles-jmfxine module from SVN and follow the instructions in README. Remember to add the created java classes to the CLASSPATH before running X-Smiles.
Compiling/Running gives errors on SVG DOM classes
Cause:
XSLFO uses different version of SVG DOM classes than org.csiro packages.
Solution:
This is solved with the following classpath order: xerces.jar;svg.jar;w3c.jar;xalan.jar;...
Old: Compile the XSLFOMLFC using classpath without the svg.jar and org.csiro.* classes using classpath with the svg.jar.
Other option is to compile X-Smiles using JDK 1.3 or Jikes.
Compiling X-Smiles from scratch with the Jikes 1.2
Cause:
Jikes fails on '
import xxx.*' when it has not compiled a class in 'xxx' and it is referred to in another .java file.
Solution:
The work has started to reduce import xxx.* from the classes.
The workaround now (with the latest SVN version) is to compile everything 3 times with jikes.
Compiling X-Smiles with JDK 1.3 does not produce any class files
Cause:
JDK 1.3 does not produce any class files if it encounters an error in any of the java files.
Solution:
Remove java files that are producing errors from the build
Compiling produces the following error (or similar) :
DocuverseXMLParser.java:112
: class com.docuverse.dom.DOM is an abstract class. It can't be instantiated.
dom = new com.docuverse.dom.DOM();
Cause:
This is a classpath ordering error.
Solution:
TBD.
Can I use the latest version of Xalan and Xerces? :
No you cannot. You should use the versions that we distribute. Note that xalan.jar and xml-apis.jar have to be in the endorsed directory. (See
this link for more information).
<>
Cause:
We are using special DOM Level 3 functionality (PSVI in XForms, DOMWriters), which needs a specially build xerces. Additionally, we need to be jdk 1.1. compliant and Xerces 2.6.0 needs jdk>=1.2. Also, in XForms we are using special XPath functionality, which is dependent of the version of Xalan.
Solution:
Use the versions that we provide.
Embedding X-Smiles
Using X-Smiles in a Java project inside a Container.
Cause:
Often, it would be nice to use X-Smiles inside your project GUI.
Solution:
Check out fi.hut.tml.xsmiles.gui.gui2.KickStart class. It shows a simple way to instantiate the browser. It uses either the simple AWT GUI or the Swing GUI that is extended from the AWT GUI. You can also extend the AWT GUI or create one from scratch.
Remember that you probably need the files in bin/lib and bin/cfg to run the browser properly. They should be in the working directory.
Content-type issues
X-Smiles does not render content, only displays the file in text
Cause:
X-Smiles uses the content-type received from the web server to identify content. Many web servers, including apache give
Content-type: text/plain
for all unidentified files. Files loaded from the hard disk are identified based on the end of the filename, they are not effected
Solution:
Configure your web server to send correct Content-types. E.g., in apache this is fixed by adding a
.htaccess
file to your directory. The content-type definitions affect the subdirectories recursively. X-Smiles recognizes
application/xml
types of files.
An example of the .htaccess file:
AddType application/xml .fo
AddType application/smil .smil
AddType application/xml .svg
AddType application/xml .xfm
AddType application/xml .jax
AddType application/xml .x3d
AddType application/xml .xhtml
Check out fi.hut.tml.xsmiles.gui.gui2.KickStart class. It shows a simple way to instantiate the browser. It uses either the simple AWT GUI or the Swing GUI that is extended from the AWT GUI. You can also extend the AWT GUI or create one from scratch.
Remember that you probably need the files in bin/lib and bin/cfg to run the browser properly. They should be in the working directory.
Security in X-Smiles
Question:
What kind of security features X-Smiles has?
Answer:
The security features in X-Smiles are currently not perfect, but some work on that area has been done after 0.91 release. JavaScript can access the extended DOM, which may be exploited by a malicious script.
Here's a short list of what's working and what is not:
- General Security Policy
-
- There is a xsmiles.policy file, which sets different security policies to different jars in the project, for instance, it does not allow js.jar to write to disk.
- Scripts
-
- Scripts are run in a separate security sandbox defined in: ScriptSecurityZone, RhinoScripter, and XSmilesWrapFactory
- Scripts are not allowed to create any java classes directly. This is imposed by the class fi.hut.tml.xsmiles.ecma.rhino.RhinoScripter, which implements ClassShutter and blocks creation of any Java class
- Scripts can traverse the DOM tree and access few objects, such as window and document. The class XSmilesWrapFactory takes care of not giving access to other classes. If you need your class to be accessible you need to implement the AccessibleToScripts interface. Make sure that there are no dangerous methods in your DOM classes.
- TODO: Scripts should only be able to access certain methods in the objects that are exposed (e.g. the DOM tree in document)
-
- This is not so dangerous anymore, because of the two previous security fixes.
- Applets
-
- Applets are run in a separate security sandbox defined in: AppletClassLoader
-
- XForms
-
- If the form tries to save to local disk, the user has to authorize the request
- TODO: do not allow to read from different scheme (especially file:) when http: is used
-
- Currently it is possible to read an xml file from the users local drive as an instance and submit it to the server
Question:
I get an security exception when trying to run x-smiles in a development environment?
Answer:
You should be running your classfiles from "build/". If you compile them to a different directory, you must set a system property "app.dev.base" to e.g. "classes/". This is because the policy file sets properties based on the directory.
Copyright (c) 2000-2008 X-Smiles.org et.al.