EJB / EE :: Cannot Access Simple Bean Using JBOSS-JNDI

Nov 26, 2014

I'm not able to access my bean class (not an EJB) using a given JNDI name in JBoss 5.0.1, where the same is working in Tommcat 7.0.

META-INF/context.xml
<Context>
<Resource name="test/TestDAO" auth="Container"
type="ws.jndi.MyBeanDAO"
factory="org.apache.naming.factory.BeanFactory"/>

[code]....

View Replies


ADVERTISEMENT

EJB / EE :: Port Asynchronous Bean Support In App Servers Like Weblogic And Jboss

Dec 26, 2013

I need to port asynchronous bean (provided by websphere) support in App servers like weblogic and jboss. Is this feature already part of J2EE specification? Or should I use some other external package to get this feature?If so what are those async bean like features for weblogic and jboss?

View Replies View Related

EJB / EE :: Unable To Access Session Deployed In Weblogic Server From JBOSS

Jan 13, 2009

I am currently trying to access an EJB Session deployed in a Weblogic server from JBOSS.

The client code looks like this :

Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
environment.put(Context.URL_PKG_PREFIXES, "weblogic.jndi.factories");
environment.put(Context.PROVIDER_URL, "t3://<ip>:<port>");
InitialContext context = new InitialContext(environment);
ServiceHome home = (ServiceHome)context.lookup("ejb/Service");

When I run this code from a standalone java program it executes ok, but when I try to run it from an application deployed in JBOSS, the line (5) which creates the InitialContext object throws this Exception :

java.lang.ThreadDeath
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1221)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:696)
weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:742)

[Code]....

In order to be able to use weblogic naming factory I put the archive weblogic-8.1.6.0.jar in jboss's /server/default/lib directory. But I think it has to do with JNDI conflicts between JBOSS and weblogic.

View Replies View Related

JSF :: How To Access Application Scoped Bean From A Scheduled Job

Mar 29, 2015

I am coming from a Seam 2 and ATG background, and working on re-writing an old Seam 2 application using JSF 2 on Tomcat 8. I've run into a snag:

I have an application scoped managed bean, let's call it EMail. It holds a collection of Email objects, and does some other stuff.

I have an IMAPClient, which is currently setup as an application scoped managed bean (mostly to simply configuration, etc...).

