[jboss-user] [EJB 3.0] - Re: Specifying default values to @Service attributes (JBoss

csorbag do-not-reply at jboss.com
Thu Apr 16 10:56:23 EDT 2009


"jaikiran" wrote : anonymous 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 : anonymous 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.



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225959#4225959

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225959



More information about the jboss-user mailing list