我正在为Java Enterprise Applications类开发一个项目。我有一个带有ejb模块的应用程序,它具有" facade"类库中连接到类似Twitter的简单数据库的类。所有逻辑都运行正常,但是,当我为外观添加远程bean并尝试运行它时,应用程序崩溃,最后包含堆栈跟踪。
通过GlassFish输出屏幕,我发现了以下警告:
警告:ACDEPL112:从C:\ Users [project_path] \ Questions \ dist \ gfdeploy \ Questions \ QuestionClient.jar的清单中引用了以下扩展或库,但未在指示的地方找到:QuestionLib.jar;无视并继续 信息:ACDEPL103:为应用程序客户端启动Java Web Start服务问题/ QuestionClient.jar(contextRoot:/ Questions / QuestionClient) 信息:问题已在3,097毫秒内成功部署。 警告:元模型[EntityType]类型的集合为空。在实体搜索Java SE和某些Java EE容器管理的持久性单元期间可能找不到模型类。请使用元素或全局false元素验证persistence.xml中是否引用了您的实体类。 [class com.problemSet3.db.Questions]上的查找将返回null。 警告:EJB5184:在EJB QuestionsFacade上调用期间发生系统异常,方法:public java.util.List com.problemSet3.db.AbstractFacade.findAll()
当我检查路径时,我发现提到的.jar文件存在于应该存在的位置,但它被命名为 QuestionLib_jar ,它是一个包含jar文件所有内容的文件夹。这些文件是由NetBeans生成的,我不知道如何将jar文件编译到文件夹而不是实际的jar文件。
我该如何解决这个问题?
堆栈跟踪
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) 在org.glassfish.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:446) 在org.glassfish.appclient.client.AppClientFacade.launch(AppClientFacade.java:183) 在org.glassfish.appclient.client.AppClientGroupFacade.main(AppClientGroupFacade.java:65) 引起:javax.ejb.EJBException at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:748) at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:698) at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:503) 在com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4475) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2009) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1979) at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:212) at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:79) 在com.sun.proxy。$ Proxy295.findAll(未知来源) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie.dispatchToMethod(ReflectiveTie.java:143) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:173) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatchToServant(ServerRequestDispatcherImpl.java:528) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatch(ServerRequestDispatcherImpl.java:199) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequestRequest(MessageMediatorImpl.java:1549) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:1425) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleInput(MessageMediatorImpl.java:930) at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:213) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:694) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.dispatch(MessageMediatorImpl.java:496) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.doWork(MessageMediatorImpl.java:2222) at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl $ WorkerThread.performWork(ThreadPoolImpl.java:497) at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl $ WorkerThread.run(ThreadPoolImpl.java:540) 引起:java.lang.IllegalArgumentException:没有找到Metamodel中的密钥类[com.problemSet3.db.Questions]的[EntityType] - 请验证使用特定的com在persistence.xml中引用了[Entity]类.problemSet3.db.Questions属性或全局false元素。 at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entityEmbeddableManagedTypeNotFound(MetamodelImpl.java:173) at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entity(MetamodelImpl.java:193) at org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl.internalFrom(CommonAbstractCriteriaImpl.java:114) 在org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.from(AbstractQueryImpl.java:246) 在com.problemSet3.db.AbstractFacade.findAll(AbstractFacade.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) 在org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081) 在org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153) at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4695) at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:630) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822) 在com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582) 在org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55) at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822) 在com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822) at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369) at com.sun.ejb.containers.BaseContainer .__ intercept(BaseContainer.java:4667) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4655) at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:205) ......还有19个 Java结果:1
答案 0 :(得分:2)
嗯,经过一个痛苦的夜晚和早晨,我终于解决了它。 ejb模块正在使用的persistence.xml文件包含以下行:
<exclude-unlisted-classes>false</exclude-unlisted-classes>
我进入属性并手动包含每个类,所以现在它看起来像这样:
<class>com.problemSet3.db.Answers</class>
<class>com.problemSet3.db.Questions</class>
<class>com.problemSet3.db.Users</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
加上其他生成的代码。我仍然在GlassFish上收到警告,但没有抛出异常。