This content has been marked as final.
Show 4 replies
-
1. Re: Specifying default values to @Service attributes (JBoss
jaikiran Apr 15, 2009 11:31 PM (in response to csorbag)According to jboss' official ejb3 tutorial I should be able to reference the service using the tag within either ejb-jar.xml or jboss.xml
The service element in not available in ejb-jar.xml. Its available only in jboss.xml. Could you point us to the doc which says that its available in ejb-jar.xml? We'll fix it. The new tutorials for AS-5 are here http://www.jboss.org/jbossejb3/docs/
Specifically, the @Service using deployment descriptors http://www.jboss.org/file-access/default/members/jbossejb3/freezone/docs/tutorial/1.0.4/html/Service_POJOs_through_deployment_descriptors.html
The env-entry can be specified for the services in the jboss.xml. If that doesn't work then please post the contents of your jboss.xml and the entire exception stacktrace.
While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted. -
2. Re: Specifying default values to @Service attributes (JBoss
csorbag Apr 16, 2009 10:56 AM (in response to csorbag)"jaikiran" wrote:
The service element in not available in ejb-jar.xml. Its available only in jboss.xml.
I tried both ejb-jar.xml and jboss.xml. None of them worked. I know the tutorial mentions only jboss.xml. The problem is that there is only a partial deployment descriptor in the tutorial that does not mention where I should put the service tag. Unfortunately I couldn't even find any references to the deployment descriptor XSD or DTD, so I couldn't figure out myself. No matter where I put the service tag I get the following exception after deploying the service:org.jboss.xb.binding.JBossXBRuntimeException: service not found as a child of enterprise-beans at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:863) at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:806) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:293) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619)
"jaikiran" wrote:
The env-entry can be specified for the services in the jboss.xml. If that doesn't work then please post the contents of your jboss.xml and the entire exception stacktrace.
That's exactly what I'm trying to do. Here are the DD and the class.<?xml version="1.0"?> <jboss> <enterprise-beans> <service> <ejb-name>TestService</ejb-name> <env-entry> <env-entry-name>defaultAttributeValue</env-entry-name> <env-entry-type>java.lang.Integer</env-entry-type> <env-entry-value>10</env-entry-value> <injection-target> <injection-target-class>test.TestService</injection-target-class> <injection-target-name>attribute</injection-target-name> </injection-target> </env-entry> </service> </enterprise-beans> </jboss>
The service:package test; import javax.ejb.Remote; import org.jboss.ejb3.annotation.Management; import org.jboss.ejb3.annotation.Service; @Service(name = "TestService", objectName = "test:service=TestService") @Remote(TestInterface.class) @Management(TestInterface.class) public class TestService implements TestInterface { private int attribute; @Override public int getAttribute() { return attribute; } public void setAttribute(int attribute) { this.attribute = attribute; } }
If I change the @Service attribute to @Stateless and the service tag to session, so that it's a regular SB, then it works fine and the container injects the value specified in the env-entry-value tag. I just cannot figure out how to do it with a @Service. -
3. Re: Specifying default values to @Service attributes (JBoss
csorbag Apr 16, 2009 12:09 PM (in response to csorbag)"csorbag" wrote:
I tried both ejb-jar.xml and jboss.xml. None of them worked. I know the tutorial mentions only jboss.xml. The problem is that there is only a partial deployment descriptor in the tutorial that does not mention where I should put the service tag. Unfortunately I couldn't even find any references to the deployment descriptor XSD or DTD, so I couldn't figure out myself. No matter where I put the service tag I get the following exception after deploying the service:
I finally found the DTD of jboss.xml (jboss_5_0.dtd under docs/dtd). I simply cannot find any trace of the service tag in that. I'm totally confused :(
Is it a deprecated feature in the new release? Do I misunderstand something? -
4. Re: Specifying default values to @Service attributes (JBoss
jaikiran Apr 19, 2009 2:18 AM (in response to csorbag)I know the tutorial mentions only jboss.xml. The problem is that there is only a partial deployment descriptor in the tutorial that does not mention where I should put the service tag. Unfortunately I couldn't even find any references to the deployment descriptor XSD or DTD, so I couldn't figure out myself.
The tutorials that i pointed to also have the downloadable source code. Here's the jboss.xml with the xsd declaration http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/jboss.xml
I finally found the DTD of jboss.xml (jboss_5_0.dtd under docs/dtd). I simply cannot find any trace of the service tag in that. I'm totally confused :(
Is it a deprecated feature in the new release? Do I misunderstand something?
For EJB3 on JBoss, the DTD for jboss.xml cannot be used. You will have to the xsd as shown in the above SVN file.