[EJB 3.0] - EJB3: StandardWrapper.Throwable
by rotten_ritz
I am new to EJB developmet, so i started off by writing a simple session bean which just returns a string. And I have a servlet which displays the returned string.
I followed a tutorial and came up with the following files.
TestStateless.java
package com.j3ltd.test.ejbs;
import javax.ejb.Remote;
@Remote
public interface TestStateless {
public String testBean();
}
TestStatelessBean.java
package com.j3ltd.test.ejbs;
import javax.ejb.Stateless;
import com.j3ltd.test.ejbs.TestStateless;
public @Stateless class TestStatelessBean implements TestStateless {
public String testBean() {
return "the server returned this string";
}
}
TestStatelessEJBServlet.java
package com.j3ltd.test.web;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.naming.*;
import java.io.*;
import com.j3ltd.test.ejbs.*;
public class TestStatelessEJBServlet extends HttpServlet {
private TestStatelessBean statelessBean;
public void init() {
try {
InitialContext ctx = new InitialContext();
statelessBean = (TestStatelessBean) ctx.lookup("TestStatelessBean/remote");
} catch (NamingException e) {
e.printStackTrace();
}
}
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doGet(req, resp);
}
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
PrintWriter writer = resp.getWriter();
writer.write("The stateless bean returned this string: " + statelessBean.testBean());
}
}
I have bundled the web.xml and the servlet in a .war file and the bean interface and implementation in an .ejb3 file along with jndi.properties file.
when i try accessing the servlet the following is the error. I think theres a problem with the binding of the bean, and the lookup is failing. Im using JBoss 4.2.1 and eclipse 3.1
Can someone help me wid this? the stack trace is
01:48:32,055 INFO [Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 32s:968ms
01:49:24,169 ERROR [[/TestInstallation]] StandardWrapper.Throwable
java.lang.ClassCastException: $Proxy70
at com.j3ltd.test.web.TestStatelessEJBServlet.init(TestStatelessEJBServlet.java:18)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
01:49:24,169 ERROR [[TestStatelessEJBServlet]] Allocate exception for servlet TestStatelessEJBServlet
java.lang.ClassCastException: $Proxy70
at com.j3ltd.test.web.TestStatelessEJBServlet.init(TestStatelessEJBServlet.java:18)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088711#4088711
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088711
18 years, 7 months
[Clustering/JBoss] - Problem with Apache loadbalancer, j_security_check and JBos
by sudeepthi
Hi,
I am using Apache load balancer using mod_jk and Jboss as a application server. Currently in my cluster i configured two Jboss servers which are running on different machines. I am using round-robin load balancer algorithm.
In my application i am using JAAS as a form based authentication. In my clustered configuration the request will be go to the server in round-robin way. I mean that if the first request goes to the first server then the second request goes to the second server and the third request goes to again first server and so on.This configuration is done without sticky session.
Now the problem is if i request for login page, the request is going to first server and the login page is displayed successfully. After entering user name and password if i submit the page, the request is going to the second server and its displaying "HTTP Status 400 - Invalid direct reference to form login page" instead of displaying the home page of my application.
I am using Apache web server 2.2.4, mod_jk 1.2.50 and JBoss 4.0.2 Application server.
Can anybody help me how to solve this issue? I am waiting for your valuable response.
Thanks & Regards,
Sudeepthi
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088710#4088710
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088710
18 years, 7 months
[JBoss jBPM] - Re: Problem using expression language in a process definitio
by sonicfab
Why do I talk about modifying the schema ? Well, I had a look at the jpdl-3.2 schema, and apparently all the objects that can handle EL have a "expression" attribute, whereas objects that can't don't seem to have one.
For example, the action element :
<xs:element name="action">
| <xs:complexType mixed="true">
| <xs:sequence>
| <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
| </xs:sequence>
| <xs:attribute name="class" type="xs:string" />
| <xs:attribute name="config-type" default="field">
| <xs:simpleType>
| <xs:restriction base="xs:string">
| <xs:enumeration value="field"/>
| <xs:enumeration value="bean"/>
| <xs:enumeration value="constructor"/>
| <xs:enumeration value="configuration-property"/>
| </xs:restriction>
| </xs:simpleType>
| </xs:attribute>
| <xs:attribute name="name" type="xs:string" />
| <xs:attribute name="ref-name" type="xs:string" />
| <xs:attribute name="accept-propagated-events" type="booleanType" default="true" />
| <xs:attribute name="expression" type="xs:string" />
| <xs:attribute name="async" type="xs:string" />
| </xs:complexType>
| </xs:element>
Whereas for example for the timer element :
<xs:element name="timer">
| <xs:complexType>
| <xs:choice minOccurs="0">
| <xs:element ref="action"/>
| <xs:element ref="script"/>
| </xs:choice>
| <xs:attribute name="duedate" type="xs:string" use="required" />
| <xs:attribute name="name" type="xs:string" />
| <xs:attribute name="repeat" type="xs:string" />
| <xs:attribute name="transition" type="xs:string" />
| </xs:complexType>
| </xs:element>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088698#4088698
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088698
18 years, 7 months