Unable to call Java class method within Embedding Java Activity in BPEL
Hi ,
I have written Java Class named 'Class3' .
When I am creating and trying to call these classes whithin Embedding Java Activity , compile time error is coming. Compiler is not finding class . Error message is like this one.
uildfile: C:\Oracle\Middleware\jdeveloper\bin\ant-sca-compile.xml
scac:
[scac] Validating composite : 'C:\JDeveloper\mywork\Application7\Embedded15\composite.xml'
[scac] C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\bpel\BPELEmbedded15\src\orabpel\bpelembedded15\ExecLetBxExe0.java:73: cannot find symbol
[scac] symbol : class Class3
[scac] location: class orabpel.bpelembedded15.ExecLetBxExe0
[scac] C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\bpel\BPELEmbedded15\src\orabpel\bpelembedded15\ExecLetBxExe0.java:73: cannot find symbol
[scac] symbol : class Class3
[scac] location: class orabpel.bpelembedded15.ExecLetBxExe0
[scac] Note: C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\bpel\BPELEmbedded15\src\orabpel\bpelembedded15\BPEL_BIN.java uses unchecked or unsafe operations.
[scac] Note: Recompile with -Xlint:unchecked for details.
[scac] FATAL_ERROR: location {ns:composite/ns:component[@name='BPELEmbedded15']}(20,36): Failed to compile bpel generated classes.
[scac] failure to compile the generated BPEL classes for BPEL process "BPELEmbedded15" of composite "default/Embedded15!1.0"
[scac] The class path setting is incorrect.
[scac] Ensure that the class path is set correctly. If this happens on the server side, verify that the custom classes or jars which this BPEL process is depending on are deployed correctly. Also verify that the run time is using the same release/version.
[scac]
BUILD FAILED
C:\Oracle\Middleware\jdeveloper\bin\ant-sca-compile.xml:264: Java returned: 1 Check log file : C:\JDeveloper\mywork\Application7\Embedded15\SCA-INF\classes\scac.log for errors
Total time: 8 seconds
I am creating Class3 directly in Application Resources folder indide Project Folder in Jdeveloper without creating any package. Code of the class is .......
public class Class3 {
public Class3() {
super();
public String getValue(){
return "BBBBBBB";
Can any one help?
Regards
Yogendra Rishishwar
9867927087
Hi ,
In your java project frm jdev..right click and choose general and then choose deployment profiles and then choose Jar ..and then give some appropriate name(abc) and then click ok.
Then under resources file u get a abc.deploy file right click and say deploy to jar ..u will find the jar in that director.Now include this jar in your prjct libraries.
have a look at the link http://niallcblogs.blogspot.com/search/label/embedded%20Java
Similar Messages
-
How to call inner class method in one java file from another java file?
hello guyz, i m tryin to access an inner class method defined in one class from another class... i m posting the code too wit error. plz help me out.
// test1.java
public class test1
public test1()
test t = new test();
public class test
test()
public int geti()
int i=10;
return i;
// test2.java
class test2
public static void main(String[] args)
test1 t1 = new test1();
System.out.println(t1.t.i);
i m getting error as
test2.java:7: cannot resolve symbol
symbol : variable t
location: class test1
System.out.println(t1.t.geti());
^There are various ways to define and use nested classes. Here is a common pattern. The inner class is private but implements an interface visible to the client. The enclosing class provides a factory method to create instances of the inner class.
interface I {
void method();
class Outer {
private String name;
public Outer(String name) {
this.name = name;
public I createInner() {
return new Inner();
private class Inner implements I {
public void method() {
System.out.format("Enclosing object's name is %s%n", name);
public class Demo {
public static void main(String[] args) {
Outer outer = new Outer("Otto");
I junior = outer.createInner();
junior.method();
} -
I suffer problems understanding how to call up class methods from within my programs and would like to see further examples of coding and a lending hand with the problem below, program one ProductClass works out stock item lines of a product, the program then needs to ask for the StaticProduct Class(the second program attached) to check for a valid barcode length and for how many odds and even numbers are within it a valid barcode would be 5000127062092
I would very much appreciate some help:
* This is a program to Enter and check product codes and prices
* and give a summary of values at the end
* @author (Jeffrey Jones)
* @version (version 2 5th April 2003)
public class ProcessProduct
public static void main(String args[])
StaticProduct Product = new StaticProduct();
//declare variables
String manuf;
String name;
int sLength;
String p;
String barcode;
int price;
int quantity;
int totalPrice=0;
int transactions=1;
int totalQuantity=0;
int totalValue=0;
int averageCost=0;
//Input Details
System.out.print("Enter Product Manufacturer : ");
manuf = UserInput.readString();
//start of while loop checking for 0 to exit loop
while (!manuf.equals("0"))
System.out.print("Enter Product Name : ");
name = UserInput.readString();
System.out.print("Enter Bar Code : ");
barcode = UserInput.readString();
//check for invalid data
if (StaticProduct.isValidBarcode(barcode))
{barcode = new code();
p = new Product("manuf","name","quantity","price");
}//closing bracket of if
else
{//error handling
}//closing bracket of if
//check for quantity input and errors
System.out.print("Enter Quantity : ");
quantity = UserInput.readInt();
if (quantity<=0)
{ System.out.print(" Error, invalid value ");
System.exit(0);
}// check for invalid entries
System.out.print("Enter Price :");
price = UserInput.readInt();
//check for price input and errors
if (price<=0)
{ System.out.print(" Error, invalid value ");
}// check for invalid entries
//total price value
totalPrice=price*quantity;
//Output of correctly inputted data
System.out.println(manuf+":"+name+":"+barcode+":"+price);
System.out.println(quantity+" @ "+price+" = "+totalPrice);
//update variables quantities
//update total quantity
totalQuantity = (totalQuantity + quantity);
//keep count of total value
totalValue = (totalValue + totalPrice);
//keep count of totqal no of transactions
transactions = (transactions++);
//Input Details
System.out.print("Enter Product Manufacturer : ");
manuf = UserInput.readString();
}//closure of loop
//display final totals
System.out.println("Transactions: "+transactions);
System.out.println("Total quantity: "+totalQuantity);
System.out.println("Total value: "+totalValue);
System.out.println("Average Cost: "+totalValue/totalQuantity);
System.exit(0);
}//closing bracket input and output of data
}//end class
* Write a description of class StaticProduct here.
* @author Jeffrey Jones
* @version 1 1st April 2003
public class StaticProduct
* isValidBarcode method - to check for correct barcode and length
* @return boolean
public static boolean isValidBarcode(String barcode) {
barcode = new barcode();
// validateBarcode length
if ( barcode.length() != 13 ) {
System.out.println("Invalid barcode " + barcode + " not 13 characters");
return false;
}//if
for ( int i = 0; i < barcode.length(); i++ ){// Check every char a digit
if ( ! Character.isDigit( barcode.charAt(i) ) ){
System.out.println("Invalid barcode " + barcode + " not all digits");
return false;
}//if
}//endfor
int sum1 = 0; // Sum first + third + etc.
for ( int i = 0; i < barcode.length() - 1; i += 2 ){
sum1 += barcode.charAt(i) - '0';
}//endfor
int sum2 = 0; // Sum second + fourth + etc.
for ( int i = 1; i < barcode.length() - 1; i += 2 ){
sum2 += barcode.charAt(i) - '0';
}//endfor
int check = sum1 + 3 * sum2; // 1st sum + three times 2nd sum.
check = check % 10; // Remainder on division by 10.
if ( check != 0 ){
check = 10 - check;
}//endif
if (check != barcode.charAt(12) - '0'){
System.out.println("Invalid barcode " + barcode + " check digit error");
}//endif
return ( check == barcode.charAt(12) - '0' );
}//end isValidBarcode
public static void main(String[] argv) {
System.out.println(isValidBarcode("1234567890123"));
System.out.println(isValidBarcode("123"));
System.out.println(isValidBarcode(""));
System.out.println(isValidBarcode("5018374496652"));
}//end main
}//end classRead through your text book or some java tutorials from this site to understand what classes are, what are methods, etc.
Your program is full of wrong initializations (as you rightly said you dont understand how to call up class method I would add that you dont understand how to call classes and what do they return e.g.
You have declared
String p;
then you go ahead and do this
p = new Product("manuf","name","quantity","price"); This is syntax for calling a class is this class returning a String? :s
Please go through the basics of Object Oriented Programming and then start with the coding part else you will face such very many difficulties and waste more time of yours in just coding with no results.
Look for the tutorials on this site and read through them and do example as given in them. -
How to write javascript in java class method
Hi,
any one please resolved this,
i want to write javascript window closing code into java class method, in that method i want to write javascript code & wanted to call in jsf page on commandButton action event,
my code is below but it is not working properly
public void closeWindowClicked(ActionEvent event) {
try
FacesContext facesContext = FacesContext.getCurrentInstance();
String javaScriptText = "window.close();";
// Add the Javascript to the rendered page's header for immediate execution
AddResource addResource = AddResourceFactory.getInstance(facesContext);
addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javaScriptText);
catch(Exception e)
System.out.println(""+e);
for calling into jsf code is below
<h:commandButton action="#{parentBean.closeWindowClicked}" value="OK" />
/*Note- i want to closed the window by caling method contain javascript only, i don't want any ajax code in method */
please any one can resolved this.
Thanks/*Note- i want to closed the window by caling method contain javascript only, i
don't want any ajax code in method */ When the user presses your button, do your business logic and then send them to a page containing the following (note: untested code ahead):
<html>
<head>
function onLoadHandler()
window.close();
</head>
<body onload="onLoadHandler();">
<p>Window closing....</p>
</body>
</html> -
Invoking remote java classes/methods
Hi,
I just wanted to ask for opinions and suggestions regarding my attempt to call a remote java class method using PL/SQL. I didn't want to load it in the database since the configurations for the java class were already set using Spring Integration. I just wanted to supply constructor arguments and run the method and then retrieve the result. Are there any good or easier ways on doing this?
Thanks in advanceVery curious Susan,
A server JVM might not want to host mobile code from other clients, not that it's unsafe, it's just that it allows clients to crash the server JVM at will. They should have it configured to automatically restart though.
Did they delete the java.rmi.* packages from the server JVM runtime? I don't understand why they'd do that.
If you can pry some reasons from them, I'd be very interested to hear them. Perhaps they just want more money, in order to allow you this privilige.
John
PS I've updated representation for you, and ejp, on the cajo project supporting The Land Down Under! -
Is it possible to call a class method using pattern in ABAP editor.
Hi,
Is it possible to call a class method using pattern in ABAP editor.
Thank U for Ur time.
Cheers,
SamYes,
Click patterns.
Then choose Abap objects patterns.
Click on the Tick
It will give a new screen
Here Give the name of the class first.
Then the object (instance of the calss)
And finally the method ..
it will give you the pattern
Hope this helps. -
Setting Control-Flow- Case on java class/method
hello All :D
i have little problem about control flow case, in my case i've 2 page where before load to the page i'wanna make condition (if-else)
when the user choose the field, the java class get the value for make true condition. In this case, i wanna implement ControlFlowCase in java class/method, so anyone help..?
thx
agungdmtHave you considered using router activity - http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/taskflows_activities.htm#CJHFFGAF ?
-
Essential PL/SQL , Java Classes/Methods for working on BLOB
 Are there any methods/procedures with which we could work on a BLOB object which contains purely text?
 Essential PL/SQL , Java Classes/Methods for working on BLOB:
null Are there any methods/procedures with which we could work on a BLOB object which contains purely text?
 Essential PL/SQL , Java Classes/Methods for working on BLOB:
null -
Where to find Java Class File Specification for Java 5.0?
Where to find Java Class File Specification for Java 5.0?
thank you in advance.same place you found it for 1.4Can u give more details? I thought the class spec for Java 1.4 is the same as Java 1.2.
anyone can tell where to find Java Class File Specification for Java 5.0?
Thanks. -
How can I call a java class from within my program?
I was wondering if there's a platform independent way to call a java class from my program.
Here's my scenario. I'm working on a platform independent, feature rich, object-oriented command prompt program. The way I'm designing it is that users can drop classes they write into my bin directory and gain access to the class through my program. For example, they drop a class named Network.class in the bin directory. They would type Network network at my command prompt and gain access to all the methods available in that class. They can then type system.echo network.ipaddress() at my prompt and get the system's ip address. I have it designed that there's a server running in the background and the clients connect to my port. Once connected the end-user can enter their user name and password and gain access to the system. When they type a command they actually call another java program which connects to my server using a seperate thread. They can then communicate back and forth. I have it set that everything has a process id and it's used to keep track of who called what program. Once the program is done it disconnects and closes. Rather than getting into the nitty gritty (I didn't want to get into heavy detail, I know how everything will work) I'm really interested in finding out how I can call a java program from my program. I don't want it to be part of the app in any way.
-
Calling ABAP class methods from JAVA application
Hi All,
I want to fetch ITS related information (SITSPMON Tcode) in my JAVA application. But i didnt find much BAPIs for the same. While debugging I came accross few class methods with help of which I can get the required information. So is there any way we can call and execute methods of ABAP classes through java application?
for e.g. I want to call GET_VERSION method of CL_ITSP_UTIL class.
Thanks,
Arati.Hi,
Yes, as per my knowledge the only way to interact is using BAPI exposed as RFCs. So try to invoke those class methods in one CUSTOM BAPI and expose that BAPI as RFC and consume that RFC to get those details.
Regards,
Charan -
Unable to call the RFC from the WD java Program
Hi All,
I have a table and three buttons Create, Edit, Save in the layout.
If no record available in the R3 the the end user will click on create and then he will click on save so that the insert RFC will be called accordingly and the record will be inserted.My table is limited to 5 records only. If i enter all the 5 records and Click on submit the record is inserting in the backend , but if i enter less than 5 records im unable to call the RFC what might be the issue.
My insert RFC takes one Table node and 4 import parameters i'm passing all of the all the mentioned import parameters.
Code:-
View Controller code
// This file has been generated partially by the Web Dynpro Code Generator.
// MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.
// ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.
package com.gmr.ess;
// IMPORTANT NOTE:
// ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED
// BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN
// AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateAPPView).
// OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY
// A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS
// OF IMPORT STATEMENTS.
//@@begin imports
import java.math.BigDecimal;
import java.util.Date;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Iterator;
import com.gmr.ess.wdp.IPrivateAPPView;
import com.gmr.pck.Zst_Hr_Nominee;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;
import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
//@@end
//@@begin documentation
//@@end
public class APPView
Logging location.
private static final com.sap.tc.logging.Location logger =
com.sap.tc.logging.Location.getLocation(APPView.class);
static
//@@begin id
String id = "$Id$";
//@@end
com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);
Private access to the generated Web Dynpro counterpart
for this controller class. </p>
Use <code>wdThis</code> to gain typed access to the context,
to trigger navigation via outbound plugs, to get and enable/disable
actions, fire declared events, and access used controllers and/or
component usages.
@see com.gmr.ess.wdp.IPrivateAPPView for more details
private final IPrivateAPPView wdThis;
Root node of this controller's context. </p>
Provides typed access not only to the elements of the root node
but also to all nodes in the context (methods node<i>XYZ</i>())
and their currently selected element (methods current<i>XYZ</i>Element()).
It also facilitates the creation of new elements for all nodes
(methods create<i>XYZ</i>Element()). </p>
@see com.gmr.ess.wdp.IPrivateAPPView.IContextNode for more details.
private final IPrivateAPPView.IContextNode wdContext;
A shortcut for <code>wdThis.wdGetAPI()</code>. </p>
Represents the generic API of the generic Web Dynpro counterpart
for this controller. </p>
private final com.sap.tc.webdynpro.progmodel.api.IWDViewController wdControllerAPI;
A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>
Represents the generic API of the Web Dynpro component this controller
belongs to. Can be used to access the message manager, the window manager,
to add/remove event handlers and so on. </p>
private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;
public APPView(IPrivateAPPView wdThis)
this.wdThis = wdThis;
this.wdContext = wdThis.wdGetContext();
this.wdControllerAPI = wdThis.wdGetAPI();
this.wdComponentAPI = wdThis.wdGetAPI().getComponent();
//@@begin javadoc:wdDoInit()
/** Hook method called to initialize controller. */
//@@end
public void wdDoInit()
//@@begin wdDoInit()
try{
IWDMessageManager manager1 = wdComponentAPI.getMessageManager();
IWDClientUser user = WDClientUser.getLoggedInClientUser();
String logUser= user.getSAPUser().getUniqueName();
wdContext.currentContextElement().setUserid(logUser);
wdThis.wdGetAPPController().executeBapi_Employee_Getdata_Input();//Returns the user id for the employee
Collection nomineeList = new ArrayList();
wdThis.wdGetAPPController(). executeZ_Hrfm_Nominee_Disp_Input( );
int nomineeTableSize = wdContext.nodeZ_Hrfm_Nominee_Disp_Input().nodeOutput_Nominee().nodeNominee().size();
for(int i=0;i< nomineeTableSize;i++){
IPrivateAPPView.IDisplay_table_nodeElement ele = wdContext.nodeDisplay_table_node().createDisplay_table_nodeElement();
ele.setAddr(wdContext.nodeZ_Hrfm_Nominee_Disp_Input().nodeOutput_Nominee().nodeNominee().getNomineeElementAt(i).getAddr());
ele.setDob(wdContext.nodeZ_Hrfm_Nominee_Disp_Input().nodeOutput_Nominee().nodeNominee().getNomineeElementAt(i).getDob());
ele.setGuard(wdContext.nodeZ_Hrfm_Nominee_Disp_Input().nodeOutput_Nominee().nodeNominee().getNomineeElementAt(i).getGuard());
ele.setName(wdContext.nodeZ_Hrfm_Nominee_Disp_Input().nodeOutput_Nominee().nodeNominee().getNomineeElementAt(i).getName());
ele.setPerc(wdContext.nodeZ_Hrfm_Nominee_Disp_Input().nodeOutput_Nominee().nodeNominee().getNomineeElementAt(i).getPerc());
ele.setRelat(wdContext.nodeZ_Hrfm_Nominee_Disp_Input().nodeOutput_Nominee().nodeNominee().getNomineeElementAt(i).getRelat());
nomineeList.add(ele);
wdContext.nodeDisplay_table_node().bind(nomineeList);
wdContext.currentContextElement().setEdit_val_attr(true);
if(nomineeTableSize<=0){
wdContext.currentContextElement().setCreateButtonEnable(true);
wdContext.currentContextElement().setEditButtonEnable(false);
else{
wdContext.currentContextElement().setCreateButtonEnable(false);
wdContext.currentContextElement().setEditButtonEnable(true);
catch(Exception e){
wdComponentAPI.getMessageManager().reportException("",true);
//@@end
//@@begin javadoc:wdDoExit()
/** Hook method called to clean up controller. */
//@@end
public void wdDoExit()
//@@begin wdDoExit()
//@@end
//@@begin javadoc:wdDoModifyView
Hook method called to modify a view just before rendering.
This method conceptually belongs to the view itself, not to the
controller (cf. MVC pattern).
It is made static to discourage a way of programming that
routinely stores references to UI elements in instance fields
for access by the view controller's event handlers, and so on.
The Web Dynpro programming model recommends that UI elements can
only be accessed by code executed within the call to this hook method.
@param wdThis Generated private interface of the view's controller, as
provided by Web Dynpro. Provides access to the view controller's
outgoing controller usages, etc.
@param wdContext Generated interface of the view's context, as provided
by Web Dynpro. Provides access to the view's data.
@param view The view's generic API, as provided by Web Dynpro.
Provides access to UI elements.
@param firstTime Indicates whether the hook is called for the first time
during the lifetime of the view.
//@@end
public static void wdDoModifyView(IPrivateAPPView wdThis, IPrivateAPPView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
//@@begin wdDoModifyView
//@@end
//@@begin javadoc:onActionGetData(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionGetData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionGetData(ServerEvent)
//$$begin ActionButton(-535519310)
//wdThis.wdGetAPPController().executeZ_Hrfm_Nominee_Disp_Input();
//$$end
//@@end
//@@begin javadoc:onActionEdit(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionEdit(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionEdit(ServerEvent)
//$$begin ActionButton(-535519310)
displayTablesize=wdContext.nodeDisplay_table_node().size();
if(displayTablesize<5){
for(int i=0;i<size-displayTablesize;i++){
IPrivateAPPView.IDisplay_table_nodeElement ele = wdContext.nodeDisplay_table_node().createDisplay_table_nodeElement();
wdContext. nodeDisplay_table_node().addElement(ele);
operation="MOD";
wdContext.currentContextElement().setTableReadOnly(true);
wdContext.currentZ_Hrfm_Nominee_Ins_Mod_InputElement().setOperation(operation);
//$$end
//@@end
//@@begin javadoc:onActionCreate(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionCreate(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionCreate(ServerEvent)
int month=0,year=0,day=0;
String month1,day1,year1;
try{
displayTablesize=wdContext.nodeDisplay_table_node().size();
wdContext.currentContextElement().setEdit_val_attr(false);
if(wdContext.nodeDisplay_table_node().isEmpty()){
if(displayTablesize<5){
Calendar cal=Calendar.getInstance();
month=cal.get(Calendar.MONTH)+1;
if(month==1||month==2||month==3||month==4||month==5||month==6||month==7||month==8||month==9){
month1="0"+month;
else{
month1=""+month;
day = cal.get(Calendar.DAY_OF_MONTH);
if(day==1||day==2||day==3||day==4||day==5||day==6||day==7||day==8||day==9){
day1= "0"+day;
else{
day1=""+day;
year = cal.get(Calendar.YEAR);
year1=""+year;
String strFormat=day1"."month1"."year1;
wdContext.currentOutput_NomineeElement().setBegda(strFormat);
wdContext.currentOutput_NomineeElement().setEndda("31.12.9999");
for(int i=0;i<size-displayTablesize;i++){
IPrivateAPPView.IDisplay_table_nodeElement ele = wdContext.nodeDisplay_table_node().createDisplay_table_nodeElement();
wdContext. nodeDisplay_table_node().addElement(ele);
operation="INS";
wdContext.currentZ_Hrfm_Nominee_Ins_Mod_InputElement().setOperation(operation);
wdContext.currentContextElement().setTableReadOnly(true);
catch(NullPointerException npe){
wdComponentAPI.getMessageManager().reportException("No Data Available",true);
//@@end
//@@begin javadoc:onActionSaveData(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionSaveData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionSaveData(ServerEvent)
float percentage=0;
float dupePercentage=0;
boolean isTest = false;
Collection DispTList = new ArrayList();
IWDMessageManager manager1 = wdComponentAPI.getMessageManager();
try{
displayTablesize = wdContext.nodeDisplay_table_node().size();
//for(int i=1;i<=displayTablesize;i++){
for(int i=0;i<displayTablesize;i++){
BigDecimal share = wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getPerc();
String name = wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getName();
percentage = share.floatValue();
dupePercentage = dupePercentage + percentage;
if(name!=null && share!=null){
Zst_Hr_Nominee nominee = new Zst_Hr_Nominee();
nominee.setAddr(wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getAddr());
manager1.reportSuccess(wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getAddr());
nominee.setDob(wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getDob());
manager1.reportSuccess(""+wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getDob());
nominee.setGuard(wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getGuard());
manager1.reportSuccess(""+wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getGuard());
nominee.setName(wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getName());
manager1.reportSuccess(""+wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getName());
nominee.setPerc(wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getPerc());
manager1.reportSuccess(""+wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getPerc());
nominee.setRelat(wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getRelat());
manager1.reportSuccess(""+wdContext.nodeDisplay_table_node().getDisplay_table_nodeElementAt(i).getRelat());
DispTList.add(nominee);
wdContext.nodeZ_Hrfm_Nominee_Ins_Mod_Input().nodeNominee_ins().bind(DispTList);
if((dupePercentage)!=100)
wdComponentAPI.getMessageManager().reportException(
"The sum of the share Percentages is not 100. Modify the percentages accordingly",true);
wdContext.nodeZ_Hrfm_Nominee_Ins_Mod_Input().nodeNominee_ins().bind(DispTList);
IWDMessageManager manager = wdComponentAPI.getMessageManager();
String beginDate = wdContext.currentOutput_NomineeElement().getBegda();
manager.reportSuccess(wdContext.currentOutput_NomineeElement().getBegda());
String endDate=wdContext.currentOutput_NomineeElement().getEndda();
manager.reportSuccess(wdContext.currentOutput_NomineeElement().getEndda());
wdContext.currentZ_Hrfm_Nominee_Ins_Mod_InputElement().setBegda(beginDate);
wdContext.currentZ_Hrfm_Nominee_Ins_Mod_InputElement().setEndda(endDate);
wdContext.currentZ_Hrfm_Nominee_Ins_Mod_InputElement().setOperation(operation);
wdComponentAPI.getMessageManager().reportSuccess(operation);
wdThis.wdGetAPPController().executeBapi_Employee_Getdata_Input();
wdThis.wdGetAPPController().executeZ_Hrfm_Nominee_Ins_Mod_Input();
//wdContext.currentContextElement().setTableReadOnly(false);
catch(Exception e){
e.getMessage();
//@@end
The following code section can be used for any Java code that is
not to be visible to other controllers/views or that contains constructs
currently not supported directly by Web Dynpro (such as inner classes or
member variables etc.). </p>
Note: The content of this section is in no way managed/controlled
by the Web Dynpro Designtime or the Web Dynpro Runtime.
//@@begin others
int nomineeTableSize = 0;
int displayTablesize = 0;
String operation= null;
int size=5;
// float dupePercentage=0;
//String mod_op="MOD";
//@@end
content of obsolete user coding area(s) -
//@@begin obsolete:javadoc:onActionSave(ServerEvent)
// /** Declared validating even
Component controller code
// This file has been generated partially by the Web Dynpro Code Generator.
// MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.
// ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.
package com.gmr.ess;
// IMPORTANT NOTE:
// ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED
// BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN
// AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateAPP).
// OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY
// A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS
// OF IMPORT STATEMENTS.
//@@begin imports
import java.util.Iterator;
import com.gmr.ess.wdp.IPrivateAPP;
import com.gmr.pck.Bapi_Employee_Getdata_Input;
import com.gmr.pck.Bapip0002B;
import com.gmr.pck.Z_Hrfm_Nominee_Disp_Input;
import com.gmr.pck.Z_Hrfm_Nominee_Ins_Mod_Input;
import com.gmr.pck.Zst_Hr_Nominee;
import com.sap.lcr.api.util.SetProfileConnect;
import com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
//@@end
//@@begin documentation
//@@end
public class APP
Logging location.
private static final com.sap.tc.logging.Location logger =
com.sap.tc.logging.Location.getLocation(APP.class);
static
//@@begin id
String id = "$Id$";
//@@end
com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);
Private access to the generated Web Dynpro counterpart
for this controller class. </p>
Use <code>wdThis</code> to gain typed access to the context,
to trigger navigation via outbound plugs, to get and enable/disable
actions, fire declared events, and access used controllers and/or
component usages.
@see com.gmr.ess.wdp.IPrivateAPP for more details
private final IPrivateAPP wdThis;
Root node of this controller's context. </p>
Provides typed access not only to the elements of the root node
but also to all nodes in the context (methods node<i>XYZ</i>())
and their currently selected element (methods current<i>XYZ</i>Element()).
It also facilitates the creation of new elements for all nodes
(methods create<i>XYZ</i>Element()). </p>
@see com.gmr.ess.wdp.IPrivateAPP.IContextNode for more details.
private final IPrivateAPP.IContextNode wdContext;
A shortcut for <code>wdThis.wdGetAPI()</code>. </p>
Represents the generic API of the generic Web Dynpro counterpart
for this controller. </p>
private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdControllerAPI;
A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>
Represents the generic API of the Web Dynpro component this controller
belongs to. Can be used to access the message manager, the window manager,
to add/remove event handlers and so on. </p>
private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;
public APP(IPrivateAPP wdThis)
this.wdThis = wdThis;
this.wdContext = wdThis.wdGetContext();
this.wdControllerAPI = wdThis.wdGetAPI();
this.wdComponentAPI = wdThis.wdGetAPI().getComponent();
//@@begin javadoc:wdDoInit()
/** Hook method called to initialize controller. */
//@@end
public void wdDoInit()
//@@begin wdDoInit()
//$$begin Service Controller(1490375209)
// wdContext.nodeZ_Hrfm_Nominee_Ins_Mod_Input().bind(new Z_Hrfm_Nominee_Ins_Mod_Input());
Z_Hrfm_Nominee_Ins_Mod_Input input = new Z_Hrfm_Nominee_Ins_Mod_Input();
input.addNominee(new Zst_Hr_Nominee());
wdContext.nodeZ_Hrfm_Nominee_Ins_Mod_Input().bind(input);
//$$end
//$$begin Service Controller(-932523997)
wdContext.nodeZ_Hrfm_Nominee_Disp_Input().bind(new Z_Hrfm_Nominee_Disp_Input());
//$$end
//$$begin Service Controller(-368783613)
wdContext.nodeBapi_Employee_Getdata_Input().bind(new Bapi_Employee_Getdata_Input());
//$$end
//@@end
//@@begin javadoc:wdDoExit()
/** Hook method called to clean up controller. */
//@@end
public void wdDoExit()
//@@begin wdDoExit()
//@@end
//@@begin javadoc:wdDoPostProcessing()
Hook called to handle data retrieval errors before rendering.
After doModifyView(), the Web Dynpro Framework gets all context data needed
for rendering by validating the contexts (which in turn calls the supply
functions and supplying relation roles). In this hook, the application
should handle the errors which occurred during validation of the contexts.
Using preorder depth-first traversal, this hook is called for all component
controllers starting with the current root component.
Permitted operations:
- Flushing model queue
- Creating messages
- Reading context and model data
Forbidden operations:
- Invalidating model data
- Manipulating the context
- Firing outbound plugs
- Creating components
@param isCurrentRoot true if this is the root of the current request
//@@end
public void wdDoPostProcessing(boolean isCurrentRoot)
//@@begin wdDoPostProcessing()
//@@end
//@@begin javadoc:wdDoBeforeNavigation()
Hook before the navigation phase starts.
This hook allows you to flush the model queue and handle any
errors that occur. Firing outbound plugs is allowed in this hook.
Using preorder depth-first traversal, this hook is called for all component
controllers starting with the current root component.
@param isCurrentRoot true if this is the root of the current request
//@@end
public void wdDoBeforeNavigation(boolean isCurrentRoot)
//@@begin wdDoBeforeNavigation()
//@@end
//@@begin javadoc:wdDoApplicationStateChange()
Hook that informs the application about a state change.
<p>
This hook is called e.g. to tell the application that will be
<ul>
<li>left via a suspend plug and therefore should go into a suspend/sleep
mode with minimal need of resources. errors that occur. Firing
outbound plugs is allowed in this hook.
<li>left due to a timeout and could write it's state to a data base if the
user comes back later on
</ul>
The concrete reason is available via IWDApplicationStateChangeInfo
<p>
<b>Important</b>: This hook is called for the top level component only!
@param stateChangeInfo contains the information about the nature of the state change
@param stateChangeReturn allows the application to ask for a different state change.
The framework is allowed to ignore it considering i.e. the current resources situation.
//@@end
public void wdDoApplicationStateChange(com.sap.tc.webdynpro.progmodel.api.IWDApplicationStateChangeInfo stateChangeInfo, com.sap.tc.webdynpro.progmodel.api.IWDApplicationStateChangeReturn stateChangeReturn)
//@@begin wdDoApplicationStateChange()
//@@end
//@@begin javadoc:executeBapi_Employee_Getdata_Input()
/** Declared method. */
//@@end
public void executeBapi_Employee_Getdata_Input( )
//@@begin executeBapi_Employee_Getdata_Input()
//$$begin Service Controller(1705750894)
IWDMessageManager manager = wdComponentAPI.getMessageManager();
Iterator itrGetData = null;
Bapip0002B out = null;
try
wdContext.currentBapi_Employee_Getdata_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
itrGetData = wdContext.currentOutputElement().modelObject().getPersonal_Data().iterator();
while (itrGetData.hasNext()) {
out = (Bapip0002B) itrGetData.next();
empNo = out.getPerno();
wdContext.currentZ_Hrfm_Nominee_Disp_InputElement().setPernr(empNo);
wdContext.currentZ_Hrfm_Nominee_Ins_Mod_InputElement().setPernr(empNo);
// manager.reportSuccess(empNo);
//wdThis.executeZ_Hrfm_Nominee_Disp_Input();
catch(WDDynamicRFCExecuteException e)
manager.reportException(e.getMessage(), false);
//$$end
//@@end
//@@begin javadoc:executeZ_Hrfm_Nominee_Disp_Input()
/** Declared method. */
//@@end
public void executeZ_Hrfm_Nominee_Disp_Input( )
//@@begin executeZ_Hrfm_Nominee_Disp_Input()
//$$begin Service Controller(-366407911)
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try
wdContext.currentZ_Hrfm_Nominee_Disp_InputElement().modelObject().execute();
wdContext.nodeOutput_Nominee().invalidate();
catch(WDDynamicRFCExecuteException e)
manager.reportException(e.getMessage(), false);
//$$end
//@@end
//@@begin javadoc:executeZ_Hrfm_Nominee_Ins_Mod_Input()
/** Declared method. */
//@@end
public void executeZ_Hrfm_Nominee_Ins_Mod_Input( )
//@@begin executeZ_Hrfm_Nominee_Ins_Mod_Input()
//$$begin Service Controller(1524028406)
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try
wdContext.currentZ_Hrfm_Nominee_Ins_Mod_InputElement().modelObject().execute();
wdContext.nodeOutput_nominee_ins_mod().invalidate();
catch(WDDynamicRFCExecuteException e)
manager.reportException(e.getMessage(), false);
//$$end
//@@end
The following code section can be used for any Java code that is
not to be visible to other controllers/views or that contains constructs
currently not supported directly by Web Dynpro (such as inner classes or
member variables etc.). </p>
Note: The content of this section is in no way managed/controlled
by the Web Dynpro Designtime or the Web Dynpro Runtime.
//@@begin others
String empNo = null;
//@@end
Suman
Edited by: sumankumar kurimilla on Dec 23, 2008 9:26 AMHi,
I have checked from RFC side that is working fine only java app its not working can you tell any thing needs to be changed from my application end.
Please check in Savedata action.
Regards,
Suman
Edited by: sumankumar kurimilla on Dec 23, 2008 11:01 AM -
Unable to call exported client methods of EJB session bean remote interface
I am unable to call client methods of a BC4J application module deployed as a Session EJB to Oracle 8i at the client side of my multi-tier application. There is no documentation, and I am unable to understand how I should do it.
A business components project has been created. For instance, its application module is called BestdataModule. A few custom methods have been added to BestdataModuleImpl.java file, for instance:
public void doNothingNoArgs() {
public void doNothingOneArg(String astr) {
public void setCertificate(String userName, String userPassword) {
theCertificate = new Certificate(userName, userPassword);
public String getPermission() {
if (theCertificate != null)
{if (theCertificate.getPermission())
{return("Yes");
else return("No, expired");
else return("No, absent");
theCertificate being a protected class variable and Certificate being a class, etc.
The application module has been tested in the local mode, made remotable to be deployed as EJB session bean, methods to appear at the client side have been selected. The application module has been successfully deployed to Oracle 8.1.7 and tested in the remote mode. A custom library containing BestdataModuleEJBClient.jar and BestDataCommonEJB.jar has been created.
Then I try to create a client basing on Example Oracle8i/EJB Client snippet:
package bestclients;
import java.lang.*;
import java.sql.*;
import java.util.*;
import javax.naming.*;
import oracle.aurora.jndi.sess_iiop.*;
import oracle.jbo.*;
import oracle.jbo.client.remote.ejb.*;
import oracle.jbo.common.remote.*;
import oracle.jbo.common.remote.ejb.*;
import oracle.jdeveloper.html.*;
import bestdata.client.ejb.*;
import bestdata.common.ejb.*;
import bestdata.common.*;
import bestdata.client.ejb.BestdataModuleEJBClient;
public class BestClients extends Object {
static Hashtable env = new Hashtable(10);
public static void main(String[] args) {
String ejbUrl = "sess_iiop://localhost:2481:ORCL/test/TESTER/ejb/bestdata.BestdataModule";
String username = "TESTER";
String password = "TESTER";
Hashtable environment = new Hashtable();
environment.put(javax.naming.Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
environment.put(Context.SECURITY_PRINCIPAL, username);
environment.put(Context.SECURITY_CREDENTIALS, password);
environment.put(Context.SECURITY_AUTHENTICATION, ServiceCtx.NON_SSL_LOGIN);
BestdataModuleHome homeInterface = null;
try {
Context ic = new InitialContext(environment);
homeInterface = (BestdataModuleHome)ic.lookup(ejbUrl);
catch (ActivationException e) {
System.out.println(e.getMessage());
e.printStackTrace();
System.exit(1);
catch (CommunicationException e) {
System.out.println(e.getMessage());
e.printStackTrace();
System.exit(1);
catch (NamingException e) {
System.out.println(e.getMessage());
e.printStackTrace();
System.exit(1);
try {
System.out.println("Creating a new EJB instance");
RemoteBestdataModule remoteInterface = homeInterface.create();
// Method calls go here!
// e.g.
// System.out.println(remoteInterface.foo());
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
It doesnt cause any errors. However, how must I call methods? The public interface RemoteBestdataModule has no such methods:
void doNothingNoArgs();
void doNothingOneArg(java.lang.String astr);
void setCertificate(java.lang.String userName, java.lang.String userPassword);
java.lang.String getPermission();
Instead of that it has the following methods:
oracle.jbo.common.remote.PiggybackReturn doNothingNoArgs(byte[] _pb) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
oracle.jbo.common.remote.PiggybackReturn doNothingOneArg(byte[] _pb, java.lang.String astr) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
oracle.jbo.common.remote.PiggybackReturn customQueryExec(byte[] _pb, java.lang.String aQuery) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
oracle.jbo.common.remote.PiggybackReturn setCertificate(byte[] _pb, java.lang.String userName, java.lang.String userPassword) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
oracle.jbo.common.remote.PiggybackReturn getPermission(byte[] _pb) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
I cannot call those methods. I can see how they are called in BestdataModuleEJBClient.java file:
public void doNothingNoArgs() throws oracle.jbo.JboException {
try {
oracle.jbo.common.remote.PiggybackReturn _pbRet = mRemoteAM.doNothingNoArgs(getPiggyback());
processPiggyback(_pbRet.mPiggyback);
if (_pbRet.isReturnStreamValid()) {
return;
catch (oracle.jbo.common.remote.ejb.RemoteJboException ex) {
processRemoteJboException(ex);
catch (java.rmi.RemoteException ex) {
processRemoteJboException(ex);
throw new oracle.jbo.JboException("Marshall error");
However, I cannot call getPiggyback() function! It is a protected method, it is available to the class BestdataModuleEJBClient which extends EJBApplicationModuleImpl, but it is unavailable to my class BestClients which extends Object and is intended to extend oracle.jdeveloper.html.WebBeanImpl!
It seems to me that I mustnt use RemoteBestdataModule interface directly. Instead of that I must use the public class BestdataModuleEJBClient that extends EJBApplicationModuleImpl and implements BestdataModule interface. It contains all methods required without additional arguments (see just above). However, how must I create an object of BestdataModuleEJBClient class? That is a puzzle. Besides my custom methods the class has only two methods:
protected bestdata.common.ejb.RemoteBestdataModule mRemoteAM;
/*This is the default constructor (do not remove)*/
public BestdataModuleEJBClient(RemoteApplicationModule remoteAM) {
super(remoteAM);
mRemoteAM = (bestdata.common.ejb.RemoteBestdataModule)remoteAM;
public bestdata.common.ejb.RemoteBestdataModule getRemoteBestdataModule() {
return mRemoteAM;
It looks like the remote application module must already exist! In despair I tried to put down something of the kind at the client side:
RemoteBestdataModule remoteInterface = homeInterface.create();
BestdataModuleEJBClient dm = new BestdataModuleEJBClient(remoteInterface);
dm.doNothingNoArgs();
Of course, it results in an error.
System Output: null
System Error: java.lang.NullPointerException
System Error: oracle.jbo.common.PiggybackOutput oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyForRemovedObjects(oracle.jbo.common.PiggybackOutput) (ApplicationModuleImpl.java:3017)
System Error: byte[] oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyfront(boolea
System Error: n) (ApplicationModuleImpl.java:3059)
System Error: byte[] oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyback() (ApplicationModuleImpl.java:3195)
System Error: void bestdata.client.ejb.BestdataModuleEJBClient.doNothingNoArgs() (BestdataModuleEJBClient.java:33)
System Error: void bes
System Error: tclients.BestClients.main(java.lang.String[]) (BestClients.java:76)
I have studied a lot of documents in vain. I have found only various senseless discourses:
"Use the Application Module Wizard to make the Application Module remotable and export the method. This will generate an interface for HrAppmodule (HrAppmodule.java in the Common package) which contains the signature for the exported method promoteAllEmps(). Then, deploy the Application Module. Once the Application Module has been deployed, you can use the promoteAllEmps() method in your client-side programs. Calls to the promoteAllEmps() method in client-side programs will result in calls to the promote() method in the application tier."
However, I have failed to find a single line of code explaining how it should be called.
Can anybody help me?
Best regards,
Svyatoslav Konovaltsev,
[email protected]
nullDear Steven,
1. Thank you very much. It seems to me that the problem is solved.
2. "I logged into Metalink but it wants me to put in both a tar number and a country name to see your issue." It was the United Kingdom, neither the US nor Russia if you mean my issue.
I reproduce the text to be written by everyone who encounters the same problem:
package bestclients;
import java.util.Hashtable;
import javax.naming.*;
import oracle.jbo.*;
public class BestdataHelper {
public static ApplicationModule createEJB()
throws ApplicationModuleCreateException {
ApplicationModule applicationModule = null;
try {
Hashtable environment = new Hashtable(8);
environment.put(Context.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
environment.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_EJB);
environment.put(Context.SECURITY_PRINCIPAL, "TESTER");
environment.put(Context.SECURITY_CREDENTIALS, "TESTER");
environment.put(JboContext.HOST_NAME, "localhost");
environment.put(JboContext.CONNECTION_PORT, new Integer("2481"));
environment.put(JboContext.ORACLE_SID, "ORCL");
environment.put(JboContext.APPLICATION_PATH, "/test/TESTER/ejb");
Context ic = new InitialContext(environment);
ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup("bestdata.BestdataModule");
applicationModule = home.create();
applicationModule.getTransaction().connect("jdbc:oracle:kprb:@");
applicationModule.setSyncMode(ApplicationModule.SYNC_IMMEDIATE);
catch (NamingException namingException) {
throw new ApplicationModuleCreateException(namingException);
return applicationModule;
package bestclients;
import bestdata.common.*;
import certificate.*;
public class BestClients extends Object {
public static void main(String[] args) {
BestdataModule bestdataModule = (BestdataModule)BestdataHelper.createEJB();
Certificate aCertificate = new Certificate("TESTER", "TESTER");
//calling a custom method!!
bestdataModule.passCertificate(aCertificate);
Thank you very much,
Best regards,
Svyatoslav Konovaltsev.
[email protected]
null -
Calling public class method from the servlet dopost() implementation
Hi!
My application is a simple application where i wrote a JSP page to enter the USERNAME and PASSWORD. And this JSP will call a HttpServlet
with in which i am calling another Java class ValidateUser which will check aginst the Oracle Database table whether that Username and password combination exists and returns the user's name.
But when i am trying to call that method is throwing me an error. here is the typical code i wrote.
servlet
package isispack;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;
public class Login extends HttpServlet{
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException{
String userId = req.getParameter("user_id");
String password = req.getParameter("user_pass");
// if uName is null .. user is not authorized.
String uName = Validate(userId, password);
and
Validate class
package isispack;
import java.sql.*;
import java.util.*;
import java.lang.*;
public class ValidateUser
public String ValidateUser(String inputUserid, String inputPwd) throws
SQLException{
String returnString = null;
String dbUserid = "isis"; // our Database user id
String dbPassword = "isisos" ; // our Database password
Connection con = DriverManager.getConnection("jdbc:odbc:JdbcOdbcDriver","isis","osiris");
Statement stmt = con.createStatement();
String sql= "select user_id from isis_table where user_id = '" inputUserid + "' and user_pass= '" + inputPwd +"' ;" ;
ResultSet rs = stmt.executeQuery(sql);
if (rs.next())
returnString = rs.getString("user_id");
stmt.close();
con.close();
return returnString ;
The ERROR
Error(18,18): method ValidateUser(java.lang.String, java.lang.String) not found in class isispack.Login
One more thing i forgot to tell you. I am trying to run this application on JDeveloper. Please helpme out if you can . Thank you.
-SreekanthOK! I made it static method
and tried to call the method as follows
String uName = ValidateUser.ValidateUser(userId, password);
even if i create the instence and
ValidateUser Validate;
then call
String uName= Validate.ValidateUser(userId,password)
In either case is giving me the following error.Tarun, am new to Java programming, please help me out. And can you please tell me where can i find things in consise to brush up my fundamentals?.
Error(18,43): unreported exception: java.sql.SQLException; must be caught or declared to be thrown -
Accessing a java class method from the jsp page.
Hi im a beginner with jsp and im trying to find a way to access a method of my java class file in jsp page. After searching through the forums i tried to use the usebean tag. Im using apache to host the jsp file.Below is an excerpt of my code and the error message i got. What am i doing wrong? anyone know?
<%@ page language="java" %>
<jsp:useBean id="movies" class="movie.Movie" />
<jsp:setProperty name="movies" property="*"/>
<%
movies.getStart("file:///C:/Video/Applications2/sun.mpg");
response.setContentType("text/xml");
%>
exception
org.apache.jasper.JasperException: Exception in JSP: /View.jsp:7
4: <jsp:setProperty name="movies" property="*"/>
5: <%
6:
7: movies.getStart("file:///C:/Video/Applications2/sun.mpg");
8: response.setContentType("text/xml");
9: %>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.ServletException: javax/media/ControllerListenerHi thanks for responding. Ok i did look through and it was opening some gui. I still need the program to do server side processes so cant use an applet.but i dont need the gui so i revised it and removed the gui. also im using a servlet to call the class now yet i still have the same error. Any ideas?
Below is the vid2jpg code minus the gui.
import java.io.*;
import java.awt.*;
import javax.media.*;
import javax.media.control.*;
import javax.media.format.*;
import javax.media.protocol.*;
import java.awt.image.*;
import javax.imageio.*;
public class vid2jpg implements ControllerListener
Processor p;
Object waitObj = new Object();
boolean stateOK = true;
DataSourceHandler handler;
int imgWidth;int imgHeight;
Image outputImage;
String sep = System.getProperty("file.separator");
int[] outvid;
int startFr = 1;int endFr = 1000;int countFr = 0;
boolean sunjava=true;
* Static main method
public static void main(String[] args)
if(args.length == 0)
System.out.println("No media address.");
new vid2jpg("file:///C:/Video/applications2/sun.mpg"); // or alternative "vfw://0" if webcam
else
String path = args[0].trim();
System.out.println(path);
new vid2jpg(path);
* Constructor
public vid2jpg(String path)
MediaLocator ml;String args = path;
if((ml = new MediaLocator(args)) == null)
System.out.println("Cannot build media locator from: " + args);
if(!open(ml))
System.out.println("Failed to open media source");
* Given a MediaLocator, create a processor and start
private boolean open(MediaLocator ml)
System.out.println("Create processor for: " + ml);
try
p = Manager.createProcessor(ml);
catch (Exception e)
System.out.println("Failed to create a processor from the given media source: " + e);
return false;
p.addControllerListener(this);
// Put the Processor into configured state.
p.configure();
if(!waitForState(p.Configured))
System.out.println("Failed to configure the processor.");
return false;
// Get the raw output from the Processor.
p.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW));
TrackControl tc[] = p.getTrackControls();
if(tc == null)
System.out.println("Failed to obtain track controls from the processor.");
return false;
TrackControl videoTrack = null;
for(int i = 0; i < tc.length; i++)
if(tc.getFormat() instanceof VideoFormat)
tc[i].setFormat(new RGBFormat(null, -1, Format.byteArray, -1.0F, 24, 3, 2, 1));
videoTrack = tc[i];
else
tc[i].setEnabled(false);
if(videoTrack == null)
System.out.println("The input media does not contain a video track.");
return false;
System.out.println("Video format: " + videoTrack.getFormat());
p.realize();
if(!waitForState(p.Realized))
System.out.println("Failed to realize the processor.");
return false;
// Get the output DataSource from the processor and set it to the DataSourceHandler.
DataSource ods = p.getDataOutput();
handler = new DataSourceHandler();
try
handler.setSource(ods); // also determines image size
catch(IncompatibleSourceException e)
System.out.println("Cannot handle the output DataSource from the processor: " + ods);
return false;
// setLayout(new FlowLayout(FlowLayout.LEFT));
// currPanel = new imgPanel(new Dimension(imgWidth,imgHeight));
// add(currPanel);
// pack();
//setLocation(100,100);
// setVisible(true);
handler.start();
// Prefetch the processor.
p.prefetch();
if(!waitForState(p.Prefetched))
System.out.println("Failed to prefetch the processor.");
return false;
// Start the processor
//p.setStopTime(new Time(20.00));
p.start();
return true;
* Sets image size
private void imageProfile(VideoFormat vidFormat)
System.out.println("Push Format "+vidFormat);
Dimension d = (vidFormat).getSize();
System.out.println("Video frame size: "+ d.width+"x"+d.height);
imgWidth=d.width;
imgHeight=d.height;
* Called on each new frame buffer
int nextframetime = 0;
private void useFrameData(Buffer inBuffer)
try
if(inBuffer.getData()!=null) // vfw://0 can deliver nulls
if(sunjava) // and with import javax.imageio.*;
int frametimesecs = (int)(inBuffer.getTimeStamp()/1000000000);
if(frametimesecs%10 == 0 && frametimesecs==nextframetime)
nextframetime+=10;
BufferedImage bi = new BufferedImage(outputImage.getWidth(null), outputImage.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics g = bi.getGraphics();
ImageIO.write(bi, "png", new File("images"+sep+"image_"+(inBuffer.getTimeStamp()/1000000000)+".png"));
catch(Exception e){}
* Tidy on finish
public void tidyClose()
handler.close();
p.close();
* Block until the processor has transitioned to the given state
private boolean waitForState(int state)
synchronized(waitObj)
try
while(p.getState() < state && stateOK)
waitObj.wait();
catch (Exception e)
return stateOK;
* Controller Listener.
public void controllerUpdate(ControllerEvent evt)
if(evt instanceof ConfigureCompleteEvent || evt instanceof RealizeCompleteEvent || evt instanceof PrefetchCompleteEvent)
synchronized(waitObj)
stateOK = true;
waitObj.notifyAll();
else
if(evt instanceof ResourceUnavailableEvent)
synchronized(waitObj)
stateOK = false;
waitObj.notifyAll();
else
if(evt instanceof EndOfMediaEvent || evt instanceof StopAtTimeEvent)
tidyClose();
* Inner classes
* A DataSourceHandler class to read from a DataSource and displays
* information of each frame of data received.
class DataSourceHandler implements BufferTransferHandler
DataSource source;
PullBufferStream pullStrms[] = null;
PushBufferStream pushStrms[] = null;
Buffer readBuffer;
* Sets the media source this MediaHandler should use to obtain content.
private void setSource(DataSource source) throws IncompatibleSourceException
// Different types of DataSources need to handled differently.
if(source instanceof PushBufferDataSource)
pushStrms = ((PushBufferDataSource) source).getStreams();
// Set the transfer handler to receive pushed data from the push DataSource.
pushStrms[0].setTransferHandler(this);
// Set image size
imageProfile((VideoFormat)pushStrms[0].getFormat());
else
if(source instanceof PullBufferDataSource)
System.out.println("PullBufferDataSource!");
// This handler only handles push buffer datasource.
throw new IncompatibleSourceException();
this.source = source;
readBuffer = new Buffer();
* This will get called when there's data pushed from the PushBufferDataSource.
public void transferData(PushBufferStream stream)
try
stream.read(readBuffer);
catch(Exception e)
System.out.println(e);
return;
// Just in case contents of data object changed by some other thread
Buffer inBuffer = (Buffer)(readBuffer.clone());
// Check for end of stream
if(readBuffer.isEOM())
System.out.println("End of stream");
return;
// Do useful stuff or wait
useFrameData(inBuffer);
public void start()
try{source.start();}catch(Exception e){System.out.println(e);}
public void stop()
try{source.stop();}catch(Exception e){System.out.println(e);}
public void close(){stop();}
public Object[] getControls()
return new Object[0];
public Object getControl(String name)
return null;
below is the servlet code.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class ShowMovie extends HttpServlet {
String rootURL="http://127.0.0.1:8080/Video/";
public void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//String movie=request.getParameter("movie");
String movie ="son";
getStart(movie);
response.sendRedirect(rootURL+"View.jsp");
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
public void getStart(String url){
new vid2jpg(url);
this is the error from the server. Im using tomkat 5
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: javax/media/ControllerListener
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(Unknown Source)
java.security.SecureClassLoader.defineClass(Unknown Source)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
ShowMovie.getStart(ShowMovie.java:31)
ShowMovie.processRequest(ShowMovie.java:14)
ShowMovie.doGet(ShowMovie.java:22)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
Maybe you are looking for
-
Difference b/w sy-index and sy-tabix
hai all, Could u explain the difference b/w sy-index and sy-tabix? regards, Selva
-
How do I use the IF-ELSE condition in a WHERE clause?
I want to merge the condition results of my 2 If statements. First if statement result shows only both 0 result, in second if statement result one of them has to be bigger than 0... If (Inventory) <> 0 Then If Apple = "" And Banana = ""
-
How to add calendar enries to all users in organization using powershell and EWS.
I am one of the exchange admins for our organization. Every year, we publish academic calendar data to all faculty and staff calendars. We recently updated and migrated from Exchange 2003 to Exchange 2010 which, of course, desupported MAPI and ADO.
-
Creating a BP in CRM through LSMW using IDOC
I am trying to create a buss partner in crm through LSMW using IDOC: Message Type: CRMXIF_PARTNER_SAVE_M Basic Type: CRMXIF_PARTNER_SAVE_M02 I get an error: "No update is defined for BP role 000000". I am also filling IDENTIFICATIONCATEGORY: C
-
Stuck in a set up loophole, can anyone help?
I have recently changed handsets from iphone 3 to iphone 4S. I backed up info on computer (via iTunes backup) before putting new sim in iphone4. I then restored as per instructions but cannot now get passed the screen: Set up as new iphone Restore fr