I need to call a method on the IMAPClient to go check email every X seconds (let's call it 60 seconds), and add any new email into the Email managed bean's collection of email. In Seam 2 this was easy with the @Asynchronous annotation. In JSF 2 I can't figure out how to do it. I've tried using Quartz, which will happily run my IMAPCheckJob every 60 seconds, but I am so far unable to figure out how the IMAPCheckJob can get access to either the IMAPClient or the EMail beans.. There's no dependency injection into the Quartz Job, and since it's not executing in a HTTP request flow, there's no Faces context available.

It seems like there has to be some way to allow for scheduling and still have access to the benefits of the Application scoped managed bean DI system...

Or do I need to give up and move to JBoss with EJBs and CDI instead of JSF beans?

View Replies View Related

Java EE SDK :: CDI Bean Cannot Access Public Method Of Unmodifiable Collection

Jan 10, 2010

I've got a CDI bean which is a facade for a JPA entity. Such entity has got a many to one relationship with itself and I've got the following method:

public Set<Account> getChildren() {
        return this.children;
}

which is called in a JSF/Facelets page:

<h:commandLink action="#{accountController.destroy}" value="#{bundle.ListAccountDestroyLink}" rendered="#{item.children.size() == 0}"/>I then decided to return an unmodifiable set and changed getChildren() accordingly:
public Set<Account> getChildren() {
        return Collections.unmodifiableSet(children);
}

The page now reports this error:

java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class java.util.Collections$UnmodifiableCollection with modifiers "public"
     at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
     at java.lang.reflect.Method.invoke(Method.java:588)

[Code] ....

javax.el.BeanELResolver is incorrectly failing because it's trying to invoke the size() method using reflection without correctly taking into account the method visibility (which is indeed invokable programmatically). I'm running NetBeans 6.8, Glassfish 3.0 and jdk1.6.0_17.

Is this a bug in BeanELResolver?

View Replies View Related

Access Getter / Setter Of Bean Class Where It Defined As Member In Another Class?

Feb 18, 2014

Class UserAssessBean{
private String username;
private int userid;
private ArrayList<ModuleBean> module;
--{get/set}--

[Code] ....

How can i access the getters/setters of module bean, when it was returned as array list in UserAssessBean?

View Replies View Related

Enterprise JavaBeans :: Calling Singleton Bean From Session Bean Returns NullPointerException

Feb 23, 2013

I am doing this

@Startup
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.CONTAINER)
@Lock(LockType.READ)
public class ResourceBean {

[Code] ....

And I call this singleton bean from a stateless session bean like this

@Stateless
public class ClientBean {
@EJB
ResourceBean resource;

public String create(String r)
{
String res=resource.returnString(r);
return res;
}
}

But resource.returnString(r); gives a org.apache.jasper.JasperException: java.lang.NullPointerException I started the glassfish server in debug mode and found out that "resource" was null. but @PostConstruct in singleton does print which means singleton bean exists.

Can we call singleton beans with no interface in such a way form a session bean? I actually want to acquire instance of singleton bean when a client invokes method in Client bean...

View Replies View Related

JSP / JSTL :: Page Set Bean Variables But Give NullPointerException When Bean Try To Merge In DB

Nov 21, 2013

I'm new to JSP but I've to use it to grab data coming from an external site, pass data to a Bean, write data in a DB and redirect the user to another page. Follow the JSP page.

<%@page import="EJB.getResponse"%>
<%
long paymentID = Long.parseLong(request.getParameter("paymentid"));
String responsecode = "9999";
getResponse g = new getResponse();

[Code] ....
 
This is the bean:

@ManagedBean
@RequestScoped
public class getResponse implements Serializable {
private Long paymentId;
private String result;
private String auth;

[Code] ....
 
On the console I see the prints but I receive the NullPointerException

WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at EJB.getResponse.printData(getResponse.java:72)
at org.apache.jsp.notify_jsp._jspService(notify_jsp.java from :60)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)

[Code] ....

View Replies View Related

NotSerializableException With Basic DataSource In JNDI

May 29, 2014

I am setting up a standalone JNDI and loading a Datasource to the JNDI. DataSource I use is:

org.apache.commons.dbcp.BasicDataSource

The JNDI is set up as follows
 
String detectorHost = InetAddress.getLocalHost().getHostName(); 
System.out.println("detectorHost: " + detectorHost); 
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); 
final NamingBeanImpl namingInfo = new NamingBeanImpl();  namingInfo.start(); 

[Code] ....

I get the following exception

javax.naming.CommunicationException [Root exception is java.io.NotSerializableException: org.apache.commons.dbcp.BasicDataSource]  at org.jnp.interfaces.NamingContext.bind(NamingContext.java:677)  at org.jnp.interfaces.NamingContext.bind(NamingContext.java:611)  at javax.naming.InitialContext.bind(Unknown Source)  at com.lombardrisk.reform.integration.ReformIntegration.createJNDIServer(ReformIntegration.java:93) 

[Code] ....

I don't quite follow why I am getting a NotSerializableException exception, this is a local JNDI in the same JVM and not a remote JNDI. Not sure why this occurs.

View Replies View Related

EJB / EE :: How To Use Remote Interface JNDI Lookup Object

Aug 5, 2014

jboss 7.1.1
EJB 2.1

Though it may seem strange but in one of the application i work on still uses EJB 2.1 entity beans.While looking at the deployment log, seems like each Entity bean is registered using both remote-home and remote interfaces.

java:app/EJBApp/Entity!com.abc.remote.Remote
java:app/EJBApp/Entity!com.abc.remote.RemoteHome

Using the remote-home's JNDI lookup i was able to get the EJBObject proxy and subsequently create and use the entity.But what about the remote interface JNDI lookup ? Reason i am asking is that one needs to create an entity before use it. That said, how to use the object that i get from remote interface JNDI lookup ? Note that the class of the returned object says its "com.sun.proxy.$Proxy13" type.The JNDI location i am using "java:app/EJBApp/Entity!com.abc.remote.Remote"

View Replies View Related

EJB / EE :: Inject DataSource Based On Runtime JNDI Name Variable

Sep 10, 2014

I need to inject a DataSource, but the catch is the JNDI isn't known until Runtime. I was hoping the EJB could get a System Property of the JNDI name and use that to Inject the DataSource.

For example:

@Resource(name=myRuntimeJNDIName)
DataSource myDataSource;

And I could either @Inject or on postContstruct() set the myRuntimeJNDI variable to the JNDI name that is configured on the App Server via System Properties or some other mechanism. But the JNDI may be different depending on what environment the application is deployed to.

Is this possible? I would like to have the same EAR deployed in all our environments and not have to create a different version of the application for each environment.

View Replies View Related

Enterprise JavaBeans :: Weblogic JNDI Lookup Fails Via Spring

Feb 24, 2014

There is a weblogic server running at remote place and i need to access the API's in that remote method using JNDI lookup. My application is configured in Spring Tool Suite IDE with java 6 and tomcat 7 and I have used Spring to perform the jndi lookup of weblogic server. In spring i have used simpleremotestatelesssessionproxyfactorybean class to lookup a weblogic server using jndi and get the remote object. But somehow on doing it i'm getting the following error.
 
org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 203 completed: Maybe
       at com.sun.corba.se.impl.logging.ORBUtilSystemException.writeErrorSend(Unknown Source)
       at com.sun.corba.se.impl.logging.ORBUtilSystemException.writeErrorSend(Unknown Source)
       at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.sendWithoutLock(Unknown Source)
       at com.sun.corba.se.impl.encoding.BufferManagerWriteStream.sendFragment(Unknown Source)

[Code] ....

The exception is been thrown at com.sun.corba.se.impl.encoding.CDROutputObject method when calling writeTo(). Why I'm getting this error and can I do anything to remediate it. Irrespective of java this error occurs, i tried with java 5, 6 and 7 but still getting the same error.

View Replies View Related

EJB / EE :: Session Bean Must Not Extend Another Session Bean?

Nov 9, 2014

I have tried this example ([URL].../) with CarDao extending the BaseDao, it works like a charm.However, from the CarDao class, my NetBeans underlined the class name “CarDao” with the error message “A session bean must not extend another session bean.” But I can compile, deploy and run the application without any problem.

I have also heard that a session bean cannot extend another session bean, but why it works here?

I am using Java EE 6, NetBeans 8.0.1 and WebLogic 12c for this code testing.

View Replies View Related

JSF :: Scope Of Bean Associated With Form?

Aug 8, 2014

I have a managed bean for a form. I map the fields filled in the form with managed bean properties. when I submit the form and click new form , values from the previous form submitted gets displayed in the input fields. I used the scope of the from bean to session. what should be its scope so that values should be destroyed after I submit the form .For every new form ,new bean has to be initialized. On submit I navigate to another bean with session scope.

View Replies View Related

JSF :: How To Pass Value To Bean Class

Nov 7, 2014

Getting JS -> JSF value to Bean class? I have tried with below code:

JSF code:

<h:commandButton styleClass="buttonpos" value="Get Value" action="#{myBean.action}" onclick="document.getElementById('crForm:hiddenInput').value">
<h:inputHidden id="hiddenInput" value="#{myBean.action}"/>
</h:commandButton>
Java Beans
public class CurrencyExchangeBean {
protected static Logger logger = ILogger.getLogger(CurrencyExchangeBean.class);

[Code] .....

View Replies View Related

JSP :: Getting And Setting Bean Property With Tag

May 11, 2014

Will it make any difference if I put the last line of code inside the useBean tag ?

<jsp:useBean id="person" class="foo.Person" scope="page" >
<jsp:setProperty name="person" property="name" value="Fred" />
</jsp:useBean>
<jsp:getProperty name="person" property="name" />

It gives me the same output though....

View Replies View Related

JSF :: Application / Session Bean

Jan 30, 2015

When i create an application Bean how i can update it from another bean? Lets say application Bean has variable h=1 and i want to update from another bean and make it 2 how i can do it? And how i can access the value of a session bean from another bean?

View Replies View Related

JSF :: Binding Xhtml And Bean Not Working?

Mar 29, 2014

I am working on eclipse kepler, JSF 2.2 with PrimeFaces 4.0 / Mojarra 2.2 library.

actually there are 2 Problems:

I still get this server message no matter what I do.

(( javax.el.PropertyNotFoundException: /Order.xhtml @28,76 value="#{kk.refugee.id}": Target Unreachable, 'refugee' returned null))

and if I delete the input text puls the hidden, the message keeps pop up for 'material' selectOneMenu. -

I have no chance to examin : ((is this javascript code correct, to copy the value of one component to the other.)) these are my xhtml file and java calsses.


**kk.java**
-----------
package khldqr.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@SessionScoped
@ManagedBean
public class kk {

[code]....

View Replies View Related

JSF :: Passing Backing Bean To Another Class

Mar 7, 2014

I am new to JSF and was trying to find an example.

My question is in the processPage() method... how do i pass the managed bean to the ProjectDAO insert statement?

Faces-config.xml

<managed-bean>
<managed-bean-name>projectBean_backing</managed-bean-name>
<managed-bean-class>com.att.ped.backing.Project</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

[Code] .....

View Replies View Related

JSF :: Managed Bean Is Not Getting Instantiated Intermittently

Jun 5, 2014

I have a JSF bean which is request scope and corresponding JSF UI page. when user tries to open this page, we are getting exception 'Cannot instantiate user.java class <default constructor>'. This does not come always. It comes very rarely. JSF version is 1.2

View Replies View Related

JSF :: Value Input Text Cannot Bind To Bean

Feb 28, 2011

I have following bean:

public class LoginBean {
private String email;
private String password;
private SessionId sessionId;
private UserController userController;
public LoginBean() {
this.email = "";
this.password = "";

[code]....

And the jsp page is html and css and next part

<h:form id="form">
<p><h:inputText value="#{loginBean.email}" /></p>
<p><h:inputSecret value="#{loginBean.password}" /></p>
<p><h:message for="form"/></p>
<p><h:commandButton value="login" action="#{loginBean.login}" /></p>
</h:form>

I can't get the values out of the inputtext in any way?

View Replies View Related

How To Print Contents Of Java Bean

Mar 24, 2015

I'm trying to debug a program and I need to see the values in a Bean. I tried

" system.out.println("OrderManager.java: packagePricing, packBean= "+packBean);"

but that just gives me

"OrderManager.java: packagePricing, packBean=com.voxportal.web.device.PackageBean@73dde7ae"

which I think is a reference to the bean but not the actual contents of the Bean.

View Replies View Related

EJB / EE :: Bean Annotations And Unit Testing?

Mar 6, 2014

I have a bean that represents data been collected from a form on a jsp page. Currently I would like to validate my fields and write some test cases for them. As you can see from my test case example I test a string in the hope that it fails because it contains only one letter. My problem is my unit test is passing. The reason this is from what I can tell is that at runtime it fails when I try to persist my object using my entity manager. During my unit test I just I don’t call my entity manager I just try and set the field.

What I thought would happen was that when I use my bean fields set method the annotations would be checked and fail at that point. Hence why I expected my unit test in this case to fail.

What I would like to know is

1.Are annotations specifically designed to validate when I persist my object and am I using them incorrectly at this point?

2.Is this the best method to use to validate fields, is there a better way, should I write my own code to validate for me when I set my value?

a. Should I throw an exception from the set method of each bean field?

Unit Test:

@Test
public void testName(){
Human h=new Human();
try {
h.setFname("a");
} catch (Exception e) {
// TODO Auto-generated catch block
fail("failed");
e.printStackTrace();

[code]....

View Replies View Related

JSF :: Create A Managed Bean Per View

Jun 11, 2014

About creating views,

1. When we have a view and this uses two or three managed beans and not only one, is this ok? is a good design?

2 If we have two views and both of them only share one functionality (they need to display datatable with clients) , for the second view and for the shared functionality, should I in the managed bean for the second view create the same method that gets the clients or reuse the method in the managed bean created for the first view?

View Replies View Related

JSF :: What Causes Backing Bean Return Null

Apr 6, 2015

I tried to create my first javaweb project. However when some action were being invoke I received an error. Here is what I did:

Person.javapackage org.javaeesample.entities;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;

[Code].....

When tried to run my project what happened were:

1. When i clicked the link from show.xhtml

<h:link value="#{p.name}" outcome="details">
<f:param name="pid" value="#{p.id}"/>
</h:link>

It output the page but without data being displayed.

but on the url it shows: [URL] .....

1. When i clicked 'Save' button in create.xhtml here is the error i received:

An Error Occurred:

View Replies View Related

EJB / EE :: Local Session Stateless Bean

Feb 18, 2015

Below is my ejb-jar.xml

<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<display-name>TestEJB</display-name>
<enterprise-beans>
<session>
<ejb-name>TestSessionLocal</ejb-name>

[code]....

All my classes implement proper local classes EJBLocalHome and EJBLocalObject.This configuration used to work fine in JBOSS 5.1.0 G

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved