tomcat中部署seam期待高手告诉小弟

08-10-27 yinyousong
小弟按照下面的步骤部署seam但是却出错了,高手给指点下,或者告诉我其他的部署方法,不胜感激啊!

步骤:

为了让Seam应用程序在Tomcat上正确运行,必须将嵌入式JBoss装载到Tomcat中。 嵌入式的JBoss可以在 这里 下载。将嵌入式的JBoss安装到Tomcat 6的过程非常简单。首先,你必须将嵌入式JBoss的JAR和配置文件都拷贝到Tomcat中。

将嵌入式JBoss的 bootstrap 和 lib 目录下的所有文件和目录,除了 jndi.properties 文件之外,都拷贝到Tomcat的 lib 目录下。

从Tomcat的 lib 目录中移除 annotations-api.jar 文件。

接下来,需要更新两个配置文件,用来增加嵌入式JBoss特有的功能。

将嵌入式JBoss listener增加到 conf/server.xml 中。它在文件中应该排列在所有其他listener的后面。

<Listener className="org.jboss.embedded.tomcat.EmbeddedJBossBootstrapListener" />

应该通过增加一个listener到 conf/context.xml 文件中来启用WAR文件扫描功能。

<Listener className="org.jboss.embedded.tomcat.WebinfScanner" />

异常:

2008-10-27 13:47:57 org.apache.catalina.core.AprLifecycleListener init

信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\MyEclipse 6.5M1 Blue\bin;D:\Tomcat 6.0\bin

2008-10-27 13:47:57 org.apache.coyote.http11.Http11Protocol init

信息: Initializing Coyote HTTP/1.1 on http-8080

2008-10-27 13:47:57 org.apache.catalina.startup.Catalina load

信息: Initialization processed in 828 ms

ERROR 27-10 13:47:58,468 (AbstractController.java:incrementState:456) -Error installing to Start: name=ServerConfig state=Create

java.net.URISyntaxException: Illegal character in path at index 15: file:/D:/Tomcat 6.0/lib/

at java.net.URI$Parser.fail(Unknown Source)

at java.net.URI$Parser.checkChars(Unknown Source)

at java.net.URI$Parser.parseHierarchical(Unknown Source)

at java.net.URI$Parser.parse(Unknown Source)

at java.net.URI.<init>(Unknown Source)

at java.net.URL.toURI(Unknown Source)

at org.jboss.embedded.adapters.ServerConfig.initializeByFile(ServerConfig.java:93)

at org.jboss.embedded.adapters.ServerConfig.start(ServerConfig.java:63)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

banq
2008-10-27 14:01
>Illegal character in path

配置tomcat/lib路径出现非法字符,够累的,就直接用JBoss会怎么样呢?你这样做就是手工合成一个JBoss。

yinyousong
2008-10-28 09:36
不好意思啊,这个问题解决了,但是接着又来了很多问题呀。

我狂晕,开JBOSS完全没问题,可惜我的机子开不了啊,开一下内存使用1.05G我的机子才1G啊。!!

不知道怎么搞了...问题不断啊.....可爱的seam

yinyousong
2008-10-28 09:42
按照上面的步骤进行,然后报错了:

严重: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/seamtest,J2EEApplication=none,J2EEServer=none

2008-10-28 9:35:16 org.apache.catalina.startup.HostConfig deployWAR

严重: Error deploying web application archive seamtest.war

java.lang.RuntimeException: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

persistence.units:unitName=seamtest

-> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.jca:name=seamtestDatasource,service=DataSourceBinding **}

*** CONTEXTS IN ERROR: Name -> Error

<UNKNOWN> -> ** UNRESOLVED Demands 'jboss.jca:name=seamtestDatasource,service=DataSourceBinding **

at org.jboss.embedded.tomcat.WebinfScanner.lifecycleEvent(WebinfScanner.java:94)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4238)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)

at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

at org.apache.catalina.core.StandardService.start(StandardService.java:448)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

at org.apache.catalina.startup.Catalina.start(Catalina.java:552)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Caused by: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

persistence.units:unitName=seamtest

-> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.jca:name=seamtestDatasource,service=DataSourceBinding **}

这应该是presistence.xml出错了吧,我不知道具体是错在那里,于是把presistence.xml文件给删除了,

然后下面又报错了:

yinyousong
2008-10-28 09:45
2008-10-28 9:38:46 org.apache.catalina.core.StandardContext listenerStart

严重: Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener

java.lang.IllegalStateException: Two components with the same name and precedence: authenticator

at org.jboss.seam.init.Initialization.addComponentDescriptor(Initialization.java:479)

at org.jboss.seam.init.Initialization.installScannedComponentAndRoles(Initialization.java:742)

at org.jboss.seam.init.Initialization.scanForComponents(Initialization.java:689)

at org.jboss.seam.init.Initialization.init(Initialization.java:562)

at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)

at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

at org.apache.catalina.core.StandardService.start(StandardService.java:448)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

at org.apache.catalina.startup.Catalina.start(Catalina.java:552)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

2008-10-28 9:38:46 org.apache.catalina.core.StandardContext start

严重: Error listenerStart

2008-10-28 9:38:46 org.apache.catalina.core.StandardContext start

严重: Context [/seamtest.war] startup failed due to previous errors

那位高手能否给出给tomcat部署seam的完美例子啊,谷歌搜不到,这几天把我头都搞大了,异常不断呀...伤心咯...

yinyousong
2008-10-28 09:55
给我个完整的部署例子咯,学生好急呀..伤心死了....谷歌搜不到

freebox
2008-10-28 22:27
拿jbosstool建一个算了,建工程的时候服务器选tomcat就好了,不过选tomcat实在没什么好处,部署测试的时候还得给个context.xml描述,还有大批针对ee的好东西用不了,但是我当初没用嵌入什么jboss,在tomcat里也运行起来了,只是功能少了很多。

yinyousong
2008-10-29 07:28
以上问题都解决了,现在有这个异常了:

*** CONTEXTS IN ERROR: Name -> Error

persistence.units:jar=classes.jar,unitName=JPAPU -> java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence

yinyousong
2008-10-29 08:13
INFO [org.jboss.ejb3.entity.PersistenceUnitDeployment] Starting persistence unit persistence.units:jar=classes.jar,unitName=JPAPU

ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=persistence.units:jar=classes.jar,unitName=JPAPU state=Create

java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence

at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:258)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:56)

at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:110)

at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)

at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:214)

at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:45)

at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:108)

at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:69)

at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)

yinyousong
2008-10-29 15:31
正所谓:换天不负有心人啊,进过几天的奋战,我终于能用嵌入版JBOSS在TOMCAT中部署SEAM应用了.

哈哈。。(*^__^*) 嘻嘻……

banq
2008-10-29 17:31
恭喜,能不能把你的心得共享出来?包括前面错误解决方式。

yinyousong
2008-10-29 20:59
谢谢你的祝贺呀,banq老师还是那么的热情.现在能成功运行了,不过我还在学习中呢,改天有时间就把心得写下来.

yinyousong
2008-11-09 22:11
看此篇文章前,请您确认对seam有所了解,并且会使用seam gen,其实这都很简单.

一、安装嵌入JBOOS:为了让Seam应用程序在Tomcat上正确运行,必须将嵌入式JBoss装载到Tomcat中。 嵌入式的JBoss可以在 这里(http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=228977) 下载(请下beta3版的)。

将嵌入式的JBoss安装到Tomcat6的过程非常简单。首先,你必须将嵌入式JBoss的JAR和配置文件都拷贝到Tomcat中。

将嵌入式JBoss的 bootstrap 和 lib 目录下的所有文件和目录,除了 jndi.properties 文件之外,都拷贝到Tomcat的 lib 目录下。

从Tomcat的 lib 目录中移除 annotations-api.jar 文件。

接下来,需要更新两个配置文件,用来增加嵌入式JBoss特有的功能。

将嵌入式JBoss listener增加到 conf/server.xml 中。它在文件中应该排列在所有其他listener的后面。

<Listener className="org.jboss.embedded.tomcat.EmbeddedJBossBootstrapListener" />

应该通过增加一个listener到 conf/context.xml 文件中来启用WAR文件扫描功能。

<Listener className="org.jboss.embedded.tomcat.WebinfScanner" />

二、配置数据源:到%TOMCAT_HOME%\lib\deploy目录下,配置数据源.

基本上和JBOOS上配置数据源一样.一点不同就是要吧<metadata>....</metadata>里连同<metadata>注释一起删除掉,

要不然会报有关metadata的异常的哦.

三、准备sema的jar包:将seam自带的例子(booking)用ant编译,具体做法请到google搜(满江红发布的seam中文文档),

编译后将除(jboos-seam-booking.jar)之外,jar包多了好像会报错误哦(印象中会,大家可以试试!)

四、新建项目:用myeclipse new webproject,用seam gen工具生成seam的模板.然后将resource\WEB-INF下的:components.xml faces-config.xml pages.xml web.xml

复制到你新建的项目中\WebRoot\WEB-INF下.

五、配置项目树:将关注重心移到你新建的项目中的src文件夹下增加seam.properties、components.properties;

新建EMTA-INF文件夹增加persistence.xml(同JBOSS下配置一样)、ejb-jar.xml(先不在新建的文件上增加东西,除persistence.xml)

六、修改配置文件:

(1):把WEB-INF\components.xml将<components>到</components>内容改成:<core:init jndi-pattern="#{ejbName}/local"/>

<security:identity authenticate-method="#{authenticator.authenticate}"></security:identity>

<core:manager concurrent-request-timeout="500"

conversation-timeout="120000"

conversation-id-parameter="cid"/>

<persistence:managed-persistence-context name="em"

auto-create="true"

persistence-unit-jndi-name="java:/EntityManagerFactories/JPAPU"

/>

(2):WEN-INF\faces-config.xml将<application>到</application>改成:<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>

(3):转移到src\META-INF下,在新建的ejb-jarx.xml下增加:<?xml version="1.0" encoding="UTF-8"?>

<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"

version="3.0">

<interceptors>

<interceptor>

<interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>

</interceptor>

</interceptors>

<assembly-descriptor>

<interceptor-binding>

<ejb-name>*</ejb-name>

<interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>

</interceptor-binding>

</assembly-descriptor>

</ejb-jar>

(4):在persistence.xml加<property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagerFactories/JPAPU"/>

(5):在src目录下components.propertis加jndiPattern \#{ejbName}/local

注:tomcat路径不能有空格,由于时间及篇幅所限对经常出现的异常及解决办法就不写了,以上内容是小弟花了近3天才摸索出来的,如果那位有更好的解决办法希望能告诉我.

如果你还不能成功的在tomcat中运行seam那请您将异常信息回复到此帖,

tlgtjj
2009-03-22 17:10
按照你上面提到的用法,但出现以下的错误:

WARN [org.jboss.mx.loading.UnifiedLoaderRepository3] Tried to add non-URLClassLoader. Ignored

ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Described: name=BeanDeployer state=PreInstall

java.lang.RuntimeException: java.lang.reflect.UndeclaredThrowableException

at org.jboss.aop.util.ClassInfoMethodHashing.methodHash(ClassInfoMethodHashing.java:70)

at org.jboss.aop.util.ClassInfoMethodHashing.addDeclaredMethods(ClassInfoMethodHashing.java:169)

at org.jboss.aop.util.ClassInfoMethodHashing.populateMethodTables(ClassInfoMethodHashing.java:182)

at org.jboss.aop.util.ClassInfoMethodHashing.populateMethodTables(ClassInfoMethodHashing.java:181)

at org.jboss.aop.util.ClassInfoMethodHashing.populateMethodTables(ClassInfoMethodHashing.java:181)

at org.jboss.aop.util.ClassInfoMethodHashing.populateMethodTables(ClassInfoMethodHashing.java:181)

at org.jboss.aop.util.ClassInfoMethodHashing.populateMethodTables(ClassInfoMethodHashing.java:181)

at org.jboss.aop.util.ClassInfoMethodHashing.populateMethodTables(ClassInfoMethodHashing.java:181)

at org.jboss.aop.util.ClassInfoMethodHashing.getMethodMap(ClassInfoMethodHashing.java:188)

at org.jboss.aop.microcontainer.integration.AOPDependencyBuilder.getMethodAnnotationDependencies(AOPDependencyBuilder.java:197)

at org.jboss.aop.microcontainer.integration.AOPDependencyBuilder.getAnnotationDependencies(AOPDependencyBuilder.java:152)

at org.jboss.aop.microcontainer.integration.AOPDependencyBuilder.getDependencies(AOPDependencyBuilder.java:130)

at org.jboss.classadapter.plugins.BasicClassAdapter.getDependencies(BasicClassAdapter.java:80)

at org.jboss.beans.info.plugins.AbstractBeanInfo.getDependencies(AbstractBeanInfo.java:211)

at org.jboss.kernel.plugins.dependency.DescribeAction.installActionInternal(DescribeAction.java:53)

at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:135)

at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:46)

at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)

at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)

at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)

at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)

at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)

at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)

at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)

at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)

at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:574)

at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:398)

at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:309)

at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:279)

at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)

at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96)

at org.jboss.embedded.Bootstrap.deployBaseBootstrapUrl(Bootstrap.java:130)

at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:142)

at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:183)

at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:195)

at org.jboss.embedded.tomcat.EmbeddedJBossBootstrapListener.innerStart(EmbeddedJBossBootstrapListener.java:74)

at org.jboss.embedded.tomcat.EmbeddedJBossBootstrapListener.lifecycleEvent(EmbeddedJBossBootstrapListener.java:54)

tlgtjj
2009-03-22 17:17
按照你上面提到的用法,但出现以下的错误:见附件


attachment:


错误日志.txt

猜你喜欢
2Go 1 2 下一页