Session EJB REST/JSON annotations....?
We are building a highly graphical, javascript-heavy application presently and require access to session EJB's. Access with SOAP based web services will be too heavy for the browser as we have quite a lot of data being passed to and fro. We really need to exchange data with the EJB tier using REST based web services and JSON strings. Is there an easy way to do this in a similar manner to what can be achieved with JAX based SOAP Web Services using annotations in jDeveloper 11.1.1.2? ...this would be ideal.
If not then does anyone have any experience developing a similar architecture and know which libraries are the easiest to vertically integrate into the jDeveloper SessionEJB stack. We are using JPA entity beans underlying this and would like to keep that architecture for persistence.
Thanks in advance.
Thanks for the feedback... interesting articles.
Did a bit of research and this approach seems to be the way to go for us although we cannot leverage the SOAP WS tier we have already: http://www.restlet.org/
What I am probably going to do is just write a RESTful service tier for the heavy parts of the application and bolt it down to the Entity Beans using JPQL.
Similar Messages
-
Transaction rollback in stateless session EJB 3.0
Hello everyone !
I have a stateless session EJB as per 3.0 spec.
/*Remote Interface*/
package com.nseit.ncfm2.data.ejb;
import java.sql.SQLException;
import java.util.Collection;
import javax.ejb.Remote;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.naming.NamingException;
import com.nseit.ncfm2.security.Audit;
@Remote
public interface ProductionDataChangesRequestsRemote {
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public boolean shiftCandidateDetails(String sourceNcfmId,
String destinationNcfmId, Collection<String> specialCasesList, String shiftingRemarks, String user, Audit updtAudit) throws NamingException, SQLException;
/*Bean Class*/
package com.nseit.ncfm2.data.ejb;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import javax.naming.NamingException;
import com.nseit.ncfm2.security.Audit;
import com.nseit.ncfm2.util.server.lookup.LookUpServerResources;
import java.sql.*;
import java.util.*;
* Session Bean implementation class ProductionDataChangesRequestsBean
@Stateless(name = "ProductionDataChangesRequestsBean", mappedName = "ProductionDataChangesRequestsEJB")
@Remote(ProductionDataChangesRequestsRemote.class)
@TransactionManagement(TransactionManagementType.CONTAINER)
public class ProductionDataChangesRequestsBean implements
ProductionDataChangesRequestsRemote {
* Default constructor.
public ProductionDataChangesRequestsBean() {
// TODO Auto-generated constructor stub
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public boolean shiftCandidateDetails(String sourceNcfmId,
String destinationNcfmId, Collection<String> specialCasesList,
String shiftingRemarks, String user, Audit updtAudit)
throws NamingException, SQLException {
// TODO Auto-generated method stub
Connection conn = null;
PreparedStatement pstmt = null;
int updtCnt = 0;
boolean areDetailsShifted = false;
try {
/* Start: update table-1 */
updtCnt = pstmt.executeUpdate();
/* End: update table-1 */
/* Start: update table-2 */
updtCnt = pstmt.executeUpdate();
/* End: update table-2 */
areDetailsShifted = true;
} /*catch (SQLException e) {
// TODO Auto-generated catch block
System.out
.println("SQLException in ProductionDataChangesRequestsBean.shiftCandidateDetails(...) "
+ e.getMessage());
// e.printStackTrace();
context.setRollbackOnly();
} */finally {
LookUpServerResources.closeStatement(pstmt);
LookUpServerResources.closeConnection(conn);
return areDetailsShifted;
Currently,if the 1st table update succeeds and the 2nd table update gives an exception,a rollback is not taking place i.e records in 1st table are updated.
I want the transaction to be rolled back in case an SQLException occurs(or for that matter,any runtime exception occurs).
I tried two approaches :
i: Use of context.setRollbackOnly() in catch block for SQLException
ii:Throwing the SQLException
In both the cases, the transaction didn't roll back.
How can I achieve this :
i: Without the usage of @ApplicationException annotation(as I do not have any application exceptions)
ii: Without catching the SQLException and then calling context.setRollbackOnly()
Or what is the standard way?
Thanks !Where is your connection object coming from?
-
Session EJB - NoClassDefFoundError PipelineComponentSupport
Hello All
I have a simple PipelineComponent that is built as a stateless session EJB. It
is jar'd up and placed within the portal directory (with the rest of the jars).
I have added the entry to the META-INF/application.xml file and targeted the
EJB from within the weblogic console (can see the entry within the config.xml
file).
But when I start the portal server I get the NoClassDefFoundError for the class
PipelineComponentSupport. And of course my portlets that use the PipelineComponent
don't work. Why am I getting this error?
If I redploy the EJB from within the weblogic console after startup, everything
works fine. No errors or stack traces and the portlets work fine.
So: Why do I get a NoClassDefFoundError during startup, but not during redeploy?
How can I deploy the EJBs during startup correctly?
Thanks in advance.
ps - I saw the other thread about PipelineComponentSupport and noticed that it
did not apply since they were talking about a PipelineComponent as a java class,
not an EJB.Chris,
It sounds like you need to place the JAR containing PipelineComponentSupport
in your new JAR's manifest (under the classpath entry). Open up one of our
JARs for an example. This tells the application server what your JARs
dependencies are. All this is standard J2EE/SE.
Sincerely,
Daniel Selman
"Chris McGinnis" <[email protected]> wrote in message
news:[email protected]..
>
Hello All
I have a simple PipelineComponent that is built as a stateless sessionEJB. It
is jar'd up and placed within the portal directory (with the rest of thejars).
I have added the entry to the META-INF/application.xml file and targetedthe
EJB from within the weblogic console (can see the entry within theconfig.xml
file).
But when I start the portal server I get the NoClassDefFoundError for theclass
PipelineComponentSupport. And of course my portlets that use thePipelineComponent
don't work. Why am I getting this error?
If I redploy the EJB from within the weblogic console after startup,everything
works fine. No errors or stack traces and the portlets work fine.
So: Why do I get a NoClassDefFoundError during startup, but not duringredeploy?
How can I deploy the EJBs during startup correctly?
Thanks in advance.
ps - I saw the other thread about PipelineComponentSupport and noticedthat it
did not apply since they were talking about a PipelineComponent as a javaclass,
not an EJB. -
Problems integrating JSF managed bean with Session EJB with JDeveloper
HI All,
I am developeing a JSF-EJB application using Jdeveloper11g. On deploying the application I am getting the following errors on deployment.
<19/08/2010 2:53:49 PM EST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1282193629318' for task '17'. Error is: 'weblogic.application.ModuleException: Could not setup environment'
weblogic.application.ModuleException: Could not setup environment
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
Truncated. see log file for complete stacktrace
Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'MetaDataBean' declared in the ejb-ref or ejb-local-ref 'MetaData' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:453)
at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
Truncated. see log file for complete stacktrace
>
<19/08/2010 2:53:49 PM EST> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 1 task for the application 'data-catalog'.>
<19/08/2010 2:53:49 PM EST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'data-catalog'.>
<19/08/2010 2:53:49 PM EST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: Could not setup environment
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
Truncated. see log file for complete stacktrace
Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'MetaDataBean' declared in the ejb-ref or ejb-local-ref 'MetaData' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:453)
at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
Truncated. see log file for complete stacktrace
Thanks
Edited by: user5108636 on 18/08/2010 22:46Please find attached the source code of JSF managed bean, local business interface, session bean and web.xml
MANAGED BEAN_
package view.backing;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.component.UISelectItems;
import javax.faces.component.html.HtmlSelectManyListbox;
import model.ejb.session.MetaDataBean;
public class SearchMetaDataBean {
@EJB MetaDataBean metaDataService;
private List<String> tables;
private List<String> columns;
private HtmlSelectManyListbox selectManyListbox1;
private UISelectItems selectItems1;
public void setTables(List<String> tables) {
this.tables = tables;
public List<String> getTables() {
return metaDataService.getTables();
public void setColumns(List<String> columns) {
this.columns = columns;
public List<String> getColumns() {
return columns;
public void setSelectManyListbox1(HtmlSelectManyListbox selectManyListbox1) {
this.selectManyListbox1 = selectManyListbox1;
public HtmlSelectManyListbox getSelectManyListbox1() {
return selectManyListbox1;
public void setSelectItems1(UISelectItems selectItems1) {
this.selectItems1 = selectItems1;
public UISelectItems getSelectItems1() {
return selectItems1;
LOCAL INTERFACE_
package model.ejb.session;
import java.util.List;
import javax.ejb.Local;
@Local
public interface MetaDataLocal {
public List<String> getTables();
public List<String> getColumns(String tableName);
SESSION BEAN_
package model.ejb.session;
import javax.ejb.Local;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.sql.DataSource;
@Stateless(name="MetaData")
@Local
public class MetaDataBean implements MetaDataLocal{
@Resource(name="jdbc/DWDS")
private DataSource dataSource;
private Connection connection;
private List<String> tables = new ArrayList<String>();
private List<String> columns = new ArrayList<String>();
private DatabaseMetaData dmd;
@PostConstruct
public void initialize(){
try{
connection = dataSource.getConnection();
DatabaseMetaData dmd;
dmd = connection.getMetaData();
}catch(SQLException sqle){
sqle.printStackTrace();
public MetaDataBean() {
public List<String> getTables(){
try{
if (dmd ==null){
//System.out.println("Database meta data not available");
tables.add("None");
}else{
ResultSet rs = dmd.getSchemas();
ResultSet rs1 = null;
while(rs.next()) {
if (rs.getString(1).equalsIgnoreCase("AV_DATA")){
rs1 = dmd.getTables(null,rs.getString(1),"%",null);
while(rs1.next()) {
tables.add(rs1.getString(3));
}catch (SQLException sqle){
sqle.printStackTrace();
return tables;
public List<String> getColumns(String tableName){
try{
ResultSet rsColumns = dmd.getColumns("", "AV_DATA", tableName, null);
while(rsColumns.next()){
columns.add(rsColumns.getString(4));
}catch (SQLException sqle){
sqle.printStackTrace();
return columns;
WEB.XML_
<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<ejb-local-ref>
<ejb-ref-name>MetaData</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>model.ejb.session.MetaDataLocal</local>
<ejb-link>MetaDataBean</ejb-link>
</ejb-local-ref>
</web-app>
Edited by: user5108636 on 18/08/2010 22:45
Edited by: user5108636 on 18/08/2010 22:46 -
Deploy multiple instances of the same stateless session EJB
I have a stateless session bean.
The methods on the bean operate against DB tables.
Q: Can I deploy multiple instances of the same stateless session bean, but specify a different JNDI/datasource name in the deployment descriptor?
The method calls are all enclosed within a single invocation, just that I need to hit different databases (all with the same schema), and Id like to be able to lookup the EJB via a different JNDI name, and have the exact same functionality, just against different deployed datasources.
Does the spec allow/support this?
If not, any suggestions as to how to achieve this sort of functionality?
Im using JBoss 3.2.1 on Solaris, so Im not sure whether or not this is a JBoss "issue" or a limitation of the EJB Spec (or me being just plain wrong and trying to do something the "wrong way")
NickI have a stateless session bean.
The methods on the bean operate against DB tables.
Q: Can I deploy multiple instances of the same
stateless session bean, but specify a different
JNDI/datasource name in the deployment descriptor?
The method calls are all enclosed within a single
invocation, just that I need to hit different
databases (all with the same schema), and Id like to
be able to lookup the EJB via a different JNDI name,
and have the exact same functionality, just against
different deployed datasources.
Does the spec allow/support this?
If not, any suggestions as to how to achieve this sort
of functionality?
Im using JBoss 3.2.1 on Solaris, so Im not sure
whether or not this is a JBoss "issue" or a limitation
of the EJB Spec (or me being just plain wrong and
trying to do something the "wrong way")
NickI haven't done it but judging from the deployment descriptors yes.
For example if I have two bounded datasources java:/Database1 and java:/Database2
Lets say I have a session bean called MySession, then in your ejb-jar.xml you would have (notice that the desc, display, and ejb-name are the only differences)
<session>
<description>MySessionAlpha</description>
<display-name>MySessionAlpha</display-name>
<ejb-name>MySessionAlpha</ejb-name>
<home>com.mycorp.MySessionRemoteHome</home>
<remote>com.mycorp.MySessionRemote</remote>
<local-home>com.mycorp.MySessionLocalHome</local-home>
<local>com.mycorp.MySessionLocal</local>
<ejb-class>com.mycorp.MySessionFacadeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdbc/DataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
<session>
<description>MySessionBeta</description>
<display-name>MySessionBeta</display-name>
<ejb-name>MySessionBeta</ejb-name>
<home>com.mycorp.MySessionRemoteHome</home>
<remote>com.mycorp.MySessionRemote</remote>
<local-home>com.mycorp.MySessionLocalHome</local-home>
<local>com.mycorp.MySessionLocal</local>
<ejb-class>com.mycorp.MySessionFacadeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdbc/DataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
But now in the jboss.xml, we will have the following elements. What you may notice is that are bound to different remote and local jndi names. But the resource bindings are very different. The res-ref-name stays the same, but the jndi-name are different. I think this will work for you.
<session>
<ejb-name>MySessionAlpha</ejb-name> <jndi-name>ejb/com/mycorp/MySessionAlphaRemoteHome</jndi-name> <local-jndi-name>ejb/com/mycorp/MySessionAlphaLocalHome</local-jndi-name>
<resource-ref>
<res-ref-name>jdbc/datasource</res-ref-name>
<jndi-name>java:/Database1</jndi-name>
</resource-ref>
</session>
<session>
<ejb-name>MySessionBeta</ejb-name> <jndi-name>ejb/com/mycorp/MySessionBetaRemoteHome</jndi-name> <local-jndi-name>ejb/com/mycorp/MySessionBetaLocalHome</local-jndi-name>
<resource-ref>
<res-ref-name>jdbc/datasource</res-ref-name>
<jndi-name>java:/Database2</jndi-name>
</resource-ref>
</session> -
Error during deployment of stateless session EJB using EJB 3.0
having trouble deploying a stateless session bean to app server 10.1.3.1 oc4j container.
deceided to go through oracles demo: How-To Develop a Stateless Session EJB using EJB 3.0 (http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-ejb30-stateless-ejb/doc/how-to-ejb30-stateless-ejb.html).
the demo encounters the same issue. so i assume there is something wrong with the app server set up, and not my source code.
here is the deployment log:
[Jul 1, 2009 11:59:25 AM] Application Deployer for test_ws STARTS.
[Jul 1, 2009 11:59:25 AM] Copy the archive to C:\product\10.1.3.1\OracleAS_1\j2ee\home\applications\test_ws.ear
[Jul 1, 2009 11:59:25 AM] Initialize C:\product\10.1.3.1\OracleAS_1\j2ee\home\applications\test_ws.ear begins...
[Jul 1, 2009 11:59:25 AM] Unpacking test_ws.ear
[Jul 1, 2009 11:59:25 AM] Done unpacking test_ws.ear
[Jul 1, 2009 11:59:25 AM] Initialize C:\product\10.1.3.1\OracleAS_1\j2ee\home\applications\test_ws.ear ends...
[Jul 1, 2009 11:59:25 AM] Starting application : test_ws
[Jul 1, 2009 11:59:25 AM] Initializing ClassLoader(s)
[Jul 1, 2009 11:59:25 AM] Initializing EJB container
[Jul 1, 2009 11:59:25 AM] Loading connector(s)
[Jul 1, 2009 11:59:26 AM] Starting up resource adapters
[Jul 1, 2009 11:59:26 AM] Processing EJB module: ejb30ws-ejb.jar
[Jul 1, 2009 11:59:26 AM] application : test_ws is in failed state
[Jul 1, 2009 11:59:26 AM] Operation failed with error: java.lang.NoClassDefFoundError
the opmn log reveals the same error, but no more detail.
any ideas???
/stuckI am having exactly the same issue. Was this issue resolved? If so, please share the resolution and if not can someone please suggest what could be wrong.
Thanks -
Session ejb 3.0 stateful and same instance
Hello,
I'm using OC4J 10.1.3.3 and EJB 3.0/JSP
In a jsp I do two different lookup for a STATEFUL
session ejb 3.0, and I want two different instances
of the ejb, instead I get the same one...
Please help. Thanks.Hi,
The code for stateful is perfectly fine and working in a normal way. The way you are trying to implement the stateful session bean in your application is wrong.
think of binding the stateful session bean with HttpSession object.
So that you will get a unique stateful session bean object. -
Issue in Consuming Rest/JSON Service from Netweaver gateway system
Hello Experts,
We are trying to consume the Rest/JSON web service from NetWeaver Gateway System.
But we are getting HTTP Communication failure error.
URL: 'http://sgpvmc0031.apac.bosch.com/ActivityManager2/rest/v1/query/employees/amh1sgp/workItems/pending'
The Host system of Serve is a Non-SAP System.
In web browser, it ask for user id and password, by passing them, it provide the response.
Please find my code details.
DATA: lo_http_client TYPE REF TO if_http_client,
lv_service TYPE string,
lv_result TYPE string,
lo_ixml TYPE REF TO if_ixml,
lo_streamfactory TYPE REF TO if_ixml_stream_factory,
lo_istream TYPE REF TO if_ixml_istream,
lo_document TYPE REF TO if_ixml_document,
lo_parser TYPE REF TO if_ixml_parser,
lo_weather_element TYPE REF TO if_ixml_element,
lo_weather_nodes TYPE REF TO if_ixml_node_list,
lo_curr_node TYPE REF TO if_ixml_node,
lv_value TYPE string,
lv_node_length TYPE i,
lv_node_index TYPE i,
* ls_weather TYPE zweather,
lv_node_name TYPE string,
lv_bin type xstring,
lv_node_value TYPE string,
lo_conv type ref to cl_abap_conv_in_ce,
lv_response type string,
l_client type string.
DATA: result_tab TYPE TABLE OF string,
w_result TYPE string .
lv_service = 'http://sgpvmc0031.apac.bosch.com/ActivityManager2/rest/v1/query/employees/amh1sgp/workItems/pending'.
* lv_service = 'https://rb-wam-q.bosch.com/ActivityManager2/rest/v1/query/employees/amh1sgp/workItems/pending'.
*BREAK-POINT.
CALL METHOD CL_HTTP_CLIENT=>CREATE
EXPORTING
HOST = 'sgpvmc0031.apac.bosch.com'
SERVICE = '80'
* PROXY_HOST =
* PROXY_SERVICE =
* SCHEME = SCHEMETYPE_HTTP
* SSL_ID =
* SAP_USERNAME =
* SAP_CLIENT =
IMPORTING
CLIENT = lo_http_client
EXCEPTIONS
ARGUMENT_NOT_FOUND = 1
PLUGIN_NOT_ACTIVE = 2
INTERNAL_ERROR = 3
others = 4
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
lo_http_client->request->set_method( if_http_request=>co_request_method_get ).
lo_http_client->authenticate( username = 'portal' password = 'portal' ).
cl_http_utility=>set_request_uri(
request = lo_http_client->request
uri = '/ActivityManager2/rest/v1/query/employees/amh1sgp/workItems/pending'
call method lo_http_client->request->set_header_field
EXPORTING
name = 'content-type'
value = 'text/plain'.
call method lo_http_client->send( ).
call method lo_http_client->receive( ).
Kindly help us to understand where to check.
Regards,
NitinHi,
Try to test the url in the standard report RSHTTP20.
Regards,
Felipe -
How to call session EJB from EP service in EP 7.0?
Hi,
I am trying to invoke stateless session EJB from my portal service. Both the service and EJB are deployed on the same server which is EP 7.0.
I found [this|http://help.sap.com/saphelp_nw70/helpdata/EN/42/9ddcc9bb211d72e10000000a1553f6/frameset.htm] in SAP help and tried to implement it (added PrivateSharingReference to portalapp.xml and implemented the code), but everytime I try to lookup the session bean and cast it using P4ObjectBroker.narrow() method, I get java.lang.ClassCastException. The object found in JNDI and my portal service have different classloaders, so I suppose this is the problem, but I don't know how to handle it...
Can anyone please help me?
Regards,
TomasHi Satya ,
please go though following blog for used DC concept.
Componentization of Webdynpro Application in CE7.1
In netweaver 7.1 interface controler is abstract and component controller is implementing interface controller so the context data and methods have to be implemented by component controller -
Cluster and Session EJB replication
I have a dedicated Weblogic 5.1 box running with SP 6 serving up JSP and Servlets.
The Servlets do look ups for session EJBs, which are hosted on a separate box behind
a firewall. My question is:
If I implement clustering of the JSP/Servlet Weblogic Instance so that I have four machines in a cluster,
does Weblogic 5.1 or 6.0 replicate the handle to the session EJB's stub only so that in case server 1 crashes,
Server 2 will be able to retrieve a handle to the session EJBs?
Thanks,
Paul Richardson
If the handle is in the HttpSession, then the handle will be replicated. If
the EJB server fails over in WL 5.1, the stateful session EJBs will be lost.
WL 6.0 supports statefull session EJB replication for failover, but I
suggest that you not use it unless you have a specific architectural reason
to.
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"Paul Richardson" <[email protected]> wrote in message
news:[email protected]..
>
> I have a dedicated Weblogic 5.1 box running with SP 6 serving up JSP and
Servlets.
> The Servlets do look ups for session EJBs, which are hosted on a separate
box behind
> a firewall. My question is:
>
> If I implement clustering of the JSP/Servlet Weblogic Instance so that I
have four machines in a cluster,
> does Weblogic 5.1 or 6.0 replicate the handle to the session EJB's stub
only so that in case server 1 crashes,
> Server 2 will be able to retrieve a handle to the session EJBs?
>
>
> Thanks,
> Paul Richardson
-
Stateless session EJBs & "idempotent"
We need to declare a method as "idempotent" to take care of failure inside a
method call, For that to work the code inside should written in such way so
that repeated call to the same method should not give us diffrent result.
But why can't weblogic implement a partial rollback( Just like Oracle's save
point rollback, where you can rollback to certain point within a
transaction).
Because some times it is not possible to code in such a way to get the same
result every time(Incase of fail over)
Thanks
,Stateless session EJBs
Stateless session EJBs can have both a cluster-aware home stub and a
replica-aware EJBObject stub. By default, WebLogic Server provides failover
services for EJB method calls, but only if a failure occurs between method
calls. For example, failover is automatically supported if there is a
failure after a method completes, or if the method fails to connect to a
server. When failures occur while an EJB method is in progress, WebLogic
Server does not automatically failover from one server to another.
This default behavior ensures that database updates within an EJB method are
not "duplicated" due to a failover scenario. For example, if a client calls
a method which increments a value in a datastore and WebLogic Server fails
over to another server before the method completes, the datastore would be
updated twice for the client's single method call.
If methods are written in such a way that repeated calls to the same method
do not cause duplicate updates, the method is said to be "idempotent." For
idempotent methods, WebLogic Server provides the
stateless-bean-methods-are-idempotent deployment property. If you set this
property to "true" in weblogic-ejb-jar.xml, WebLogic Server assumes that the
method is idempotent and will provide failover services for the EJB method,
even if a failure occurs during a method call.
Vishal,
I wouldn't think you would have a problem doing RMI communication from a Entity
Bean - - for instance, when a WLS instance 'hosts' an EJB that communicates to
a different WLS instance that 'hosts' an EJB that communication occurs via RMI.
Chuck Nelson
Developer Relations Engineer
BEA Technical Support -
Web Service-Client for stateful session EJB container
Do you know, how to write a Web Service-Client to connect a stateful session EJB container?
A stateful session EJB container ist created with Web Logic 8.1.
Message was edited by n.t.c at Dec 14, 2004 6:09 AMPedja thanks for reply.
I still dont understand what is wrong with my example.
The first peace of the code i wrote (getting the reference to the remote interface object) works pretty well, and even more it is produced automatically by JDeveloper, so why we cant get a reference to the local interface object the same way?
Certanly we should use the local interface for getting access to the resource functioning under the same local jvm and i think it doesnt metter wich app server we really use wls or oas or others
Thanks. Alex. -
Dear Friends,
This is kind of urgent.I have a very simple question and I need everyone of ur's opinion on something.I was currently wokring on a web based project.The architect of the project designed to use Session and Entity beans.
He asked me to put "Static" methods in the Session EJB to produce generated HTML pages.for example
public ststic String getPage(myBean);
I'd like to hear ur comments on this.
Thanks
JewelIn general, mixing HTML and business logic is not very good practice. EJBs were created in part to separate presentation and business logic (among various other reasons), and this type of design goes against that goal.
What's wrong with using JSPs and controller/proxy JavaBeans to interface with the EJBs and create your presentation HTML? -
Stateful session EJB is deployed on cluster members A and B. Client calls a method
on the bean and the request is routed to server A, then A is shut down. The client's
next method invocation is routed to server B where the bean's state has been replicated.
Server A re-joins the cluster and B is shut down, the request routed to A results
in the following:
java.rmi.NoSuchObjectException: Activation failed with: java.io.StreamCorruptedException:
InputStream does not contain a serialized object
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:33)
at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:43)
at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:54)
at weblogic.ejb20.swap.PassivationUtils.read(PassivationUtils.java:50)
at weblogic.ejb20.swap.ReplicatedMemorySwap.read(ReplicatedMemorySwap.java:111)
at weblogic.ejb20.manager.StatefulSessionManager.getBean(StatefulSessionManager.java:178)
at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessionManager.java:236)
at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:113)
at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject.java:148)
at com.access360.enrole.apps.ejb.organization.SearchManagerBeanEOImpl.findAllPeople(SearchManagerBeanEOImpl.java:644)
at com.access360.enrole.webclient.organization.person.PeopleList.getPeople(PeopleList.java:148)
at com.access360.enrole.webclient.organization.person.PeopleListServlet.constructPeopleListXML(PeopleListServlet.java:284)
at com.access360.enrole.webclient.organization.person.PeopleListServlet.service(PeopleListServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:275)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:183)
at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.forwardToPeopleList(SubmitPersonAddServlet.java:134)
at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.service(SubmitPersonAddServlet.java:114)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1631)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
We are certain that the EJB's entire object graph is Serializable. Any comments on
this failover scenario?
Alex Rodriguez
Software Engineer, Access360
[email protected]
Rajesh,
Thanks for the reply. We are running WL 6.0 SP2 with RP3. We cannot reproduce it
consistently. In your reply you mention "... and EJB handles". Does that refer to
another patch?
As for the code, we will run tests with a scaled down version of the stateful bean
and a simple client servlet. I will post the code asap. The high level call sequence
is: servlet service() -> lookup ejb home -> get cluster aware stub from home -> put
bean handle in http session -> call bean method -> server A goes down -> next call
to the bean -> get handle from replicated http session -> get bean from handle ->
request is routed to server B. java.io.StreamCorruptedException is thrown, sometimes,
when server A re-joins the cluster and a request is routed to it (i.e. server B is
shut-down). One thing I did not mention is that the bean is deployed on server A,
and server A is also the Admin server. We are considering not using the Admin server
to deploy the bean, however, but will add another Managed server.
Will contact support about CR073917: can it be applied to WL 6.0 SP3 with RP3?
Regards,
Alex J. Rodriguez
Rajesh Mirchandani <[email protected]> wrote:
>
>Alex,
>
>Are you able to consitently reproduce this? Could you post your code here?
>
>What version of the Server with Service pack are you using?
>
>If you are using WLS 6.1SP2 and EJB handles contact support and get a patch
>for CR073917.
>
>
>"Alex J. Rodriguez" wrote:
>
>> Stateful session EJB is deployed on cluster members A and B. Client calls
>a method
>> on the bean and the request is routed to server A, then A is shut down.
>The client's
>> next method invocation is routed to server B where the bean's state has
>been replicated.
>> Server A re-joins the cluster and B is shut down, the request routed to
>A results
>> in the following:
>>
>> java.rmi.NoSuchObjectException: Activation failed with: java.io.StreamCorruptedException:
>> InputStream does not contain a serialized object
>> at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
>> at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
>> at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:33)
>> at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:43)
>> at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:54)
>> at weblogic.ejb20.swap.PassivationUtils.read(PassivationUtils.java:50)
>> at weblogic.ejb20.swap.ReplicatedMemorySwap.read(ReplicatedMemorySwap.java:111)
>> at weblogic.ejb20.manager.StatefulSessionManager.getBean(StatefulSessionManager.java:178)
>> at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessionManager.java:236)
>> at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:113)
>> at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject.java:148)
>> at com.access360.enrole.apps.ejb.organization.SearchManagerBeanEOImpl.findAllPeople(SearchManagerBeanEOImpl.java:644)
>> at com.access360.enrole.webclient.organization.person.PeopleList.getPeople(PeopleList.java:148)
>> at com.access360.enrole.webclient.organization.person.PeopleListServlet.constructPeopleListXML(PeopleListServlet.java:284)
>> at com.access360.enrole.webclient.organization.person.PeopleListServlet.service(PeopleListServlet.java:238)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
>> at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:275)
>> at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:183)
>> at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.forwardToPeopleList(SubmitPersonAddServlet.java:134)
>> at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.service(SubmitPersonAddServlet.java:114)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
>> at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
>> at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1631)
>> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
>> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>>
>> We are certain that the EJB's entire object graph is Serializable. Any
>comments on
>> this failover scenario?
>>
>> Alex Rodriguez
>> Software Engineer, Access360
>> [email protected]
>
-
OC4J, Stateful Session EJB, & Session Timeout
In my J2EE applications, I have a user authentication layer whereby when the user is authenticated against our LDAP repository after logging in, a Stateful Session EJB keeps that conversational state with the client at all times until the user logs out whereby the session is invalidated. This way I keep track of the user's authentication at all times throughout the whole session and for every operation performed (JSPs etc) by the user during the session. All this works fine through my implementation of the Session Facade and Business Delegate patterns.
However, if OC4J times out the Session (set to one hour in the <session-config> <session-timeout> parameter of the web.xml), the user cannot re-login and proceed. The user has to close the whole browser and re-start a new browser, then login and proceed.
This is causing us a few problems with the users who are complaining about having to do so. Is there an easy way around this problem?
Regards
DanielCan you try in a different browser and see whether you can duplicate this ?
Is this a problem with browser - cache ?
regards
debu
Maybe you are looking for
-
How do I get my music off of my phone and onto a new desktop...Without my old computer? <Subject Edited by Host>
-
Web Template Nav Block char issue.
Hi folks, We have an issue with one of our web templates. In one of the navigation blocks there are some characteristics, for example, some are like as below. G/L Account Asset Cost Center Order Network WBS Element Cost Center (Accoung string -corre
-
With FF 4.0 I can no longer download Adobe pdf files. At any website when I click the pdf icon something is displayed about a plugin-handler and nothing further happens - there is either no download or the download stops. Sometimes a partial frame of
-
ITunes radio not loading songs
I listen to iTunes radio a lot, now I don't know when it happened but my iTunes radio doesn't load songs, it shows the blue loading bar at 99% but doesn't play the song, only a select few get played. Does this happen to anyone else? and how do I fix
-
Hi, What could be the cause of Runtime error while executing CJ8G? What funny is that if I do a test run, it executes fine, but when I remove it, it gives a runtime error. Error message: MESSAGE (type X) Error analysis