如果openejb在我的webapp之前或之后开始,有人可以从这个日志文件中告诉我

时间:2012-04-18 09:01:36

标签: openejb apache-tomee

我使用openEJB的TomEE ++运行企业Java应用程序。该应用程序正在Eclipse Helios中启动。我已经更改了Eclipse中的“服务器位置”,以允许Eclipse负责Tomcat。

当我从Eclipse中启动应用程序时,我得到了一些奇怪的JPA错误,我想这可能来自于我的webapp之后加载openejb webapp的事实,称为“幻灯片”

我已将web.xml中webapp的load-on-startup值更改为20,而openejb的值为0。

从控制台的输出中,我无法确定openejb是否在我的应用程序之前或之后启动。日志似乎有点矛盾。

刚开始时,我可以看到

ERROR: OpenEJB webapp was not found

这似乎表明openejb没有开始。但不久之后,我看到了诸如

之类的行
INFO: OpenWebBeans Container is starting...

我的有限知识将来自openejb。

之后发生了很多事情,包括几个应用程序的启动,包括我的。

TomcatWebAppBuilder.start /slides

之后,我发现一条线表明openejb已经开始

TomcatWebAppBuilder.start /openejb

那么,到底发生了什么? openejb是在申请之前还是之后开始的?

发布以下日志:

