Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials

Core Java
JSP
Servlet
JDBC
Hibernate
Struts 1
Struts 2
JSF
Spring
J2EE
J2ME
Web Services
Ajax
Dojo
MySQL
Latest Comments
user understand pr
Struts iterator/se
Java Sms
I will Appreciate
web services
  All Comments...
 

 

 
Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*tiles-defs.xml
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
*AGGREGATING ACTIONS
*Internationalization
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Alternative
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Struts Reference
*Struts Resources
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Jboss Sessionbeanservlet

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

25 comments so far (post your own) View All Comments Latest 10 Comments:

21:38:18,989 INFO [EARDeployer] Started J2EE application: file:/misc/lantana3/prjstaff/deepti/JBOSS_HOME/jboss-4.0.5.GA/server/default/deploy/example3.ear
21:43:48,828 ERROR [LogInterceptor] EJBException in method: public abstract test.session.MyTestSession test.session.MyTestSessionHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException:
javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract test.session.MyTestSession test.session.MyTestSessionHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invokeHome(StatelessSessionContainer.java:175)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:189)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:98)
at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:637)
at org.jboss.ejb.Container.invoke(Container.java:975)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy67.create(Unknown Source)
at test.session.SessionTestServlet.doGet(SessionTestServlet.java:47)
...
...
...
The http://localhost:8080/example3/servlet/test does not give the text "Hello I am session Bean"
Can you please help me with the error. I cant understand whats gone wrong.

what is solution for using different ear and war files

Posted by nilesh on Saturday, 08.9.08 @ 10:57am | #71849

Hi, my name is Adhie, I have the same problems with "dk" that listed below:

[LogInterceptor] EJBException in method: public abstract test.session.MyTestSession test.session.MyTestSessionHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException:
javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract test.session.MyTestSession test.session.MyTestSessionHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException

can you help me with this? I really need the guide for my graduated, thank you before.

Best regards,


Adhie

Posted by Adhie on Sunday, 04.27.08 @ 14:37pm | #57986

[LogInterceptor] EJBException in method: public abstract test.session.MyTestSession test.session.MyTestSessionHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException:
javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract test.session.MyTestSession test.session.MyTestSessionHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException

Posted by adri on Sunday, 04.27.08 @ 12:50pm | #57983

The tutorial is good indeed but I receive a class cast exception error while running JBoss. This happens in the init method of the SessionTestServlet
class while obtaining for a home reference. Please help to get around this problem.

Posted by Kaushik on Thursday, 02.21.08 @ 17:37pm | #49317


First i amtelling thanks to you.

But one error is there but i am not able to rectify it.

The error is class cast exception is occur when I create Home object in client.

please tell one solution to me.

once again Thanks for your nice effort.

regards
Sree Visveswaran
Banglore

Posted by visu on Friday, 12.7.07 @ 18:15pm | #41551

had to follow the steps mentioned in the comments though of manually deleting the files from the war folder and then running ant again to regenerate ear file. and for some reason the method name is starting with a capital letter..

Posted by vipin on Tuesday, 09.4.07 @ 10:11am | #24961

Thanks for the info Anthony (Posted by Anthony James on Tuesday, 03.27.07 @ 01:46am | #12754)

I followed your comments and it resolved my problem. I also had to manually delete the class files from the war directory.

Posted by Daz on Monday, 08.20.07 @ 12:30pm | #23763

example is very good but here u should mention the directory structure for this example otherwise its very difficult for newcomer to understand n deploy it.kindly reply me n tell me the directory structure.
thanks

Posted by Pinky on Wednesday, 07.18.07 @ 14:57pm | #21496

Hi Dear,
Very -very fantastic material which help the guys.

Posted by deepti on Thursday, 05.31.07 @ 19:07pm | #17867

21:38:18,989 INFO [EARDeployer] Started J2EE application: file:/misc/lantana3/prjstaff/deepti/JBOSS_HOME/jboss-4.0.5.GA/server/default/deploy/example3.ear
21:43:48,828 ERROR [LogInterceptor] EJBException in method: public abstract test.session.MyTestSession test.session.MyTestSessionHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException:
javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract test.session.MyTestSession test.session.MyTestSessionHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invokeHome(StatelessSessionContainer.java:175)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:189)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:98)
at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:637)
at org.jboss.ejb.Container.invoke(Container.java:975)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy67.create(Unknown Source)
at test.session.SessionTestServlet.doGet(SessionTestServlet.java:47)
...
...
...
The http://localhost:8080/example3/servlet/test does not give the text "Hello I am session Bean"
Can you please help me with the error. I cant understand whats gone wrong.

