dev@glassfish.java.net

Re: About hybrid application which demonstrates an EJB as an OSGi service

From: Tang Yong <tangyong_at_cn.fujitsu.com>
Date: Tue, 11 Sep 2012 08:33:24 +0900

Hi Hong, Sahoo

> Sahoo: I just tried a simple EJB OSGi jar test case you gave me before
> and I was able to deploy it as an OSGi bundle with --type osgi with no
> issues.
Please wait for a while, and I will update and build my gf trunk, then
test it again. If the problem is still exist, I will file a bug today.

Thanks!
--Tang

>
> Tang: If you have a reproducible test case, please file an issue and I
> will take a look to see what I can find..
>
> Thanks,
>
> - Hong
>
> On 9/10/2012 8:27 AM, Sahoo wrote:
>> Hi Tang,
>>
>> That looks like a bug in deployment code. I know deployment team was
>> making some change to make deployment not about "OSGi" type deployment
>> and I suspect this regression has been introduced during that. Could you
>> kindly file a bug and assign it to deployment team?
>>
>> Hong,
>> The issue here is that an OSGi bundle containing EJBs is being deployed
>> with --type=osgi option, yet deployment backend is trying to deploy it
>> as an "ejb" archive as you can see from the exception stack.
>>
>> Thanks,
>> Sahoo
>> On Monday 10 September 2012 12:57 PM, Tang Yong wrote:
>>> BTW: entities and simplewab can be deployed using "deploy --type=osgi"
>>> command.
>>>
>>> Tang Yong wrote:
>>>> Hi Sahoo,
>>>>
>>>> I have tried ejbservice2, entities and simplewab on
>>>> trunk/fighterfish/sample/uas and ran them successfully by deploying them
>>>> on current gf built snapshot.
>>>>
>>>> Saying frankly, the sample integrated jpa/osgi, cdi/osgi, ejb bundle
>>>> and wab into gf and is very interesting and strong.
>>>>
>>>> But I met a problem while deploying ejbservice2.
>>>>
>>>> [Problem]
>>>>
>>>> While I used the following command to deploy ejbservice2,
>>>>
>>>> "asadmin deploy --type=osgi
>>>> E:\gfv4\trunk20120820\fighterfish\sample\uas\ejbservice2\target\sample.uas.ejbservice2.jar"
>>>>
>>>> deploying failed, and the following exception was found on server.log,
>>>>
>>>> Unable to load the EJB module. DeploymentContext does not contain any
>>>> EJB. Check the archive to ensure correct packaging for
>>>> E:\ondemandglassfish\glassfish3\glassfish\domains\domain1\applications\sample.uas.ejbservice2.
>>>> If you use EJB component annotations to define the EJB, and an ejb or
>>>> web deployment descriptor is also used, please make sure that the
>>>> deployment descriptor references a Java EE 5 or higher version schema,
>>>> and that the metadata-complete attribute is not set to true, so the
>>>> component annotations can be processed as expected
>>>> java.lang.RuntimeException: Unable to load the EJB module.
>>>> DeploymentContext does not contain any EJB. Check the archive to ensure
>>>> correct packaging for
>>>> E:\ondemandglassfish\glassfish3\glassfish\domains\domain1\applications\sample.uas.ejbservice2.
>>>> If you use EJB component annotations to define the EJB, and an ejb or
>>>> web deployment descriptor is also used, please make sure that the
>>>> deployment descriptor references a Java EE 5 or higher version schema,
>>>> and that the metadata-complete attribute is not set to true, so the
>>>> component annotations can be processed as expected
>>>> at org.glassfish.ejb.startup.EjbDeployer.prepare(EjbDeployer.java:191)
>>>> at
>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:915)
>>>> at
>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:427)
>>>> at
>>>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:228)
>>>> at
>>>> org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:466)
>>>> at
>>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:513)
>>>> ...
>>>>
>>>> So, I want to know whether it is a bug or new feature still being not
>>>> implemented or not?
>>>>
>>>> BTW: Putting the sample.uas.ejbservice2.jar into autodeploy\bundles
>>>> directly has no problem and deploying is successful.
>>>>
>>>> Thanks!
>>>> --Tang
>>>>
>>>> Tang Yong wrote:
>>>>> OK, I will try them.
>>>>>
>>>>> Sahoo wrote:
>>>>>> Something could be wrong with those samples. Use samples from
>>>>>> https://svn.java.net/svn/glassfish~svn/trunk/fighterfish/sample
>>>>>>
>>>>>> Thanks,
>>>>>> Sahoo
>>>>>> On Friday 07 September 2012 12:36 PM, Tang Yong wrote:
>>>>>>> Hi sahoo,
>>>>>>>
>>>>>>> Today, I looked your previous blog[1] again, and tried second hybrid
>>>>>>> application which demonstrates an EJB as an OSGi service on my build
>>>>>>> snapshot based on crrent gf trunk. But I met some problems.
>>>>>>> [1]http://weblogs.java.net/blog/ss141213/archive/2009/06/accessing_an_ej.html
>>>>>>>
>>>>>>> Firstly, I modified parent pom[2] of the hybrid sample in order to use
>>>>>>> the recent jar.
>>>>>>> [2]pl. see the attachment(pom.xml)
>>>>>>>
>>>>>>> Secondly, I start to deploy hybridapp2-service.jar using the following
>>>>>>> three ways,
>>>>>>>
>>>>>>> (1) using "asadmin deploy" command
>>>>>>>
>>>>>>>> asadmin deploy E:\gfv4\hybridapp2-service.jar
>>>>>>> The result failed, and the following error happened on cmd shell.
>>>>>>>
>>>>>>> remote failure: Error occurred during deployment: Exception while
>>>>>>> preparing the app : Unable to load the EJB module. DeploymentContext
>>>>>>> does not contain any EJB. Check the archive to ensure correct packaging
>>>>>>> for ...
>>>>>>> If you use EJB component annotations to define the EJB, and an ejb or
>>>>>>> web deployment descriptor is also used, please make sure that the
>>>>>>> deployment descriptor references a Java EE 5 or higher version schema,
>>>>>>> and that the metadata-complete attribute is not set to true, so the
>>>>>>> component annotations can be processed as expected. Please see
>>>>>>> server.log for more details. Command deploy failed.
>>>>>>>
>>>>>>> BTW: while using "asadmin deploy E:\gfv4\hybridapp2-service.war" , the
>>>>>>> result is the same as (1).
>>>>>>>
>>>>>>> (2) using "asadmin deploy --type=osgi" command
>>>>>>>
>>>>>>>> asadmin deploy --type=osgi E:\gfv4\hybridapp2-service.jar
>>>>>>> The result displayed on cmd shell is successful, but I found that while
>>>>>>> deploying, start method of sahoo.hybridapp.example2.service.Activator
>>>>>>> was firstly executed, and UserAuthServiceEJB.selfRef was null, so on the
>>>>>>> server.log, the following info[3] was printed. Then, postConstruct()
>>>>>>> method of UserAuthServiceEJB class was executed, but, after executing
>>>>>>> [4], selfRef was still null.
>>>>>>>
>>>>>>> [3] "Not able to register the EJB as service, as it didn't deploy"
>>>>>>> [4] selfRef = sessionContext.getBusinessObject(UserAuthService.class);
>>>>>>>
>>>>>>> (3) directly cp hybridapp2-service.jar into domain1\autodeploy\bundles
>>>>>>>
>>>>>>> The result is the same as (2).
>>>>>>>
>>>>>>> So, if having time, could you please confirm the sample and whether I
>>>>>>> made some mistake or not? Or other reasons?
>>>>>>>
>>>>>>> Thanks!
>>>>>>> --Tang
>>>>>>>
>>>>>>>
>
>