Apr 18, 2012 1:04:46 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64/server:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Apr 18, 2012 1:04:47 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:slides' did not find a matching property.
ERROR: OpenEJB webapp was not found
Apr 18, 2012 1:04:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Apr 18, 2012 1:04:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Apr 18, 2012 1:04:48 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@34b23d12
Apr 18, 2012 1:04:48 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: succeeded in installing singleton service
Apache OpenEJB 4.0.0-beta-2    build: 20120115-08:26
http://openejb.apache.org/
Apr 18, 2012 1:04:52 PM org.apache.openejb.cdi.CdiBuilder build
INFO: existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@34b23d12
Apr 18, 2012 1:04:53 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Apr 18, 2012 1:04:53 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Apr 18, 2012 1:04:53 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Apr 18, 2012 1:04:53 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Apr 18, 2012 1:04:53 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took [142] ms.
Apr 18, 2012 1:04:53 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 7751 ms
Apr 18, 2012 1:04:53 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 18, 2012 1:04:53 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.21
TomcatWebAppBuilder.start /slides
[severity=ERROR,message=unexpected element (uri:"", local:"global"). Expected elements are <{http://jboss.org/xml/ns/javax/validation/configuration}constraint-validator-factory>,<{http://jboss.org/xml/ns/javax/validation/configuration}property>,<{http://jboss.org/xml/ns/javax/validation/configuration}traversable-resolver>,<{http://jboss.org/xml/ns/javax/validation/configuration}constraint-mapping>,<{http://jboss.org/xml/ns/javax/validation/configuration}message-interpolator>,<{http://jboss.org/xml/ns/javax/validation/configuration}default-provider>,locator=[node=null,object=null,url=null,line=13,col=13,offset=-1]]
[severity=ERROR,message=unexpected element (uri:"", local:"global"). Expected elements are <{http://jboss.org/xml/ns/javax/validation/configuration}constraint-validator-factory>,<{http://jboss.org/xml/ns/javax/validation/configuration}property>,<{http://jboss.org/xml/ns/javax/validation/configuration}traversable-resolver>,<{http://jboss.org/xml/ns/javax/validation/configuration}constraint-mapping>,<{http://jboss.org/xml/ns/javax/validation/configuration}message-interpolator>,<{http://jboss.org/xml/ns/javax/validation/configuration}default-provider>,locator=[node=null,object=null,url=null,line=13,col=13,offset=-1]]
Apr 18, 2012 1:05:02 PM org.apache.openejb.cdi.CdiBuilder build
INFO: existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@34b23d12
Apr 18, 2012 1:05:02 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Apr 18, 2012 1:05:02 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Apr 18, 2012 1:05:02 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Apr 18, 2012 1:05:02 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Apr 18, 2012 1:05:02 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took [13] ms.
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
Apr 18, 2012 1:05:03 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Apr 18, 2012 1:05:05 PM org.apache.myfaces.shared.config.MyfacesConfig createAndInitializeMyFacesConfig
INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
Apr 18, 2012 1:05:05 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces.
Apr 18, 2012 1:05:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
TomcatWebAppBuilder.start /manager
Apr 18, 2012 1:05:07 PM org.apache.openejb.cdi.CdiBuilder build
INFO: existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@34b23d12
Apr 18, 2012 1:05:07 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Apr 18, 2012 1:05:07 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Apr 18, 2012 1:05:07 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Apr 18, 2012 1:05:07 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Apr 18, 2012 1:05:07 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took [9] ms.
using context file /home/user/bin/tomcat/SlidesServer/apache-tomee-webprofile-1.0.0-beta-2/webapps/manager/META-INF/context.xml
Apr 18, 2012 1:05:07 PM org.apache.myfaces.shared.config.MyfacesConfig createAndInitializeMyFacesConfig
INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
Apr 18, 2012 1:05:07 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces.
Apr 18, 2012 1:05:07 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
TomcatWebAppBuilder.start /docs
Apr 18, 2012 1:05:08 PM org.apache.openejb.cdi.CdiBuilder build
INFO: existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@34b23d12
Apr 18, 2012 1:05:08 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Apr 18, 2012 1:05:08 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Apr 18, 2012 1:05:08 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Apr 18, 2012 1:05:08 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Apr 18, 2012 1:05:08 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took [14] ms.
Apr 18, 2012 1:05:08 PM org.apache.myfaces.shared.config.MyfacesConfig createAndInitializeMyFacesConfig
INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
Apr 18, 2012 1:05:08 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces.
Apr 18, 2012 1:05:08 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
TomcatWebAppBuilder.start 
Apr 18, 2012 1:05:08 PM org.apache.openejb.cdi.CdiBuilder build
INFO: existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@34b23d12
Apr 18, 2012 1:05:08 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Apr 18, 2012 1:05:08 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Apr 18, 2012 1:05:08 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Apr 18, 2012 1:05:08 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Apr 18, 2012 1:05:08 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took [6] ms.
Apr 18, 2012 1:05:08 PM org.apache.myfaces.shared.config.MyfacesConfig createAndInitializeMyFacesConfig
INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
Apr 18, 2012 1:05:08 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces.
Apr 18, 2012 1:05:08 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
TomcatWebAppBuilder.start /host-manager
Apr 18, 2012 1:05:09 PM org.apache.openejb.cdi.CdiBuilder build
INFO: existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@34b23d12
Apr 18, 2012 1:05:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Apr 18, 2012 1:05:09 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Apr 18, 2012 1:05:09 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Apr 18, 2012 1:05:09 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Apr 18, 2012 1:05:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took [8] ms.
using context file /home/user/bin/tomcat/SlidesServer/apache-tomee-webprofile-1.0.0-beta-2/webapps/host-manager/META-INF/context.xml
Apr 18, 2012 1:05:09 PM org.apache.myfaces.shared.config.MyfacesConfig createAndInitializeMyFacesConfig
INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
Apr 18, 2012 1:05:09 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces.
Apr 18, 2012 1:05:09 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory openejb
TomcatWebAppBuilder.start /openejb
Apr 18, 2012 1:05:09 PM org.apache.openejb.cdi.CdiBuilder build
INFO: existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@34b23d12
Apr 18, 2012 1:05:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
Apr 18, 2012 1:05:09 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
Apr 18, 2012 1:05:09 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
Apr 18, 2012 1:05:09 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Apr 18, 2012 1:05:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took [9] ms.
using context file /home/user/bin/tomcat/SlidesServer/apache-tomee-webprofile-1.0.0-beta-2/webapps/openejb/META-INF/context.xml
Apr 18, 2012 1:05:09 PM org.apache.myfaces.shared.config.MyfacesConfig createAndInitializeMyFacesConfig
INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
Apr 18, 2012 1:05:09 PM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces.
OpenEJB Loader init-params:
    There are no initialization parameters.
Apr 18, 2012 1:05:10 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Apr 18, 2012 1:05:10 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Apr 18, 2012 1:05:10 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 16795 ms
Apr 18, 2012 1:05:11 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [action] in context with path [/slides] threw exception [javax.ejb.EJBException: The bean encountered a non-application exception; nested exception is: 
    <openjpa-2.1.1-r422266:1148538 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null
FailedObject: Select s from SlideShow s [java.lang.String]] with root cause

1 个答案:

答案 0 :(得分:2)

听起来更像是从Eclipse启动Tomcat / TomEE时未使用JavaAgent。有一个openejb-javaagent jar文件需要通过-javaagent vm参数在命令行中指定。

这将打开OpenJPA字节码增强器,并使所有JPA功能正常工作。它将在没有-javaagent vm标志的情况下工作,因为OpenJPA对基于子类的方法实现JPA的支持有限(实现JPA的方法只有两种:子类化实体类或字节码增强实体类)。例如,Hibernate仅使用子类化,并且不需要javaagent。

vanilla Tomcat启动命令将具有以下参数:

/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java
-Djava.util.logging.config.file=<tomcat-home>/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=<tomcat-home>/endorsed
-classpath <tomcat-home>/bin/bootstrap.jar:<tomcat-home>/bin/tomcat-juli.jar
-Dcatalina.base=<tomcat-home>
-Dcatalina.home=<tomcat-home>
-Djava.io.tmpdir=<tomcat-home>/temp
org.apache.catalina.startup.Bootstrap
start

如OpenJPA所要求的那样,TomEE安装将有一个额外的-javaagent(如果使用Hibernate,则可以省略)。

/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java
-Djava.util.logging.config.file=<tomcat-home>/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=<tomcat-home>/endorsed
-classpath <tomcat-home>/bin/bootstrap.jar:<tomcat-home>/bin/tomcat-juli.jar
-Dcatalina.base=<tomcat-home>
-Dcatalina.home=<tomcat-home>
-Djava.io.tmpdir=<tomcat-home>/temp
-javaagent:<tomcat-home>/lib/openejb-javaagent.jar
org.apache.catalina.startup.Bootstrap
start