Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

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

Here are the steps -

  1. Explode plugin jar file

    For eg. PluginDataFramework.jar, you will get:
    plugin.xml (Keep this)
    PLUGIN-INF (Keep this)
    lib - PluginDataFramework-classes.jar, ognl-2.6.7.jar (Delete this. Not required as it is already in your NexawebClient.jar)

  2. Repackage inner classes jar files in lib folder

    a. Unjar inner classes jarfiles

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

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

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

         For eg. PluginDataFramework-classes will have

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

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

    d. jar plugin classes into plugin classes jar file
         For eg. PluginDataFramework-classes.jar

    e. Sign inner plugin classes jar files

    f. Remove exploded folder

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

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

     


    Here is a sample ANT task to rearrange and sign nexaweb plugins jars
    Repackage 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>
    
    

 

  • No labels