我嘗試在glassfish v3上部署多個Web服務。不幸的是,我在8中的6中嘗試了一個錯誤,即該包不包含bean。在glassfish v3上部署多個繼承的Web服務時出錯
奇怪的是,它會工作,當我嘗試幾次。
這裏我的代碼:
類BaseWebServcie:
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;
import javax.jws.WebService;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@WebService
@Stateless
public class BaseWebService {
@PersistenceContext
EntityManager em;
public long getResponse() {
//using EntityManager
...
return new Date().getTime();
}
}
類:WebServiceProxy1
import javax.ejb.Stateless;
import javax.jws.WebService;
@WebService
@Stateless
public class ConcreteWebService1 extends BaseConcreteWebService {
}
我的項目包含多個其他的Web服務。全部從BaseWebService類繼承一個getResponse()方法。但是,如果我嘗試在glassfish上部署它,則會顯示以下錯誤消息。
Schwerwiegend:引用錯誤:該束具有沒有名字[BaseConcreteWebService] Schwerwiegend的豆:異常,同時部署該應用[ConcreteWebService] Schwerwiegend:引用錯誤:該束具有沒有的名稱[BaseConcreteWebService]在org.glassfish豆.apf.AnnotationInfo @ 6c7f1f java.lang.IllegalStateException:引用錯誤:此包在com.sun.enterprise.deployment.archivist.Archivist上沒有名爲[BaseConcreteWebService]的bean,位於[email protected] 。 readAnnotations(Archivist.java:487) at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:429) at com.sun.enterprise.deployment.archivist.Archivist.readRes tDeploymentDescriptors(Archivist.java:405) at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:380) at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java: 243) at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:252) at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:213) at com。 sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:165) at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:185) at org.glassfish.javaee.core。部署.DolProvider.load(DolProvider.java:94) at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:827) at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:769) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368) at com.sun。 enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:375) at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:219) at com.sun.hk2.component.AbstractCreatorImpl。注入(AbstractCreatorImpl.java:131) 在com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91) 在com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82) 在com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67) 在com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139) 在com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78) 在com.sun.enterprise.v3。 server.AppServerStartup.run(AppServerStartup.java:253) at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:145) at com.sun.enterprise.v3.server.AppServerStartup.start( AppServerStartup。的java:136) 在com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79) 在com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63) 在com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:69) 在com.sun.enterprise.glassfish.bootstrap.GlassFishMain $ Launcher.launch(GlassFishMain.java:117) 在陽光下。 reflect.NativeMethodAccessorImpl.invoke0(本機方法) 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method中.invoke(Method.java:601) at com.sun.enterprise.glassfish.bo otstrap.GlassFishMain.main(GlassFishMain.java:97) 在com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)
是否有任何人是如何知道這個問題怎麼解決呢?
非常感謝。