随笔 - 117  文章 - 72  trackbacks - 0

声明:原创作品(标有[原]字样)转载时请注明出处,谢谢。

常用链接

常用设置
常用软件
常用命令
 

订阅

订阅

留言簿(7)

随笔分类(130)

随笔档案(123)

搜索

  •  

积分与排名

  • 积分 - 154450
  • 排名 - 389

最新评论

[标题]:[转]Unable to add JBoss 5.0 as server
[时间]:2009-5-13
[摘要]:Eclipse中添加JBoss出错
[关键字]:Application Server,runtime enviroment,EJB,EJB3 , J2EE
[环境]:jboss-5.0.1.GA、Eclipse for Java EE:version3.4.1
[作者]:Winty (wintys@gmail.com) http://www.blogjava.net/wintys

[错误]:
    在Eclipse中添加JBoss runtime时出现错误提示:
Missing classpath entry F:\JBoss\server\default\lib\mail.jar

[原因]:
    这个问题在eclipse的bug中心可以找到 https://bugs.eclipse.org/bugs/show_bug.cgi?id=257823

    原因是JBoss 5.0 GA release的目录结构和之前不一样了,而eclipse的对应插件没有相应的更改 。
   
[解决]:
    找到jboss5.serverdef:
F:\EclipseForJavaEE\plugins\org.eclipse.jst.server.generic.jboss_1.5.205.v200805140145\servers\jboss5.serverdef

将其内容替换为:
<?xml version="1.0" encoding="UTF-8"?>
<tns:ServerRuntime
    xmlns:tns="http://eclipse.org/jst/server/generic/ServerTypeDefinition"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://eclipse.org/jst/server/generic/ServerTypeDefinition ServerTypeDefinitionSchema.xsd "
    name="JBOSS 5.0" version="v5.0">
<property id="serverRootDirectory"
    label="%ApplicationServerDirectory"
    type="directory"
    context="runtime"
    default="/your_server_root/appservers/jboss" />
<property id="serverAddress"
    label="%serverAddress"
    type="string"
    context="server"
    default="127.0.0.1" />
<property id="port"
    label="%serverPort"
    type="string"
    context="server"
    default="8080" />
<property id="jndiPort"
    label="%jndiPort"
    type="string"
    context="server"
    default="1099" />   
