Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Mixing Signed and Unsigned Code explains a warning dialog that is raised Starting with Java SE 6 Update 19, a new warning dialog is displayed when a program contains both signed and unsigned components in Java SE 6 Update 19 release (or later). (see Mixing Signed and Unsigned Code for more detail)  Even when all the client side jars are signed, you might users may still see this dialog when running nexaweb Nexaweb applications . This is because of the way nexaweb Nexaweb plugin jars are packaged and used. To prevent this the dialog, you need to unpack, rearrange, re-pack and then sign the plugin jars.

Here are the steps -:

  1. Explode Unjar the plugin jar file
    For eg. PluginDataFramework.jar, you this will getcreate:

       plugin.xml (Keep keep this)
       PLUGIN-INF (Keep keep this)
       lib - PluginDataFramework-classes.jar (keep this), ognl-2.6.7.jar (Delete this. Not delete this - it is not required as it is already in your NexawebClient.jar)

  2. Repackage inner classes jar files in the lib folder

    a. Unjar inner classes jarfiles

              For eg. PluginDataFramework-classes.jar, you will get:

         META     META-INF (delete this)
         com   com\nexaweb\plugin\data directory structure with classes

    b. Create a folder, nxPlugin-<plugin class name> inside the exploded folder

         For eg. PluginDataFramework-classes, you will have:

         com    com\nexaweb\plugin\data directory structure with classes
         nxplugin    nxplugin-PluginDataFramework folder

    c. Move plugin.xml to the nxPlugin-<plugin class name> folder

    d. jar plugin classes into plugin classes jar file
         For eg.      Following the example: PluginDataFramework-classes.jar

    e. Sign the inner plugin classes jar files

    f. Remove exploded folder

  3. If <ui-test> is set to true in nexaweb-client.xml, it uses the debug/plugin classes-debug jar files . You need to repeat same process as with plugin classes jar fileswill be used. Repeat the process above for the debug versions of the jar files..
  4. Jar the main plugin folder.
  5. Create a pre-loaded folder inside in WebContent/WEB-INF/client/plugins
  6. Copy the repackaged jar files into the pre-loaded folder and delete the jars from plugins
  7. Add tag mapping for plugin.xml in your nexaweb-client.xml.
    For eg.:

    Code Block
    titlenexaweb-client.xml
    <client-tag-mapping>
    	<tag-map-file>classpath://nxplugin-PluginDataFramework/plugin.xml</tag-map-file>
    </client-tag-mapping>

     

    Here is a sample

    ANT

    ant task to rearrange and sign

    nexaweb

    Nexaweb plugins jars

    Code Block
    titleRepackage Plugin jars
    <project default="repackagePluginJars" basedir=".">
        <property name="plugin.build.dir" value="PluginTempDir"/>
        <property name="plugin.dest.dir" value="${build.webcontent.dir}/WEB-INF/client/plugins/pre-loaded"/>
        <property name="plugin.src.dir" value="${build.webcontent.dir}/WEB-INF/client/plugins"/>
        
        <macrodef name="repackagePlugin" description="Repackages the given plugin jar from Nexaweb into a new jar that can be signed.">
            <attribute name="plugin"/>
            <sequential>
                <tempfile property="plugin.build.dir" deleteonexit="true" createfile="false"/>
                <mkdir dir="${plugin.build.dir}" />
                <delete includeemptydirs="true">
                    <!-- clean up the temp directory that might have files from the last run -->
                    <fileset dir="${plugin.build.dir}" includes="**/*" />
                </delete>
            	
                <!--unjar main plugin jar file -->
                <unjar src="${plugin.src.dir}/@{plugin}.jar" dest="${plugin.build.dir}" />
                
            	<!--- repackage classes jar files  -->
                <repackage-classes plugin="@{plugin}" location="${plugin.build.dir}/lib" classname="@{plugin}-classes"/>
                
            	<!-- created pre-loaded folder inside plugins -->
                <mkdir dir="${plugin.dest.dir}" />
                
            	<!--jar up and store jar files in pre-loaded  folder -->
                <jar destfile="${plugin.dest.dir}/@{plugin}.jar" basedir="${plugin.build.dir}"/>
                
            </sequential>
        </macrodef>
        
        <macrodef name="repackage-classes">
            <attribute name="plugin"/>
            <attribute name="location"/>
            <attribute name="classname"/>
            <sequential>
                <mkdir dir="@{location}/@{classname}" />
                
            	<!-- unjar inner classes jar file-->
                <unjar src="@{location}/@{classname}.jar" dest="@{location}/@{classname}"/>
                
            	<!--delete -classes.jar , ognl.jar files in lib -->
                <delete>
                    <fileset dir="@{location}/" >
                        <include name="**/*.jar"/>
                    </fileset>
                </delete>
                
                <!-- move plugin file to plugin-key folder -->
                <move file="${plugin.build.dir}/plugin.xml" todir="@{location}/@{classname}/nxplugin-@{plugin}" />
                
                <!-- jar up inner classes files -->
                <jar destfile="@{location}/@{classname}.jar" basedir="@{location}/@{classname}">
                    <patternset>
                        <exclude name="**/META-INF/**" />
                        <exclude name="**/*.jar" />
                    </patternset>
                </jar>
                
            	<!--delete exploded folder  -->
                <delete dir="@{location}/@{classname}"/>
                
                <!-- sign inner classes jar file -->
                <signjar alias="${keystore.alias}" keystore="${keystore.file}" storepass="${keystore.password}" lazy="true">
                    <path>
                        <fileset dir="@{location}" includes="**/*.jar" />
                    </path>
                </signjar>
            </sequential>
        </macrodef>
        	
        <macrodef name="delete-files-from-plugin">
            <sequential>
                <delete>
                    <fileset dir="${plugin.src.dir}">
                        <exclude name="**/pre-loaded/**" />
                    </fileset>
                </delete>
            </sequential>
        </macrodef>
        
        <target name="repackagePluginJars" description="Repackages the Nexaweb plugin jars so they can be signed properly" >
            <repackagePlugin plugin="PluginDataFramework"/>
            <repackagePlugin plugin="PluginDataRequest"/>	
            <delete-files-from-plugin/>	     	
        </target>
    </project>
    
    

...