Posted by dk on Wednesday, 05.23.07 @ 22:24pm | #17110

hi frnd
i try to do a simple session bean to add two numbers...my client pgm is a simple java pgm...jboss 3.2.6......i got a exception ......
plse give a solution.......
This is my Exception....
-------------------------------------------------
Exception in getting home interfacejavax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at myClient.main(myClient.java:17)
-------------------------------------------------
This is my client pgm....
-------------------------------------------------
import java.util.*;
import javax.rmi.*;
import javax.naming.*;



public class AddClient
{
public static void main(String arg[])
{
try
{


Context ctx=new InitialContext();
Object ref=ctx.lookup("Add");
AddHome home=(AddHome)PortableRemoteObject.narrow(ref,AddHome.class);
Add ejb=home.create(10,20);
int result=ejb.add();
System.out.println("Result is:"+result);
ejb.setNumber1(10);
ejb.setNumber2(12);
System.out.println("Result is:"+ejb.add());
} catch(javax.naming.NamingException ne)

{
System.out.println("Exception in getting home interface");
ne.printStackTrace();
}

catch(java.rmi.RemoteException re)
{
System.out.println("Remote Exception");
re.printStackTrace();
}
catch(javax.ejb.CreateException ce)
{
System.out.println("Exception while creating the bean instance");
ce.printStackTrace();
} catch(Exception e)
{
System.out.println("Other Exceptions");
e.printStackTrace();
}
}
}

Posted by Renjith.v.r on Wednesday, 04.18.07 @ 14:19pm | #14492

It was very useful.I got the resultas
Servlet Calling Session Bean

Go to Home

I dont get the Hello message. And I see the null pointer excpetion in the jboss screen.

java.lang.NullPointerException
at test.session.SessionTestServlet.doGet(SessionTestServlet.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

When i copied to Jboss: IT was giving error. Classcast exception. I need help

Posted by gayathri on Monday, 04.16.07 @ 16:12pm | #14334

Hi,
Your service is very good.I had a very long time problem.but nobody understand my problem clearly.I want to create a session bean,which is stateless and
local.It must be accessed by a main method class within from the same project.I use sun java 8.2 with net beans IDE 5.0.but i got NameNotFoundException even I set environmental properties to the initial context constructor.I have given my client program.please help me to relieve from this problem.

my client program:-


package client;
/*
* HelloClient.java
*
* Created on January 27, 2007, 8:37 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
import hello.*;
import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import javax.ejb.*;
import java.util.*;
/**
*
* @author Administrator
*/
public class HelloClient {

/** Creates a new instance of HelloClient */
public HelloClient() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try
{
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
p.put(Context.PROVIDER_URL,"file:///localhost:3700/kramesh-java/ejb/Hello-EJB"); //1099
Context context = new InitialContext(p);
Context ctx=(Context)context.lookup("java:/comp/env");
Object o=ctx.lookup("ejb/HelloLocalHome");
System.out.println("home object has been brought");
HelloLocalHome home=(HelloLocalHome)o;
HelloLocal advice=home.create();
System.out.println(advice.sayHello());
}
catch(Exception ex)
{
ex.printStackTrace();
}
}

}


I have created a simple method sayHello() that returns "hello" as String message.


the error i got is as follows