<property id="serverConfig"
    label="%jboss323serverConfig"
    type="combo"
    context="server"
    default="default,all,minimal,other - type your own here" />

    <port>
        <no>${port}</no>
        <name>Http</name>
        <protocol>http</protocol>
    </port>

    <module>
        <type>jst.web</type>
        <publishDir>${serverRootDirectory}/server/${serverConfig}/deploy</publishDir>
        <publisherReference>org.eclipse.jst.server.generic.antpublisher</publisherReference>
    </module>
    <module>
        <type>jst.ejb</type>
        <publishDir>${serverRootDirectory}/server/${serverConfig}/deploy</publishDir>
        <publisherReference>org.eclipse.jst.server.generic.antpublisher</publisherReference>
    </module>
    <module>
        <type>jst.ear</type>
        <publishDir>${serverRootDirectory}/server/${serverConfig}/deploy</publishDir>
        <publisherReference>org.eclipse.jst.server.generic.antpublisher</publisherReference>
    </module>


    <project>
        <classpathReference>jboss.project</classpathReference>
    </project>
   
    <start>
        <mainClass>org.jboss.Main</mainClass>
        <workingDirectory>${serverRootDirectory}/bin</workingDirectory>
        <programArguments>-c ${serverConfig}</programArguments>
        <vmParameters>-Dprogram.name=run.bat -Xms128m -Xmx512m  -XX:MaxPermSize=256m</vmParameters>
        <classpathReference>jboss</classpathReference>
    </start>

    <stop>
        <mainClass>org.jboss.Shutdown</mainClass>
        <workingDirectory>${serverRootDirectory}/bin</workingDirectory>
        <programArguments>-S</programArguments>
        <vmParameters>-Djboss.boot.loader.name=shutdown.bat</vmParameters>
        <classpathReference>jboss.shutdown</classpathReference>
    </stop>
    <publisher id="org.eclipse.jst.server.generic.antpublisher">
        <publisherdata>
            <dataname>build.file</dataname>
            <datavalue>/buildfiles/jboss323.xml</datavalue>
        </publisherdata>
        <publisherdata>
            <dataname>target.publish.jst.web</dataname>
            <datavalue>deploy.j2ee.web</datavalue>
        </publisherdata>
        <publisherdata>
            <dataname>target.publish.jst.ejb</dataname>
            <datavalue>deploy.j2ee.ejb</datavalue>
        </publisherdata>
        <publisherdata>
            <dataname>target.unpublish.jst.web</dataname>
            <datavalue>undeploy.j2ee.web</datavalue>
        </publisherdata>
        <publisherdata>
            <dataname>target.unpublish.jst.ejb</dataname>
            <datavalue>undeploy.j2ee.ejb</datavalue>
        </publisherdata>       
        <publisherdata>
            <dataname>target.publish.jst.ear</dataname>
            <datavalue>deploy.j2ee.ear</datavalue>
        </publisherdata>
        <publisherdata>
            <dataname>target.unpublish.jst.ear</dataname>
            <datavalue>undeploy.j2ee.ear</datavalue>
        </publisherdata>               
    </publisher>

    <classpath id="jboss" >
        <archive path="${serverRootDirectory}/bin/run.jar" />
    </classpath>
    <classpath id="jboss.shutdown" >
        <archive path="${serverRootDirectory}/bin/shutdown.jar" />
    </classpath>

    <classpath id="jboss.project" >
       
           
        <fileset dir="${serverRootDirectory}">
           <include name="client/*.jar" />
           <include name="server/default/lib/*.jar" />
          
           <!--Old and wrong reference:
           <include name="server/default/deployers/jbossweb.deployer/jsf-libs/*.jar" />
           This is the right one in JBoss 5CR2 and GA:-->
           <include name="server/default/deploy/jbossweb.sar/jsf-libs/*.jar" />

           <!-- This will be ignored if EJB3 is not there 5.0 -->
           <include name="lib/*.jar" />
           <include name="server/default/deployers/jbossweb.deployer/*.jar" />
           <include name="server/default/deployers/jboss-aop-jboss5.deployer/*.jar" />
           <!-- Not existent in CR2 and GA
           <include name="server/default/deployers/ejb3.deployer/jboss-annotations-ejb3.jar" />-->
          
           <!--New in 5.0GA: if not included, e.g. "jsp-api.jar" (for Tag libraries) is missing-->
           <include name="common/lib/*.jar" />
          
           <!--This one is useful for class "org.jboss.web.tomcat.security.login.WebAuthentication": -->
           <include name="server/default/deploy/jbossweb.sar/*.jar" />
          
           <!-- for validation to work this library is defined as an archive -->
           <!-- moved to "common/lib" in JBoss5 GA, so pick a library from "lib", which is present in both versions:
           <exclude name="server/default/lib/mail.jar" />-->
           <exclude name="lib/jboss-kernel.jar" />
        </fileset>
       
        <!-- leave one generic jar as an archive so that validation works -->
        <!-- moved to "common/lib" in JBoss5 GA, so pick a library from "lib", which is present in both versions:
        <archive path="${serverRootDirectory}/server/default/lib/mail.jar" />-->
        <archive path="${serverRootDirectory}/lib/jboss-kernel.jar" />
  
    </classpath>
    <jndiConnection>
        <providerUrl>jnp://${serverAddress}:${jndiPort}</providerUrl>
        <initialContextFactory>org.jnp.interfaces.NamingContextFactory</initialContextFactory>
        <jndiProperty>
            <name></name>
            <value></value>
        </jndiProperty>
    </jndiConnection>
</tns:ServerRuntime>

[参考资料]:
[1] eclipse中不能添加JBoss 5.0作为Server:http://www.blogjava.net/fireaap/archive/2009/04/19/266441.html

[附件]:
jboss5.serverdef
posted on 2009-05-14 20:36 天堂露珠 阅读(1244) 评论(0)  编辑  收藏 所属分类: Error

只有注册用户登录后才能发表评论。


网站导航: