[EJB3] - @DependsOn and @Singleton Bean in EJB3.1 using jboss 6.0 CR1
by aravind kopparthi
aravind kopparthi [http://community.jboss.org/people/aravindsk] created the discussion
"@DependsOn and @Singleton Bean in EJB3.1 using jboss 6.0 CR1"
To view the discussion, visit: http://community.jboss.org/message/575302#575302
--------------------------------------------------------------
I am not sure about the usage but i could not use it like this( @Singleton(DependsOn="SomeSingletonBean") i get compilation error and also tried to use @DepdendsOn after @Singleton declaration.
when i use
@Singleton
@DependsOn(SingletonProcessBean2)
publilc class SingletonProcessBean1
{
///
}
I get the following error. please advice.
Deployment "<UNKNOWN jboss.j2ee:jar=javaee6-app.war,name=BobWireFTPProcessBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jboss.j2ee:jar=javaee6-app.war,name=FtpServerPojo,service=EJB3' **, ** UNRESOLVED Demands 'jndi:FtpServerPojo/no-interface' **
Deployment "jndi:BobWireFTPProcessBean/no-interface" is in error due to the following reason(s): ** NOT FOUND Depends on 'jndi:BobWireFTPProcessBean/no-interface' **
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.Alpha8]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.20101110-CR1]
at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:118) [:0.1.0.Alpha1]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:133) [:6.0.0.20101110-CR1]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.20101110-CR1]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_13]
Deployment "<UNKNOWN jboss.j2ee:jar=javaee6-app.war,name=SingletonProcessBean1,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jboss.j2ee:jar=javaee6-app.war,name=SingletonProcessBean2,service=EJB3' **, ** UNRESOLVED Demands 'jndi:SingletonProcessBean2/no-interface' **
Deployment "jndi:SingletonProcessBean1/no-interface" is in error due to the following reason(s): ** NOT FOUND Depends on 'jndi:SingletonProcessBean2/no-interface' **
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.Alpha8]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.20101110-CR1]
at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:118) [:0.1.0.Alpha1]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:133) [:6.0.0.20101110-CR1]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.20101110-CR1]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_13]
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/575302#575302]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 7 months
[JBoss Tools] - Simple CDI Hello World with Eclipse and JBoss Tools
by Max Andersen
Max Andersen [http://community.jboss.org/people/max.andersen%40jboss.com] modified the blog post:
"Simple CDI Hello World with Eclipse and JBoss Tools"
To view the blog post, visit: http://community.jboss.org/community/tools/blog/2010/12/10/simple-cdi-hel...
--------------------------------------------------------------
With JBoss Tools 3.2 Beta 2 it is simple to start using CDI (Context Dependency Injection).
All you need is the following:
* http://www.jboss.org/jbossas/downloads/ JBoss AS 6 or another Eclipse supported CDI container such as Glassfish
* http://community.jboss.org/community/tools/blog/2010/12/09/jboss-develope... JBoss Developer Studio 4 Beta 2 or another Eclipse with http://community.jboss.org/community/tools/blog/2010/12/09/jboss-tools-32... JBoss Tools 3.2 Beta 2 installed
* 5 minutes to watch or read the following blog
Here it is as a video walk through:
Media Description: Link: http://www.vimeo.com/moogaloop.swf?clip_id=17669512&server=www.vimeo.com&...
...and here are the steps in Screenshot form:
h2. Step 1: Install/Configure the Server runtime
The simplest way to setup JBoss runtimes is to use the "JBoss Runtimes" preference page which are available
via the Preferences or by simply pressing Ctrl+3 and type in "JBoss runtimes".
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10704/he... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1070...
When pressing enter you should see the following Preferences page:
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10705/he... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1070...
Click the "Search..." button and point it to a directory with your JBoss runtimes; in this case I got a few.
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10706/he... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1070...
When you have selected the directory JBoss Tools will scan for runtimes it knows about and show
you what it found:
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10707/he... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1070...
In this dialog you can then remove the checkmarks for runtimes you do not want configured or simply press OK and JBoss Tools will make all selected runtimes available from within the IDE.
For the Server parts it is now availabe in the server view:
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10708/cd... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1070...
>From here you can start the server (in this case JBoss 6) by clicking the Debug or Run icon. If you start via Debug icon the server will wait at any breakpoints you have set in your code and allow you to inspect the current state.
In any case when the server starts up it sends the output of the console to the Console View:
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10709/he... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1070...
h2. Step 2: Create the Project
Now use the File > New > Dynamic Web Project or simply press Ctrl+N and find the "Dynamic Web Project" wizard
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10710/dy... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1071...
On the Wizard page, type in a project name (i.e. "cditest") and Click the "Modify" button under Configuration.
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10711/we... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1071...
The Modify Configuration is where you can enable/disable what Eclipse calls project facets.
In this case we simply want to enable the Context Dependency Injection facet.
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10712/cd... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1071...
Now Click Ok and press Finish on the Wizard and a basic WAR project will be created for you.
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10713/cd... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1071...
h2. Step 3: Create the code
The code we will create are the minimal for printing out Hello World via a servlet.
We will need to add the following files:
* WebContent/WEB-INF/beans.xml to enable CDI fully for the project (in next revision of JBoss Tools this file will be created for you)
* src/org/cditest/HelloWorld.java the bean for giving the "Hello World" greeting.
* src/org/cditest/HelloServlet.java the servlet for rendering the greeting in its response method.
To create the bean.xml simply use Ctrl+N and type in "XML File" and choose the WebContent/WEB-INF folder and give it the name: beans.xml
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10714/be... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1071...
The default file is empty and that will suffice for this blog; remember the beans.xml file is simply just
a marker file to inform the CDI container that the War archive should be scanned for beans.
Next on comes the HelloWorld and Servlet class - for this I will just paste the simplest code
which you can paste into two .java files or use Eclipse's excellent wizards for it. If you want to see the full steps for this you can watch the video above.
HelloWorld.java:
package org.cditest;
public class HelloWorld {
public String getGreeting() {
return "Hello World!";
}
}
HelloServlet.java:
package org.cditest;
import java.io.IOException;
import javax.inject.Inject;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
@WebServlet("/HelloServlet")
public class HelloServlet extends HttpServlet {
@Inject private HelloWorld hello;
public HelloServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.getOutputStream().println("<html><h1>" + hello.getGreeting() + "</h1></html>");
}
}
If you look at the code of the HelloServlet you can see it simply a class with a @WebServlet annotation to specify the context/url name, an @Inject annotated field called Hello and a doGet() method which prints out the value of hello.getGreeting().
In short, the simplest example of @Inject annotation on a servlet.
h2. Step 4: Run the Servlet
>From within Eclipse you can use the Run As... or Debug As... toolbar menu to run what is the current selection and the tools will try and guess what kind of "Run" that means. i.e. for an XHTML page named home.xhtml it might be to open up a browser at http://localhost:8080/home.seam http://localhost:8080/home.seam or in this case for a Servlet to open up the browser at the @WebServlet specified location relative to the deployment name, i.e. http://localhost:8080/cditest/HelloServlet http://localhost:8080/cditest/HelloServlet.
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10715/ru... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1071...
For new projects like this example Eclipse will ask you what Server you wish to run on:
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10716/se... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1071...
In this case I got several servers available, so I will choose the JBoss 6 server and
choose "Always use this server when running this project" so I will not have to answer
this question again on future Run's.
When the server is selected JBoss Tools will deploy the application and show the relevant page
in a browser:
http://community.jboss.org/servlet/JiveServlet/showImage/38-3430-10718/br... http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3430-1071...
h2. Step 5: Have fun!
That is it - and there is of course more functionallity in the CDI tooling such as validations, quick fixes and code completions but I thought it would be good to just show the simplest application imaginable.
But with the steps described above you now know how to setup any JBoss runtime, create any kind of project and enable the Eclipse facets you want on them.
If you want to see how easy it is to debug your applications then watch the video above, it has a little more details.
Hope you enjoyed it ;)
p.s. the exact same steps can be used to run against Glassfish or other CDI enabled servers that has Eclipse WTP server adapters.
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/community/tools/blog/2010/12/10/simple-cdi-hel...]
13 years, 7 months
[Beginner's Corner] - How to bind a Provider? javax.naming.NameNotFoundException: Provider not bound
by Katrin Rue
katrin [http://community.jboss.org/people/katrin] created the discussion
"How to bind a Provider? javax.naming.NameNotFoundException: Provider not bound"
To view the discussion, visit: http://community.jboss.org/message/575367#575367
--------------------------------------------------------------
Hello,
I am setting up a JBoss 5.1 system and get the following error.
How can I bind the Provider?
I think this will solvoe the problem or I am wrong?
09:39:48,578 ERROR [JmsActivation] Unable to reconnect mailto:org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@1e4e6c6(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@1f313f4 org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@1e4e6c6(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter(a)1f313f4 destination=ProductFeatureChangeQueue destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=java:/TIBCOMDBProvider user==<not shown> pass=<not shown> maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=false)
javax.naming.NameNotFoundException: TIBCOMDBProvider not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.util.naming.Util.lookup(Util.java:222)
at org.jboss.util.naming.Util.lookup(Util.java:182)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupJMSProviderAdapter(JmsActivation.java:397)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:346)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.handleFailure(JmsActivation.java:292)
at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:733)
at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/575367#575367]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 7 months
[EJB3] - Exception while deploing an ear with @MessageDriven bean
by Stanislav Kogut
stasikos [http://community.jboss.org/people/stasikos] created the discussion
"Exception while deploing an ear with @MessageDriven bean"
To view the discussion, visit: http://community.jboss.org/message/575308#575308
--------------------------------------------------------------
There is an example of bean code:
@MessageDriven (activationConfig={
@ActivationConfigProperty(propertyName="destination", propertyValue="jms/Queue")})
public class JBossMDB implements MessageListener{
@Override
public void onMessage(Message message) {
Logger.getLogger("JbossMDB").log(Level.INFO, message.toString());
}
}
But when deploying (firest deploy) an ear with this bean to JBosss AS 6CR1 I have this exception:
Failed to create Resource J6EELearning.ear - cause: java.lang.Exception:Failed to start deployment [vfs:///home/stasikos/Soft/jboss-6.0.0.20101110-CR1/server/default/deploy/J6EELearning.ear] during deployment of 'J6EELearning.ear' - cause: java.lang.RuntimeException:org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS IN ERROR: Deployment "jboss.j2ee:ear=J6EELearning.ear,jar=J6EELearning-ejb.jar,name=JBossMDB,service=EJB3" is in error due to the following reason(s): java.lang.IllegalStateException: Timer service with timedObjectId: jboss.j2ee:ear=J6EELearning.ear,jar=J6EELearning-ejb.jar,name=JBossMDB,service=EJB3 is already registered -> org.jboss.deployers.client.spi.IncompleteDeploymentException:Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS IN ERROR: Deployment "jboss.j2ee:ear=J6EELearning.ear,jar=J6EELearning-ejb.jar,name=JBossMDB,service=EJB3" is in error due to the following reason(s): java.lang.IllegalStateException: Timer service with timedObjectId: jboss.j2ee:ear=J6EELearning.ear,jar=J6EELearning-ejb.jar,name=JBossMDB,service=EJB3 is already registered
It is little strange to have Timer service errors when deploying Message-Driven Beans. Also, if I remove this bean from ear, deploy is successfull.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/575308#575308]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 7 months