Skip to main content

@WebService that returns Entity throws "Exception occured in J2EEC Phase"

7 replies [Last post]
zambizzi
Offline
Joined: 2005-08-19

I got bounced back to this forum after asking this question in the JAX-WS forum, they seem to think it is a Glassfish issue and what I'm trying to do is entirely possible...

I can build this:

<br />
@WebService<br />
public class MyServiceImpl<br />
{<br />
  @EJB<br />
  private CustomerRemote customerBean;</p>
<p>  @WebMethod<br />
  public String[] getTopCustomerArray()<br />
  {<br />
    Customer customer = this.customerBean.getTopCustomer();<br />
    String[] custArray = {customer.getCustno(), customer.getName()};<br />
    return custArray;<br />
  }</p>
<p>  @WebMethod<br />
  public Customer getTopCustomerEntity()<br />
  {<br />
    return this.customerBean.getTopCustomer();<br />
  }<br />
}<br />

But I get this exception when trying to deploy to GF:

<br />
Exception occured in J2EEC Phase<br />
com.sun.enterprise.deployment.backend.IASDeploymentException: Fatal Error from EJB Compiler -- C:\glassfish\domains\domain1\generated\xml\j2ee-apps\MyProjectWS\MyProjectWS_war\WEB-INF\wsdl\MyProjectImplService.wsdl (The system cannot find the file specified)<br />
        at java.io.FileInputStream.open(Native Method)<br />
        at java.io.FileInputStream.(FileInputStream.java:106)<br />
        at java.io.FileInputStream.(FileInputStream.java:66)<br />
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)<br />
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)<br />
        at java.net.URL.openStream(URL.java:1007)<br />
        at com.sun.enterprise.webservice.WsUtil.generateFinalWsdl(WsUtil.java:699)<br />
        at com.sun.enterprise.webservice.WsUtil.generateFinalWsdl(WsUtil.java:643)<br />
        at com.sun.enterprise.deployment.backend.WebServiceDeployer.doWebServiceDeployment(WebServiceDeployer.java:165)<br />
        at com.sun.ejb.codegen.IASEJBC.doCompile(IASEJBC.java:855)<br />
        at com.sun.ejb.codegen.IASEJBC.ejbc(IASEJBC.java:580)<br />
        at com.sun.enterprise.deployment.backend.EJBCompiler.preDeployApp(EJBCompiler.java:339)<br />
        at com.sun.enterprise.deployment.backend.EJBCompiler.compile(EJBCompiler.java:222)<br />
        at com.sun.enterprise.deployment.backend.AppDeployer.runEJBC(AppDeployer.java:359)<br />
        at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:214)<br />
        at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:129)<br />
        at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)<br />
        at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)<br />
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)<br />
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)<br />
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)<br />
        at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)<br />
        at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)<br />

...if I remove the method that returns a single Customer entity bean, leaving just the String array...it builds, deploys, and runs just fine.

So, I'm guessing either this cannot be done or I'm missing something simple?

Thanks!

See here for original post in JAX-WS forum:

http://forums.java.net/jive/thread.jspa?threadID=20333

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
merickson
Offline
Joined: 2006-10-25

I am having a similar problem, trying to return a complex type (actually a simple bean) from a web service in Netbeans 5.5. The bean is in a common JAR. If I move the bean into the same project as the webservice, then everything works. If the bean is in a common jar then I get the exception

Exception occured in J2EEC Phase
java.lang.NoClassDefFoundError: Lresources/MyBean;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at com.sun.xml.bind.v2.model.nav.ReflectionNavigator.getDeclaredFields(ReflectionNavigator.java:210)
at com.sun.xml.bind.v2.model.nav.ReflectionNavigator.getDeclaredFields(ReflectionNavigator.java:22)
at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:248)
at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:90)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:127)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:48)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:40)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
at com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
at com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:33)
at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:22)
at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:15)
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:38)
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:41)
at java.util.AbstractList$Itr.next(AbstractList.java:345)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:48)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:40)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:204)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:356)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:217)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:76)
at com.sun.xml.ws.model.RuntimeModel$1.run(RuntimeModel.java:196)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.ws.model.RuntimeModel.createJAXBContext(RuntimeModel.java:193)
at com.sun.xml.ws.model.RuntimeModel.postProcess(RuntimeModel.java:79)
at com.sun.xml.ws.modeler.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:255)
at com.sun.tools.ws.wscompile.CompileTool.buildModel(CompileTool.java:633)
at com.sun.tools.ws.wscompile.CompileTool.run(CompileTool.java:538)
at com.sun.tools.ws.util.ToolBase.run(ToolBase.java:56)
at com.sun.tools.ws.util.WSToolsObjectFactoryImpl.wsgen(WSToolsObjectFactoryImpl.java:44)
at com.sun.enterprise.webservice.WsUtil.runWsGen(WsUtil.java:1820)
at com.sun.enterprise.webservice.WsUtil.genWSInfo(WsUtil.java:2089)
at com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:396)
at com.sun.enterprise.deployment.backend.EjbModuleDeployer.deploy(EjbModuleDeployer.java:138)
at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:160)
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)

kretes
Offline
Joined: 2007-04-22

I've putted a bug https://glassfish.dev.java.net/issues/show_bug.cgi?id=3019 - U can vote on it - this is the same...

Hope they will fix it soon :)

bhaktimehta
Offline
Joined: 2004-03-18

Hi,
I have committed a fix for bug 922 yesterday
https://glassfish.dev.java.net/issues/show_bug.cgi?id=922
Please can you try b47 or the latest nightly and reopen if you are still seeing
this issue. Also please attach a NB project or a testcase if you still see the issue
Thanks,
Bhakti

kristof_taveirne
Offline
Joined: 2006-05-05

Has this been resolved already?
I'm running into the same problem.

What I would like to do is to be able to use the (entity) beans I created for my datalayer in the web service layer of my application. But maybe hiding the @Id field in the ws-layer.

Is this possible?
The error i'm getting upon deployment is a bit different then the error in the post above, but here it is:

Problem encountered during annotation processing;
see stacktrace below for more information.
java.lang.NullPointerException
at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.isSubtype(WebServiceAP.java:345)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.isRemote(WebServiceAP.java:340)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalType(WebServiceVisitor.java:745)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalParameter(WebServiceVisitor.java:648)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalMethod(WebServiceVisitor.java:615)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.methodsAreLegal(WebServiceVisitor.java:573)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(WebServiceVisitor.java:491)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVisitor.java:306)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:109)
at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:311)
at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:252)
at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)
at com.sun.tools.apt.main.Main.compile(Main.java:1102)
at com.sun.tools.apt.main.Main.compile(Main.java:964)
at com.sun.tools.apt.Main.processing(Main.java:95)
at com.sun.tools.apt.Main.process(Main.java:85)
at com.sun.tools.apt.Main.process(Main.java:67)
at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:161)
at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:89)
at com.sun.tools.ws.util.WSToolsObjectFactoryImpl.wsgen(WSToolsObjectFactoryImpl.java:47)
at com.sun.tools.ws.spi.WSToolsObjectFactory.wsgen(WSToolsObjectFactory.java:93)
at com.sun.enterprise.webservice.WsUtil.runWsGen(WsUtil.java:1812)
at com.sun.enterprise.webservice.WsUtil.genWSInfo(WsUtil.java:2110)
at com.sun.enterprise.deployment.backend.AppDeployerBase.loadDescriptors(AppDeployerBase.java:346)
at com.sun.enterprise.deployment.backend.AppDeployer.explodeArchive(AppDeployer.java:274)
at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:188)
at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:132)
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:174)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:892)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:761)
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)
error: compilation failed, errors should have been reported
Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException: WSGEN FAILED
at com.sun.enterprise.webservice.WsUtil.genWSInfo(WsUtil.java:2117)
at com.sun.enterprise.deployment.backend.AppDeployerBase.loadDescriptors(AppDeployerBase.java:346)
at com.sun.enterprise.deployment.backend.AppDeployer.explodeArchive(AppDeployer.java:274)
at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:188)
at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:132)
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:174)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:892)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:761)
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)

I'm using glassfish v2 b36 with jax-ws 2.1 RI installed.

Greetings,
kristof

ss141213
Offline
Joined: 2005-03-30

Which build are you using? What is your packaging structure? I am able to deploy and run WebService that returns JPA Entity in web methods. Can you try using the latest build?

-- Sahoo

zambizzi
Offline
Joined: 2005-08-19

I'm using V1 UR1 with a very basic Enterpise Web Project built w/ Netbeans 5.5 (web + ejb project).

I don't know what good the latest v2 builds would do me as I cannot (and won't) use them in production - we already have v1 b14 in production.

ss141213
Offline
Joined: 2005-03-30

Are you packaging your entity beans in ejb-jar or part of a common library shared between web & ejb module? Can you supply a complete test case? I suggest you file a bug.