JSF :: Injection Of EJB Into CDI Bean Call Of Method Not Allowed

Apr 21, 2014

In an JEE6 webprofile project, using JBoss EAP 6.1:

I have a CDI Bean:

import javax.faces.bean.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
import de.dpunkt.myaktion.model.Organisator;
import de.dpunkt.myaktion.services.OrganisatorDAO;

[code]....

When I call doCreate() I get

javax.servlet.ServletException: javax.ejb.EJBAccessException: JBAS014502: Aufruf an Methode: public abstract void de.dpunkt.myaktion.services.OrganisatorDAO.save(de.dpunkt.myaktion.model.Organisator) von Bean: OrganisatorDAOBean ist nicht gestattet
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)

which translates to: call of method: .... from Bean ... is not allowed

View Replies


ADVERTISEMENT

How To Call A Method That Exist Within A Class Into Main Method

Feb 13, 2014

I am just trying to test this array, for a locker combination program that involves classes...but the array is printing out the whacky numbers for the location. When I try to call the method in the main, it does not work. How do I call a method that exist within a class into the main method?

public class locker { 
public static void main(String[] args) {
CombinationLock();

[code]....

View Replies View Related

Passing Java Bean Name In A Method

Jun 13, 2014

Here I am taking response data from JSON using jackson API.I found a feature like using Jackson the properties can be set to bean properties.
 
private static String readUrl(String urlString) throws Exception {       
BufferedReader reader = null;       
try {           
URL url = new URL(urlString);           
reader = new BufferedReader(new InputStreamReader(url.openStream()));     

[Code] ....

I got the correct output here. But now I want to generalize my method into a utility class so that I can reuse the same method for setting response data directly to respective beans as given below:-
 
My question is how will I pass the bean object in my utility class?

public static Object getResponseData(String response,[b]String bean[/b]) throws Exception {       
ObjectMapper mapper = new ObjectMapper(); 
mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);       
JsonNode root = mapper.readTree(response);

[Code] ....

View Replies View Related

Is It Possible To Prevent SQL Injection In Java Code?

Jul 25, 2014

How can we prevent SQL Injection in Java Code?..is there any Special cases..

View Replies View Related

JSF :: Get Data From Managed Bean Method After Servlet Filter

Feb 15, 2015

I have a situation to load data while JSF page loads. Also have a filter which populates user information from http request.

I was expecting the filter first to populate the user information and in the managed bean get method to verify the user information and get the data (from database). But in this case i see the managed bean get method is invoked before filter populates user information and i get null pointer exception because the user information is null.

I had to work around to get the user information from FacesContext in the managed bean get method because the user information wasn't available. Is there a way to make sure the filter is invoked first?

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

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

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

EJB / EE :: Difference Between Inversion Of Control And Dependency Injection Patterns

Feb 4, 2015

My question is regarding the the Inversion of Control (IoC) and Dependency Injection (DI) patterns, when learning about Spring i saw that people keep talking about Ioc and Dependecy Injection like if its the same thing!

View Replies View Related

Method Call For A Void Method

Sep 29, 2014

I've never had to do a void method call. I have my void method in one class and my main (where I want to do the call) in another. How do you actually call a void method?

View Replies View Related

How To Call Self Method

May 18, 2014

How to call/define/describe self method.. below is my code :

Java Code:

public static void main(String[] args) {
banana1();
banana2();
banana3();
banana4();
banana5();
banana6();

[code]....

how exactly to call a self method ?

View Replies View Related

How To Call Variable From Another Method

Oct 3, 2014

My code has a method where the users input a bunch of variables and then those variables get added together in a new variable. What I want to know is how do I call the variable that is in the other method to another method?

import java.util.*;
public class Calc{
public static void main (String [] args){
determinevalue1();
determinevalue2();
determineTotalvalue(double value1, double value2);

[Code] ....

View Replies View Related

Can Call A Method In If Else Statement?

Dec 6, 2014

I am trying to get the program to ask the user to enter the project grade and if it is less than 65, then I want the program to display "fail" or if it is greater than 64 than I want it to display "passed". In this project I have to include a method and I am trying to call it in my if-else statement. I keep getting an error message saying "Project.java:143: error: incompatible types: void cannot be converted to int". I posted my code below. It's a long program, but this part is toward the bottom.
 
import java.util.Scanner;
public class Project {
public static void main(String[] args) {
  //call method
welcomeMessage();
 
[Code] ....

View Replies View Related

Method Call Not Working?

Oct 30, 2014

I have two comboBoxes - one in main and another in my 'windows' class. The code below is in main and references the comboBox in main but I need to use the comboBoxEnv out of my 'windows' class. How can I do that so it says ComboBoxEnv rather than comboBox?

JMenuItem menuExport = new JMenuItem("Export");
menuExport.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(comboBox.getSelectedItem() == null){

[Code] ....

I've gotten access to it by changing my code and making a method of it but I'm not sure of what I do now

exportImport.comboBoxEnv();

View Replies View Related

How To Call Method Without Using Inner Classes

Jun 9, 2014

How do i call the method without using inner classes in this example:

jt = new JTable (model) {
public boolean isCellEditable (int row, int col) {
if (col == 5) {
return false;

[Code] ....

View Replies View Related

To Call Java Method In JSP

Apr 28, 2014

I am trying to call a java method in jsp. The main idea is to hide menu based on the user who logs in. The java class flows like this :

public class UserVerification {
public static void main(String[] args) {
UserVerification obj = new UserVerification();
System.out.print(obj.GetUserVerification("abc"));

[Code] ......

View Replies View Related

How To Call Increment Method

May 26, 2015

I have the following:

public class HistoricalMoment{

private String eventName;
private ClockDisplay timeOfEvent;
public static final int MIDNIGHT_HOUR = 00;
public static final int MINUTE_ZERO = 00;
}

How can I create a method called public void addMinuteToTimeOfEvent() which calls the timeOfEvent's increment() method to add one minute to the timeOfEvent?

View Replies View Related

Call A Method To Paint Graphics?

Jan 3, 2015

I am currently drawing graphics onto a JPanel, by overriding the standard paintComponent method.

Is it possible to call a method to draw some predefined shapes, instead of filling this method with all the stuff I need drawn, and if so, how do I do that?

View Replies View Related

Servlets :: How To Call HEAD Method

Sep 3, 2003

I want to call the HEAD method on a servlet.If in my HTML code, I specify -

<form name="testHead" action="/servlet/servletName" method="HEAD">

And the servlet handles the HEAD method in the sense that the doGet() method returns if the method type is HEAD.When I run it, the servlet returns the code returned by the entire doGet() method. This shows that the doGet() method does not realize that it is a HEAD method and it should return back without processing further.The application server is Tomcat 4.0.

View Replies View Related

Loop Through Objects And Call Method For Each One

Nov 22, 2014

I want to loop through each of my objects and call the method for each one. ( polymorphic array )

Error: Constructor Dog in class Dog cannot applied for gives Types

Required String,String

Found: no arguments

Reason actual and formal argument lists differ in length

Java Code:

public class animal {
private String m_type="";
private String m_name="";
public static void main (String[] args) {

[Code] ....

View Replies View Related

Call Void Method For Array

Mar 6, 2014

I am writing a program to take user input in order to create an array, then call a void method that will read in the numbers (from user's input) and fill the array.This method must use a loop to do this.(The array is to be passed to the void method as a parameter)

in theory, this should change the contents of the array, but without returning a result. Because it is a void method, the array is only passed through the method, not returned; Am I correct?How can I return the array and display it without having to change my method type?

Here is my code:

Java Code: package program7array;
import javax.swing.JOptionPane;

public class Program7Array
public static void main(String[] args) { // main method
int howMany = Integer.parseInt(JOptionPane.showInputDialog(null, // user decides how long array is
"How many numbers are there?"));
double [] numbersArray = new double[howMany]; // creating the array
makeArray(numbersArray, howMany); // calling the array

[code]...

View Replies View Related

How To Call On Arraylist That Is Passed In By A Method

Oct 11, 2014

my arraylist is declared in my main method. A string that i will be calling on is declared in my main method as well. The arraylist and string is passed to a method outside the main. I am to search for the beginning of a string and end of the string, remove those items. Then i am to pass the string with the removed items to arraylist that is called in my main with an enhanced for loop. The for loop then displays what is needed from the string and the method i created. I will posting an example of my main and method that is used in my program.

public class ExampleUrl {
public static void main(String[] args) throws MalformedURLException, IOException {
ArrayList<String> urlList = new ArrayList();
String url = "";

[Code].....

View Replies View Related

Not Able To Call Java Method From Event

Mar 4, 2014

I used java and jsf. I created dynamic datatable in java file. Can i call java method from setOnchange() event?

I am able to call java script function from setOnchange() event. See the below code which is working fine for java script.

HtmlSelectOneMenu selectOneMenu = new HtmlSelectOneMenu();
selectOneMenu.setStyleClass("dropdownStyleTwo");
selectOneMenu.setOnchange("openWin(this);IGNORE_UN LOAD=false");

I wrote openwin() function in java script. But i am not able to call java method change().

Code which is not working.

HtmlSelectOneMenu selectOneMenu = new HtmlSelectOneMenu();
selectOneMenu.setStyleClass("dropdownStyleTwo");
selectOneMenu.setOnchange("myclass.change();IGNORE _UNLOAD=false");

myclass is the bean of class Test. If user select any value from dropdown i want to call change java method. This function will apply the same selected dropdown value to the other record also.

View Replies View Related

Cannot Call Child Method From Main

May 7, 2015

I can call a child method from a main method. If I have a parent called "Assessment", a child called "Quiz", and another child called "test". Can I instinate an object like Assessment a = new test(); and call a method in test.I know the method can be called if I instinate the test t = new test() but that defeats the purpose of inheritance which I'm learning in class.

View Replies View Related

How To Call Abstract Method In Java

Feb 18, 2014

I am new to Java and have been learning it. I have a question here. I came across the following Java class and trying to understand it thoroughly but got confused how it is able to call an abstract method. Here is the code I am referring to :
 
package sampleapps.gui;
import javax.swing.*;
import java.awt.*;
 public class InnerClassAnimationExample {
    int x=70, y=70;
    public static void main(String[] args) {
 
[Code] ....
 
So, in the code above, there is an inner class NewMyDrawPanel which has a paintComponent(Graphics g) method. I have highlighted 2 lines of code above.
 
Line 1 : Graphics2D g2d = (Graphics2D) g;
Line 2 : g2d.fillOval(x,y,40,40);

I understand we are type casting reference g to Graphics2D reference g2d and we are calling fillOval() method on g2d. I don't see a fillOval() method in Graphics2D class but it is there in Graphics class and fillOval method is an abstract method.
 
So, my question here is :
 
1. If we are not able to instantiate an abstract class(Graphics2D and Graphics classes), how are we able to access the fillOval() abstract method,

2. Secondly, since the fillOval() method is an abstract method, it does not have any implementation for the method.

However, when I call the method fillOval() on Graphics2D reference, I was able to draw and fill an oval of the specified co-ordinates. So, where would the actual implementation code be?

View Replies View Related

Call Method In HTML Text On Label

Sep 7, 2014

I want to set an html text on al label, but also call a method.

I tried:

Java Code:

scoreMens.setText("<html>joejoe<BR>jaja<BR</html>" + naamSpeler.laatKaartenZien()); mh_sh_highlight_all('java');

But the naamSpeler.laatKaartenZien(), which returns a string, doesn't show on the label. Is there a way to call a method and use a html text on a label?

The name of the thread should be "call method in html text on label"

View Replies View Related







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