I was referring to the Jboss-IDE tutorial from .
everything was fine until i tried to deployed the created ear file to jboss 4.0.3.
I getting the error message
a similar problem is mentioned in thread197-819238, but here the problem appear to be different...spent a lot of time ..couldn't get it right.
This is my FiboBean class
My ComputeServlet
my ejb-jar.xml
my application.xml
my jboss.xml
my web.xml
i followed the tutorial step by step...but still have a problem
Please help!
softjack
everything was fine until i tried to deployed the created ear file to jboss 4.0.3.
I getting the error message
Code:
14:42:17,201 WARN [verifier] EJB spec violation:
Bean : Fibo
Section: 22.2
Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element.
Info : Class not found on 'ejb.tutorial.FiboBean': No ClassLoaders found for: ejb.tutorial.FiboBean
14:42:17,201 ERROR [MainDeployer] Could not create deployment: file:/C:/jboss-4.0.3SP1/server/default/tmp/deploy/tmp27125FiboApp.ear-contents/FiboEJB.jar
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
a similar problem is mentioned in thread197-819238, but here the problem appear to be different...spent a lot of time ..couldn't get it right.
This is my FiboBean class
Code:
package ejb.tutorial;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
/**
* @ejb.bean name ="Fibo"
* display-name="Fibo EJB"
* description ="Ejb that computes Fibonacci suite"
* view-type="remote"
* jndi-name="ejb/tutorial/Fibo"
*/
public class FiboBean implements SessionBean {
/**
*
*/
public FiboBean() {
super();
// TODO Auto-generated constructor stub
}
public void setSessionContext(SessionContext arg0) throws EJBException,
RemoteException {
// TODO Auto-generated method stub
}
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/**
* Default create method
* @throws CreateException
* @ejb.create-method
*
*/
public void ejbCreate() throws javax.ejb.CreateException{}
/**
* @name compute
* @param number
* @return double[]
*
* @ejb.interface-method view-type="remote"
*/
public double[] compute(int number){
if (number<0){
throw new EJBException("Argument should be positive");
}
double[] suite =new double[number+1];
suite[0]=0;
if(number==0){
return suite;
}
suite[1]=1;
for(int i=2;i<=number;i++){
suite[i]=suite[i-1]+suite[i-2];
}
return suite;
}
}
My ComputeServlet
Code:
package tutorial.web;
import java.io.IOException;
import java.io.PrintWriter;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ejb.tutorial.Fibo;
import ejb.tutorial.FiboHome;
/**
*
*
* @author fr3794
*
* @web.servlet name ="ComputeServlet"
* display-name ="Computation Servlet"
* description ="Servlet that generates fibonacci code"
*
* @web.servlet-mapping url-pattern ="/Compute"
*
*
* @web.env-entry name="Title"
* type="java.lang.String"
* value ="Fibonacci Computation"
* description="example"
*
* @web.ejb-ref name="ejb/Fibo"
* type="Session"
* home="tutorial.interfaces.FiboHome"
* remote="tutorial.interfaces.Fibo"
* description="reference to fibo ejb"
*
*
* @jboss.ejb-ref-jndi ref-name ="ejb/Fibo"
* jndi-name ="ejb/tutorial/Fibo"
*
*
*/
public class ComputeServlet extends HttpServlet {
/**
*
*/
private FiboHome home;
private String value;
public ComputeServlet() {
super();
// TODO Auto-generated constructor stub
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><head><title>");
out.println(value);
out.println("</title></head>");
out.println("<body>");
out.println("<h1>");
out.println(value);
out.println("</h1>");
try{
Fibo bean= home.create();
int limit=0;
String value = request.getParameter("limit");
if(value!=null)
{
try{
limit=Integer.parseInt(value);
}catch(Exception e){}
}
double[] result = bean.compute(limit);
bean.remove();
out.println("<P>");
out.print("The ");
out.print(limit);
out.print(" first fibonacci no's");
for(int i=0;i<=result.length;i++ ){
out.println("<BR>");
out.print(i);
out.print(" : ");
out.println(result[i]);
}
out.println("</P>");
}catch(Exception e){
out.println(e.getMessage());
e.printStackTrace(out);
}
finally{
out.println("</body></html>");
out.close();
}
}
public void init() throws ServletException {
// TODO Auto-generated method stub
try{
Context context= new InitialContext();
value=(String) context.lookup("java:/comp/env/Title");
Object ref =context.lookup("java:/comp/env/ejb/Fibo");
home = (FiboHome) PortableRemoteObject.narrow(ref,FiboHome.class );
}
catch(Exception e){
throw new ServletException("Look up of java:/comp/env/ failed");
}
}
}
my ejb-jar.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "[URL unfurl="true"]http://java.sun.com/dtd/ejb-jar_2_0.dtd">[/URL]
<ejb-jar >
<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session>
<description><![CDATA[Ejb that computes Fibonacci suite]]></description>
<display-name>Fibo EJB</display-name>
<ejb-name>Fibo</ejb-name>
<home>ejb.tutorial.FiboHome</home>
<remote>ejb.tutorial.Fibo</remote>
<ejb-class>ejb.tutorial.FiboBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<!--
To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<!--
To specify your own assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->
<assembly-descriptor >
<!--
To specify additional security-role elements, add a file in the merge
directory called ejb-security-roles.xml that contains them.
-->
<!-- method permissions -->
<!--
To specify additional method-permission elements, add a file in the merge
directory called ejb-method-permissions.ent that contains them.
-->
<!-- transactions -->
<!--
To specify additional container-transaction elements, add a file in the merge
directory called ejb-container-transactions.ent that contains them.
-->
<!-- finder transactions -->
<!-- message destinations -->
<!--
To specify additional message-destination elements, add a file in the merge
directory called ejb-message-destinations.ent that contains them.
-->
<!-- exclude list -->
<!--
To specify an exclude-list element, add a file in the merge directory
called ejb-exclude-list.xml that contains it.
-->
</assembly-descriptor>
</ejb-jar>
my application.xml
Code:
<!DOCTYPE application PUBLIC "-//Sun Microsystems,
Inc.//DTD J2EE Application 1.2//EN"
"[URL unfurl="true"]http://java.sun.com/j2ee/dtds/application_1_2.dtd">[/URL]
<application>
<display-name>Sun Application</display-name>
<module>
<ejb>FiboEJB.jar</ejb>
</module>
<module>
<web>
<web-uri>FiboWeb.war</web-uri>
<context-root>/fibo</context-root>
</web>
</module>
</application>
my jboss.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 2.4//EN" "[URL unfurl="true"]http://www.jboss.org/j2ee/dtd/jboss_2_4.dtd">[/URL]
<jboss>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jboss-beans.xml that contains
the <session></session>, <entity></entity> and <message-driven></message-driven>
markup for those beans.
-->
<session>
<ejb-name>Fibo</ejb-name>
<jndi-name>ejb/tutorial/Fibo</jndi-name>
</session>
<!--
write a merge file jboss-webservices.ent for webservice-description
-->
</enterprise-beans>
<resource-managers>
</resource-managers>
<!--
| for container settings, you can merge in jboss-container.xml
| this can contain <invoker-proxy-bindings/> and <container-configurations/>
-->
</jboss>
my web.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "[URL unfurl="true"]http://java.sun.com/dtd/web-app_2_3.dtd">[/URL]
<web-app >
<distributable/>
<!--
To use non XDoclet filters, create a filters.xml file that
contains the additional filters (eg Sitemesh) and place it in your
project's merge dir. Don't include filter-mappings in this file,
include them in a file called filter-mappings.xml and put that in
the same directory.
-->
<!--
To use non XDoclet filter-mappings, create a filter-mappings.xml file that
contains the additional filter-mappings and place it in your
project's merge dir.
-->
<!--
To use non XDoclet listeners, create a listeners.xml file that
contains the additional listeners and place it in your
project's merge dir.
-->
<servlet>
<servlet-name>ComputeServlet</servlet-name>
<display-name>Computation Servlet</display-name>
<description><![CDATA[Servlet that generates fibonacci code]]></description>
<servlet-class>tutorial.web.ComputeServlet</servlet-class>
</servlet>
<!--
To use non XDoclet servlets, create a servlets.xml file that
contains the additional servlets (eg Struts) and place it in your
project's merge dir. Don't include servlet-mappings in this file,
include them in a file called servlet-mappings.xml and put that in
the same directory.
-->
<servlet-mapping>
<servlet-name>ComputeServlet</servlet-name>
<url-pattern>/Compute</url-pattern>
</servlet-mapping>
<!--
To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
Organize mime-mappings.xml following this DTD slice:
<!ELEMENT mime-mapping (extension, mime-type)>
-->
<!--
To specify error pages, create a file named error-pages.xml, put it in your project's mergedir.
Organize error-pages.xml following this DTD slice:
<!ELEMENT error-page ((error-code | exception-type), location)>
-->
<!--
To add taglibs by xml, create a file called taglibs.xml and place it
in your merge dir.
-->
<!--
To set up security settings for your web app, create a file named web-security.xml, put it in your project's mergedir.
Organize web-security.xml following this DTD slice:
<!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)>
<!ELEMENT web-resource-collection (web-resource-name, description?, url-pattern*, http-method*)>
<!ELEMENT web-resource-name (#PCDATA)>
<!ELEMENT url-pattern (#PCDATA)>
<!ELEMENT http-method (#PCDATA)>
<!ELEMENT user-data-constraint (description?, transport-guarantee)>
<!ELEMENT transport-guarantee (#PCDATA)>
<!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>
<!ELEMENT auth-method (#PCDATA)>
<!ELEMENT realm-name (#PCDATA)>
<!ELEMENT form-login-config (form-login-page, form-error-page)>
<!ELEMENT form-login-page (#PCDATA)>
<!ELEMENT form-error-page (#PCDATA)>
-->
<env-entry>
<description><![CDATA[example]]></description>
<env-entry-name>Title</env-entry-name>
<env-entry-value>Fibonacci Computation</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
<ejb-ref >
<description><![CDATA[reference to fibo ejb]]></description>
<ejb-ref-name>ejb/Fibo</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>tutorial.interfaces.FiboHome</home>
<remote>tutorial.interfaces.Fibo</remote>
</ejb-ref>
</web-app>
i followed the tutorial step by step...but still have a problem
Please help!
softjack