init:

deps-jar:

compile-single:

run-main:

javax.naming.NameNotFoundException; remaining name 'E:\localhost:3700\kramesh-java\ejb\Hello-EJB'

at com.sun.jndi.fscontext.FSContext.checkExists(FSContext.java:850)

at com.sun.jndi.fscontext.FSContext.checkIsDirectory(FSContext.java:883)

at com.sun.jndi.fscontext.FSContext.<init>(FSContext.java:108)

at com.sun.jndi.fscontext.FSContext.<init>(FSContext.java:81)

at com.sun.jndi.fscontext.RefFSContext.<init>(RefFSContext.java:97)

at com.sun.jndi.fscontext.RefFSContextFactory.createContext(RefFSContextFactory.java:42)

at com.sun.jndi.fscontext.RefFSContextFactory.createContextAux(RefFSContextFactory.java:47)

at com.sun.jndi.fscontext.FSContextFactory.getInitialContext(FSContextFactory.java:49)

at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)

at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)

at javax.naming.InitialContext.init(InitialContext.java:219)

at javax.naming.InitialContext.<init>(InitialContext.java:195)

at client.HelloClient.main(HelloClient.java:36)

BUILD SUCCESSFUL (total time: 3 seconds)

Posted by Ramesh RK on Thursday, 04.5.07 @ 20:33pm | #13423

as Longxing mentions, the ClassCast errors are due to duplicate EJB classes. Basically, you do not need the EJB classes in your WAR file since they are in the JAR already (at least this is the case for JBoss 4.0.5). I was able to get this example working by commenting out one task within the ant file.

The line to remove is the first 'copy' task in the target named "buildWar". It copies the classes into the War (what we want to avoid).

It looks like this:

<copy todir="${warDir}/WEB-INF/classes">
<fileset dir="${classdir}" includes="**/*.class" />
</copy>


comment it out and the example should work.

cheers,
AJ

Posted by Anthony James on Tuesday, 03.27.07 @ 01:46am | #12754

The deploy description files (jboss.xml, ejb-jar.xml) format are different in jboss 3.x and jboss 4.x, so you got the exception.

Posted by jason on Thursday, 03.22.07 @ 00:27am | #12435

hi,
Im using JBoss-4.0.5. and I have used the same code but im getting the "ClassCastException" at these lines:
/*--------------*/

Object objref = ctx.lookup("ejb/test/MyTestSessionBean");
testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref, MyTestSessionHome.class);

/*--------------*/

so later i changed the code as following, but i was getting "javax.naming.NameNotFoundException"
/*--------------*/
Object objref =
ctx.lookup("java:comp/env/ejb/test/MyTestSession");
testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref, MyTestSessionHome.class);
/*--------------*/
Could you please help me in this.

Posted by Hari on Tuesday, 03.13.07 @ 10:28am | #11565

in my client file can compile but while run it shows below exception i m not use any like servlet etc only in java file plz can u help me wht i'll do for correct thest problems

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">

<jboss>

<enterprise-beans>

<session>
<ejb-name>test/MyTestSession</ejb-name>
<jndi-name>ejb/test/MyTestSessionBean</jndi-name>
</session>

</enterprise-beans>

<resource-managers>
</resource-managers>

</jboss>

Posted by Khan on Saturday, 03.10.07 @ 13:02pm | #11311

i understand,but canu explain each line of this code .


InitialContext ctx = new InitialContext();
Object objref = ctx.lookup("ejb/test/MyTestSessionBean");
testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref, MyTestSessionHome.class);

Posted by shivaji on Wednesday, 02.28.07 @ 12:05pm | #9934

hi, deepak its really nice and simple to understand the basic concepts...


Regards
Vittal

Posted by vittalkambagi on Monday, 02.5.07 @ 11:37am | #6126

Hello Deepak,

Your tutorial is very good,easy to understand. But I am getting the same screen as like reported by Lobo in the previous message.
Servlet Calling Session Bean

