做openfire安裝包時出現的問題

1. 程序包org.jivesoftware.smack不存在

解決:

(1)在本地使用eclipse或其他工具打包,上傳至服務器正常
(2)在使用ANT更新後 自動編譯時 出錯
導致原因是:jar缺失 (在本地使用myeclipse或其他工具打包,上傳至服務器正常,一部分引用包,直接通過開發工具與項目建立聯繫,可以一起打壓入包 ;而你直接使用SVN或其他工具下載到服務端的代碼,並不能建立此鏈接,故 包缺失);
應該是打包時缺失smack包,這個包存在於Referenced Libraries中,拷貝,粘貼到build下的lib中,並添加就ok了


2.錯誤: 程序包org.junit不存在  [javac] import org.junit.After;

解決辦法,junit是測試代碼,可以不要,之間註釋掉就行了


3.Adding JRE (linux-x86-1.6.0_18)
[install4j] install4j: compilation failed. Reason: java.io.FileNotFoundException: Could not find JRE bundle. Neither C:\progrom\install4j\jres\linux-x86-1.6.0_18.tar.gz nor C:\Users\MyPC\.install4j5\jres\linux-x86-1.6.0_18.tar.gz nor E:\workspace\openfire_src\build\installer\linux-x86-1.6.0_18.tar.gz exist.

百度 只能搜到windows-x86-1.6.0_18.tar.gz 沒有linux-x86-1.6.0_18.tar.gz ,這時可以把windows-x86-1.6.0_18.tar.gz 修改爲linux-x86-1.6.0_18.tar.gz 然後粘貼到相應目錄即可


4.

openfire安裝成功後打開openfire出現問題

java.lang.UnsupportedClassVersionError:org/jivesoftware/openfire/launcher/Launcher : Unsupported major.minor version51.0

解決思路:因爲很多linux系統還不支持jdk1.7,所以要儘量避免使用jdk1.7開發程序,我將win7下的jdk重裝爲jdk1.6,然後將項目的javacompiler改爲jdk1.6,對項目進行重新編譯問題就解決了。

修改項目javacompiler的方法:在項目點右鍵->選擇Perperties->在出現的菜單中選擇JavaCompiler->最上面選中Enableproject Specific setting->然後將jdk改爲jdk1.6->完成。

       同時把build.xml中的jdk版本也改爲1.6

這時會出現另外一個問題

  HTTPERROR 500

Problem accessing /index.jsp. Reason:

   java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;

Caused by:

java.lang.NoSuchMethodError:java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;

  atorg.jivesoftware.util.ConcurrentHashSet.iterator(ConcurrentHashSet.java:90)

據說也是版本問題引起的,ConcurrentHashMap$KeySetView類的方法等是1.7以上才被支持,而編譯的是1.6版本的,但是用1.7以上版本卻又報出51.0的錯誤

這兩個問題成了一個死循環,如果不改變ConcurrentHashMap$KeySetView類的用法就要找到build.xmljdk1.6以上版本installer不能編譯通過的原因,大家討論一下原因是什麼?

下面是build.xml中關於jdk版本的設置

 <!-- compile =============================================================================== -->
    <target name="compile" depends="init" description="Compiles Openfire app code">
        <mkdir dir="${compile.dir}"/>
	 <javac
                destdir="${compile.dir}"
                includeAntRuntime="no"
                debug="on"
                source="1.6"
                target="1.7"
                >
            <src path="${src.java.dir}"/>
            <patternset refid="compile.sources"/>
            <classpath>
                <path refid="compile.dependencies"/>
            </classpath>
        </javac>
		
		
	  <javac
		destdir="${overlay.compile.dir}"
		includeAntRuntime="no"
		debug="on"
		source="1.6"
		target="1.7"
		>
		<src path="${overlay.src.dir}"/>
		<patternset refid="compile.sources"/>
		<classpath>
			<path refid="compile.dependencies"/>
		<span style="white-space:pre">	</span><path location="${compile.dir}"/>
		</classpath>
	</javac>
				
				
	<!-- Compile java source -->
        <javac
                destdir="${jspc.classes.dest.dir}"
                includeAntRuntime="no"
                debug="on"
                source="1.6"
                target="1.7"
                includes="org/jivesoftware/openfire/admin/**/*.java"
                >
            <src path="${jspc.java.dest.dir}"/>
            <classpath>
                <pathelement path="${compile.dir}"/>
                <path refid="jspc.dependencies"/>
            </classpath>
        </javac>
	
	 <!-- Compile all test code -->
        <mkdir dir="${test.classes.dest.dir}"/>
        <javac
                destdir="${test.classes.dest.dir}"
                includeAntRuntime="no"
                debug="on"
                source="1.6"
                target="1.7"
                >
            <src path="${src.test.java.dir}"/>
            <patternset refid="test.sources"/>
            <classpath>
                <path refid="test.dependencies"/>
                <pathelement path="${compile.dir}"/>
            </classpath>
        </javac>
		
	 <!-- Compile plugin source code -->
	<mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/classes"/>
	<javac
		destdir="${plugin.dev.dest.dir}/@{plugin}/target/classes"
		includeAntRuntime="no"
		debug="on"
		source="1.6"
		target="1.7"
		>
	<span style="white-space:pre">	</span><src path="@{pluginsrc}/@{plugin}/src/java"/>
		<classpath>
		<path refid="plugin.dependencies"/>
		<!-- Jars used by the plugin to compile with -->
			<fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
		</classpath>
	</javac>
			
	 <javac
		destdir="@{pluginlib}/classes"
		includeAntRuntime="no"
		debug="on"
		source="1.6"
		includes="**/*.java"
	>
		<src path="@{pluginlib}/source"/>
		<classpath>
			<pathelement location="${plugin.dev.dest.dir}/@{plugin}/target/classes"/>
			<path>
				<path refid="plugin.dependencies"/>
				<!-- Jars used by the plugin to compile with -->
				<fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
			</path>
		</classpath>
	</javac>
	
	<!-- Compile java classes -->
	<javac
		destdir="${plugin.dev.dest.dir}/@{plugin}/target/jspc/classes"
		includeAntRuntime="no"
		debug="on"
		source="1.6"
		target="1.7"
		>
		<src path="${plugin.dev.dest.dir}/@{plugin}/target/jspc/java"/>
		<classpath>
			<path refid="jspc.dependencies"/>
			<pathelement path="${compile.dir}"/>
			<fileset dir="${plugin.dev.dest.dir}/@{plugin}/target" includes="lib/*.jar"/>
		</classpath>
	</javac>
	
	 <!-- anttasks ============================================================================== -->
    <target name="anttasks" depends="init">

        <mkdir dir="${anttools.target.dir}"/>
        <mkdir dir="${anttools.target.dir}/classes"/>

        <javac
                destdir="${anttools.target.dir}/classes"
                includeAntRuntime="no"
                debug="on"
                source="1.6"
                >
            <src path="${anttools.src.dir}"/>
            <patternset refid="compile.sources"/>
            <classpath>
                <path refid="compile.dependencies"/>
            </classpath>
        </javac>
	



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章