Go to Home

I dont get the Hello message. And I see the null pointer excpetion in the jboss screen.

java.lang.NullPointerException
at test.session.SessionTestServlet.doGet(SessionTestServlet.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:66
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)

can anyone help me to solve this error?

Thanks in advance.

regards,
brintha

Posted by brintha on Wednesday, 01.31.07 @ 18:34pm | #4945

This is really nice tutorial though it requires little more detail for newbie kind of people but anyway anything is better than nothing

Lobo This Session bean will only show a message in the JBoss Window and not show any special thing in the browser

Bye for now

CSJakharia

Posted by CSJakharia on Thursday, 01.18.07 @ 18:15pm | #3777

I am getting the below error in Tomcat Webserver
------------------------------------------------
javax.naming.NoInitialContextException: Need to specify class name in environme
t or system property, or as an applet parameter, or in an application resource
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:
40)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:24
)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.ja
a:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at test.session.SessionTestServlet.init(SessionTestServlet.java:17)
at org.apache.tomcat.facade.ServletHandler.doInit(ServletHandler.java:3
6)
at org.apache.tomcat.facade.ServletHandler.init(ServletHandler.java:227

at org.apache.tomcat.facade.LoadOnStartupInterceptor.contextInit(LoadOn
tartupInterceptor.java:98)
at org.apache.tomcat.core.Context.init(Context.java:498)
at org.apache.tomcat.core.ContextManager.init(ContextManager.java:554)
at org.apache.tomcat.startup.EmbededTomcat.initContextManager(EmbededTo
cat.java:625)
at org.apache.tomcat.startup.EmbededTomcat.execute1(EmbededTomcat.java:
91)
at org.apache.tomcat.startup.EmbededTomcat$1.run(EmbededTomcat.java:775

at org.apache.tomcat.util.compat.Jdk12Support$PrivilegedProxy.run(Jdk12
upport.java:166)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.tomcat.util.compat.Jdk12Support.doPrivileged(Jdk12Support
java:76)
at org.apache.tomcat.startup.EmbededTomcat.execute(EmbededTomcat.java:7
3)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.tomcat.util.IntrospectionUtils.execute(IntrospectionUtils
java:52)
at org.apache.tomcat.startup.Main.execute(Main.java:272)
at org.apache.tomcat.startup.Main.main(Main.java:98)

Posted by dramil dodeja on Thursday, 01.18.07 @ 16:43pm | #3766

Hello Deepak,

Your article on EJB development and deployment is very good, simple and easy to understand for the beginers like me. I tried program in part-3 (Hello world using EJB and Servlet). I am getting "ClassCastException" on the line: "testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref,MyTestSessionHome.class);". I tried a lot to get the program right but couldn't get it. I referred some books too, they also say the same thing as you.

Analysis of objref shows, though it implements MyTestSessionHome, is not an instance of later, but it's an instance of EJBHome. Actually both must be true.

I am using JBoss server 4.0.4

Please reply urgently...

THANK YOU.
Lalit.

Posted by lalit on Saturday, 12.30.06 @ 23:46pm | #2281

I saw the similar error posted by Lobo, I used JBoss 4.0.5.GA. I did some research, and found the reason of the failure, it's dicussed is in this thread,
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=96719

I tried the solution 1 in the thread, removing the dup interfaces from the war file. With my change, the example3.war contains only one class file, SessionTestServlet.class. Then redeployed the application, and it run successfully.

By the way, the build.xml needs to be changed to include some client jars (from the client directory of the jboss installation) in order to build.

Posted by Longxing Deng on Wednesday, 12.27.06 @ 00:20am | #2070

I did everything as per your instructions on this page, the only difference is that I'm using jboss 4.0.5.

No errors are is reported when ant is building the project, but when I browse http://localhost:8080/example3/servlet/test I see only the following:

Servlet Calling Session Bean

Go to Home

Posted by Lobo on Monday, 12.11.06 @ 21:47pm | #856

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.