Desperately trying to find patterns with Java code samples
Greetings. Is there anyone who knows where I can find Java patterns, I am particularly looking for template, literator, composite, observer and decorator. I have gone to Hillside and Portland Repository sites, but did not find pattern sample code.
I bought the head first Java book which I love, but I would like to see more sample code. They mention pattern catalogues, and besides the Gof I cannot find any. I really want to look at loads of actual samples to get a real feel how these patterns can be applied. Where can I go please?
Thank you for any and all help.
Peace,
You're most welcome - you might check out the Head
First Design Patterns book as well.Yes, that was fun to read!
Similar Messages
-
Problem in printing pdf document with java code
Hi All
I want to print a pdf document with java code i have used PDFRenderer.jar to compile my code.
Code:
File f = new File("C:/Documents and Settings/123/Desktop/1241422767.pdf");
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
PDFFile pdfFile = new PDFFile(bb); // Create PDF Print Page
PDFPrintPage pages = new PDFPrintPage(pdfFile);
// Create Print Job
PrinterJob pjob = PrinterJob.getPrinterJob();
PageFormat pf = PrinterJob.getPrinterJob().defaultPage();
pjob.setJobName(f.getName());
Book book = new Book();
book.append(pages, pf, pdfFile.getNumPages());
pjob.setPageable(book);
// System.out.println(pjob.getPrintService());
// Send print job to default printer
pjob.print();
but when i am running my program i am getting error
Exception in thread "main" java.awt.print.PrinterException: Invalid name of PrintService.
Please anybody, knows the solution for this error?
Thanks In Advance
IndiraIt seems that either there is no default printer setup or you have too many printers or no printer setup at all. Try running the following code. It should print the list of available print services.
import java.awt.print.*;
import javax.print.*;
public class PrintServiceNames{
public static void main(String args[]) throws Exception {
PrintService[] printServices = PrinterJob.lookupPrintServices();
int i;
for (i = 0; i < printServices.length; i++) {
System.out.println("P: " + printServices);
}From the list pick one of the print service names and set it explicitly like "printerJob.setPrintService(printServices);" and then try running the program. -
Should I do this with Java Code or Stored Procs ? (for best performance)
Hi All,
I need to decide where should I implement my business logic, in Java code or Stored procs.
Here is the requirement :
- One Order has 70 products (Order_Table )
- Can be duplicate products, so I have to do summarize / grouping by product
- For every product, I have to check, if it is entitled for a Bonus product, then I have to Insert one to Bonus_Table.
- This is done when/after the transaction is SAVED (COMMIT)
The question is, which one has better PERFORMANCE :
(1) Create a rowsetIterator on the Order details (70 products) and call a stored procedure to do the logic for every single product (so that the Insert to Bonus_Table done in stored proc). means the stored proc will be called 70 times.
OR
(2) After the transaction is COMMITted, call the stored procs ONCE to do the logic for all the products at once.
OR
(3) I do all the logic with Java Code within ADF
Given the requirement above, which approach is most efficient / best performance ?
Thank you very much,
xtantoProblem with this is that you ask 100 people and you probably get 100 different answers. ;o)
Many would say that you push as much business logic into the database with your data; others might say you only put data in your database and your business logic is kept on the application server.
In reality your would probably have a mix of both and your decision would probably be influenced by your own background ...
Can't be more precise than that.
Grant -
Do you know how to call RDF with java code?
Say me a tip!
Environment:
Linux, Reports 6i,java beans, jsp
My mission is to run a report with java code.
But I don't know how to.
Basic flow is :
On web browser, call jsp a program and
that jsp call a java module,
and the java module call a reports RDF with parameters
I don't need reponse message from rwcgi60 or rwrun60.hello,
the easiest way is to use the regular HTTP request to either the servlet or the CGI to run a report request from within a java-class.
regards,
the oracle reports team --pw -
Java code sample for uploading file
Guys can some one give me a java code sample for uploading more than 1 file .
I have a working example but that is only for one file.
thanks
MThrow it away. Go to the [http://commons.apache.org/fileupload] and carefully read both 'User Guide' and 'Frequently Asked Questions' sections.
And please, please also carefully read this article: [http://balusc.blogspot.com/2008/06/what-is-it-with-roseindia.html]. -
How to display pdf file with java code?
Hi All,
i have a jsp pagein that page if i click one icon then my backing bean method will call and that method will create pdf document and write some the content in that file and now i want to display that generated pdf document.
it should look like you have pressed one icon and it displayed pdf file to you to view.
java code below:
FacesContext fc = FacesContext.getCurrentInstance();
ExternalContext ec = fc.getExternalContext();
HttpServletResponse resp = (HttpServletResponse) ec.getResponse();
resp.setHeader("Content-Disposition", "filename=\"" + temppdfFile);
resp.encodeRedirectURL(temppdfFile.getAbsolutePath());
resp.setContentType("application/pdf");
ServletOutputStream out = resp.getOutputStream();
ServletUtils.returnFile(temppdfFile, out);
out.flush();
and above temppdfFile is my generated pdf file.
when i am executing this code, it was opening dialog box for save and cancel for the file, but the name of the file it was showing me the "jsp file name" with no file extention (in wich jsp file i am calling my backing bean method) and type is "Unknown File type" and from is "local host"
it was not showing me open option so i am saving that file then that file saved as a pdffile with tha name of my jsp file and there is nothing in that file(i.e. empty file).
what is the solution for this. there is any wrong in my code.
Please suggest me.
Thanks in advance
Indirapublic Object buildBarCodes() throws Exception
File bulkBarcodes = null;
String tempPDFFile = this.makeTempDir();
File tempDir = new File("BulkPDF_Files_Print");
if(!tempDir.exists())
tempDir.mkdir();
bulkBarcodes = File.createTempFile
(tempPDFFile, ".pdf", tempDir);
//bulkBarcodes = new File(tempDir, tempPDFFile+"BulkBarcode"+"."+"pdf");
if(!bulkBarcodes.exists())
bulkBarcodes.createNewFile();
Document document = new Document();
FileOutputStream combinedOutput = new FileOutputStream(bulkBarcodes);
PdfWriter.getInstance(document, combinedOutput);
document.open();
document.add(new Paragraph("\n"));
document.add(new Paragraph("\n"));
Image image = Image.getInstance(bc.generateBarcodeBytes(bc.getBarcode()));
document.add(image);
combinedOutput.flush();
document.close();
combinedOutput.close();
FacesContext facesc = FacesContext.getCurrentInstance();
ExternalContext ec = facesc.getExternalContext();
HttpServletResponse resp = (HttpServletResponse) ec.getResponse();
resp.setHeader("Content-Disposition", "inline: BulkBarcodes.pdf");
resp.encodeRedirectURL(bulkBarcodes.getAbsolutePath());
resp.setContentType("application/pdf");
resp.setBufferSize(10000000);
ServletOutputStream out = resp.getOutputStream();
ServletUtils.returnFile(bulkBarcodes, out);
out.flush();
return "success";
This is my action method which will call when ever i press a button in my jsp page.
This method will create the barcode for the given barcode number and write that barcode image in pdf file
(i saw that pdf file which i have created through my above method, This PDF file opening when i was opening manually and the data init that is also correct means successfully it writes the mage of that barcode)
This method taking the jsp file to open because as earlier i said it was trying to open unknown file type document and i saved that file and opended with editplus and that was the jsp file in which file i am calling my action method I mean to say it was not taking the pdf file which i have created above it was taking the jsp file -
Hi I have a geometry problem.Can anyone help with java code
Hi I have a non simple polygon . My job is to make it a simple. for that First I need to find the intersecting lines say line AB intersects line CD. If so then I must replace AB & CD with AC & BD or AD or BC which ever keeps the polygon closed . So can anyone help me out with this code
import java.io.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
public class Simple{
static int POINTWID = 4; // size of points
// the x and y arrays hold the coordinates
// the B array is the order of the points in the polygon
// You want to fill the C array with the simple polygon
static double x[] = new double[200];
static double y[] = new double[200];
static int B[] = new int[200]; // the permutation matrix
static int C[] = new int[200]; // the one that becomes simple
static SimpleFrame myFrame;
static int numPoints = 3;
public static void main(String args[]) {
makePolygons();
// Create the frame to draw on
myFrame = new SimpleFrame();
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setSize(600, 600);
myFrame.setVisible(true);
public static void makePolygons(){
// Build an array of random points in the unit square
for(int i = 0; i < numPoints; i++){
x[i] = Math.random();
y[i] = Math.random();// Sample program
B[i] = i; // default permutation
// Create the simple polygon
createSimplePolygon();
* This is the only function you need to mess with
public static void createSimplePolygon(){
// Initialize the C[] array with the identity permutation
for(int i = 0; i < numPoints; i++)
C[i] = i;
// Bubble sort the points from left to right
for(int i = 0; i < numPoints; i++)
for(int j = 0; j < numPoints - 1; j++)
if(x[C[j]] > x[C[j+1]]){
int temp = C[j];
C[j] = C[j+1];
C[j+1] = temp;
public static class SimpleFrame extends JFrame{
public static JSlider numPointsSlider;
public SimpleFrame()
super("Create you own Simple Polygon");
Container content = getContentPane();
content.setLayout(new java.awt.BorderLayout());
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.setPreferredSize (new java.awt.Dimension(300, 400));
tabbedPane.addTab("Scrambled", new ScrambledPanel());
tabbedPane.addTab("Simple", new SimplePanel());
content.add(tabbedPane, java.awt.BorderLayout.CENTER);
// Slider for the number of points
numPointsSlider = new JSlider (javax.swing.SwingConstants.HORIZONTAL,
3, 100, 11);
numPointsSlider.addChangeListener (new javax.swing.event.ChangeListener () {
public void stateChanged (javax.swing.event.ChangeEvent evt) {
numPointsSliderStateChanged (evt);
content.add(numPointsSlider, java.awt.BorderLayout.SOUTH);
private void numPointsSliderStateChanged (javax.swing.event.ChangeEvent evt) {
numPoints = numPointsSlider.getValue();
makePolygons();
repaint();
public static class ScrambledPanel extends JPanel{
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
// First set the scaling to fit the window
Dimension size = getSize();
int Xwid = (int) (0.95 * size.width);
int Ywid = (int) (0.95 * size.height);
// First draw the segments
g2.setColor(Color.red);
for(int i = 0; i < numPoints; i++)
g2.drawLine((int) (Xwid * x[B[i]]),
(int) (Ywid * y[B[i]]),
(int) (Xwid * x[B[(i+1) % numPoints]]),
(int)(Ywid * y[B[(i+1) % numPoints]]));
// Now draw the points
for(int i = 0; i < numPoints; i++){
g2.fillRect((int) (Xwid * x) - POINTWID,
(int) (Ywid * y[i]) - POINTWID,
2*POINTWID + 1, 2*POINTWID + 1);
public static class SimplePanel extends JPanel{
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
// First set the scaling to fit the window
Dimension size = getSize();
int Xwid = (int) (0.95 * size.width);
int Ywid = (int) (0.95 * size.height);
// First draw the segments
g2.setColor(Color.red);
for(int i = 0; i < numPoints; i++)
g2.drawLine((int) (Xwid * x[C[i]]),
(int) (Ywid * y[C[i]]),
(int) (Xwid * x[C[(i+1) % numPoints]]),
(int)(Ywid * y[C[(i+1) % numPoints]]));
// Now draw the points
for(int i = 0; i < numPoints; i++){
g2.fillRect((int) (Xwid * x[i]) - POINTWID,
(int) (Ywid * y[i]) - POINTWID,
2*POINTWID + 1, 2*POINTWID + 1);Hi I am sorry I could explain you properly . Ok
My program gives me a polygon(as you can see when u
run this program)But the polygon is a non simple
polygon.So to make this polygon we must remove all
the crossings betweeen edges in the polygon.The
algorithm which i gave will remove all the crossings
and make the polygon simple.You did not give an algorithm!
SO my job is to take the
existing code and implement the algorithm for this
program in the Createsimpelpolygon() function. For
this First the program must find whether two edges
cross if they cross then swap the vertices like
replace AB & CD with AC & BD or AD & BC.Which ever
keeps the polygon closed . Still not entirely clear to me. You cannot just go and replace vertexes from a polygon: that way you'll end up with a different polygon.
So as we go on we find the
many crossings and iterate the algorithm on all the
crossings until we get simple polygon.Like I said: I don't really understand what it is you're after. You did not respond to my suggestions, so I gather it is not what you're after?
What about Polygon Tessellation (Google for it)? Perhaps that's what you want.
Also, why do you not create a (or use java.awt's) Point class and a Polygon class which holds a java.util.Set of Point's? Your current code looks rather messy. -
Call ABAP Web Service with Java code only
Hi all,
First of all, I am writing script in Adobe form but am not using the one in SAP.
I am trying to call the web service and process the result with script open (i.e. no dataconnection created), because I am trying to do that in a dialog.
I can call a non-SAP web service without problem, but I am not able to call a simple web service with only a single string input, anyone have any example?
Here is the SOAP for input:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:rfc:functions">
<soapenv:Header/>
<soapenv:Body>
<urn:Z_RFC_GET_STAFF_BANK_INFO>
<A_STAFF_ID>0123456</A_STAFF_ID>
</urn:Z_RFC_GET_STAFF_BANK_INFO>
</soapenv:Body>
</soapenv:Envelope>
Here is my code to call:
var cURL = "http://some-host-name:port/sap/bc/srt/wsdl/bndg_DEDB492BB032E7F1B09F001CC4FBCEC9/wsdl11/allinone/ws_policy/document?sap-client=300";
var response = SOAP.request(
cURL: cURL,
oRequest: {
"urn:sap-com:document:sap:rfc:functions:Z_RFC_GET_STAFF_BANK_INFO": {
A_STAFF_ID: "0123456"
Regards
BillHello I have the same problem, were you able to execute the WS through the JS code now?
I would like to call an ABAP WS using JavaScript to return complex structures that I would like to manage directly with JS.
I tried with this code and I get the error "RaiseError: Acrobat Raise." when the request is executed:
var WSUrl = "http://<server>:<port>/sap/bc/srt/wsdl/bndg_4D15C75529330AF1E10000000A150429/wsdl11/allinone/ws_policy/document?sap-client=500";
var VendorNumber = xfa.form.DATA.DATAFLOW.SF_HEADER.VENDOR_NUMBER.rawValue;
try {
// Create request structure, read Input out of text field
var request = {
"urn:sap-com:document:sap:soap:functions:mc-style:ZWsTest" : {ILifnr: VendorNumber}
SOAP.wireDump = true;
// Call web service using SOAP object
var response = SOAP.request ({
cURL: WSUrl,
oRequest: request
// cAction: "urn:sap-com:document:sap:soap:functions:mc-style"
} catch (e) {
xfa.host.messageBox(e.toString()); //pop-up "TypeError:service.CelsiusToFahrenheit is not a funciton"
with this other code I get the error "SOAPError: CX_ST_MATCH_ELEMENT:XSLT exception.System expected element 'ILifnr'":
try {
var myProxy = SOAP.connect(WSUrl);
var result = myProxy.ZWsTest( { ILifnr: VendorNumber } );
xfa.form.DATA.DATAFLOW.SF_HEADER.E_DESCRIPTION.rawValue = result;
// Display the response in the console:
console.println("Result is " + result);
} catch (e) {
xfa.host.messageBox(e.toString()); //pop-up "TypeError:service.CelsiusToFahrenheit is not a funciton"
in the second option, if I make the field ILifnr optional the call is succesfully performed but the parameter is not passed to the WS. So the call is working.
Using stand-alone LiveCycle designer 8.1 and Adobe Reader 8
Any suggestions?
Many thanks,
G.
Edited by: Guillem Mateu Navalón on Jan 13, 2011 1:13 PM -
Split XML in Multiple XML files with Java Code
Hi guys , i have following xml file as input ....
<?xml version="1.0" encoding="ISO-8859-1"?>
<T0020
xsi:schemaLocation="http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.safersys.org/namespaces/T0020V1">
<INTERFACE>
<NAME>SAFER</NAME>
<VERSION>04.02</VERSION>
</INTERFACE>
<TRANSACTION>
<VERSION>01.00</VERSION>
<OPERATION>REPLACE</OPERATION>
<DATE_TIME>2009-09-01T00:00:00</DATE_TIME>
<TZ>CT</TZ>
</TRANSACTION>
<IRP_ACCOUNT>
<IRP_CARRIER_ID_NUMBER>274845</IRP_CARRIER_ID_NUMBER>
<IRP_BASE_COUNTRY>US</IRP_BASE_COUNTRY>
<IRP_BASE_STATE>AR</IRP_BASE_STATE>
<IRP_ACCOUNT_NUMBER>55002</IRP_ACCOUNT_NUMBER>
<IRP_ACCOUNT_TYPE>I</IRP_ACCOUNT_TYPE>
<IRP_STATUS_CODE>100</IRP_STATUS_CODE>
<IRP_STATUS_DATE>2007-11-06</IRP_STATUS_DATE>
<IRP_UPDATE_DATE>2009-08-03</IRP_UPDATE_DATE>
<IRP_NAME>
<NAME_TYPE>LG</NAME_TYPE>
<NAME>A P SUPPLY CO</NAME>
<IRP_ADDRESS>
<ADDRESS_TYPE>PH</ADDRESS_TYPE>
<STREET_LINE_1>1400 N OATS</STREET_LINE_1>
<STREET_LINE_2/>
<CITY>TEXARKANA</CITY>
<STATE>AR</STATE>
<ZIP_CODE>71854</ZIP_CODE>
<COUNTY>MILLER</COUNTY>
<COLONIA/>
<COUNTRY>US</COUNTRY>
</IRP_ADDRESS>
<IRP_ADDRESS>
<ADDRESS_TYPE>MA</ADDRESS_TYPE>
<STREET_LINE_1>P O BOX 1927</STREET_LINE_1>
<STREET_LINE_2/>
<CITY>TEXARKANA</CITY>
<STATE>AR</STATE>
<ZIP_CODE>75504</ZIP_CODE>
<COUNTY/>
<COLONIA/>
<COUNTRY>US</COUNTRY>
</IRP_ADDRESS>
</IRP_NAME>
</IRP_ACCOUNT>
<IRP_ACCOUNT> ..... </IRP_ACCOUNT>
<IRP_ACCOUNT> ..... </IRP_ACCOUNT>
<IRP_ACCOUNT> ..... </IRP_ACCOUNT>
</T0020>
and i want to take this xml file and split it into multiple files through java code like this ...
File1.xml
<T0020>
<IRP_ACCOUNT> ..... </IRP_ACCOUNT>
<IRP_ACCOUNT> ..... </IRP_ACCOUNT>
</T0020>
File2.xml
<T0020>
<IRP_ACCOUNT> ..... </IRP_ACCOUNT>
<IRP_ACCOUNT> ..... </IRP_ACCOUNT>
</T0020>
like wise...
Each xml file contain maximum 10 or 15 IRP_ACCOUNT.
Can somebody please help me ? How can i do it with stax like start element and all ?
thanks in advance.Ah, sorry, strike that. You want multiple files. I think the easiest way is to simply parse with DOM. [http://www.w3schools.com/xpath/default.asp] . And here [http://www.w3schools.com/xpath/default.asp].
You can output the various XML elements using a PrintWriter or creating a separate DOM document for each file you want to create and serializing that.
- Saish -
Working fine with JAVA code and Error Occured while using in JSP
Hi.....
When initiating a BPEL process from JAVA the code is working fine and the Process is getting initiated.But while using that code in J2EE project as a java code and while calling that method Error is occuring.....
Here by i am attaching my JAVA Code which runs as an applicateion and package which runs in Server....
JAVA Code (Run as Application) Working Fine:
package bo;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.NormalizedMessage;
import com.oracle.bpel.client.delivery.IDeliveryService;
import java.util.Map;
import java.util.Properties;
import oracle.xml.parser.v2.XMLElement;
/*import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; */
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class processit {
public static void main(String args[]){
String input = "TATA";
String xmlInput= "<ns1:AccessDBBPELProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/AccessDBBPEL\"><ns1:input>"+input+"</ns1:input></ns1:AccessDBBPELProcessRequest>";
String xml="<ns1:BPELProcess1ProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/BPELProcess1\">";
xml=xml+"<ns1:input>"+input+"</ns1:input>";
xml=xml+"</ns1:BPELProcess1ProcessRequest>";
try{
Properties props=new Properties();
props.setProperty("orabpel.platform","ias_10g");
props.setProperty("java.naming.factory.initial","com.evermind.server.rmi.RMIInitialContextFactory");
props.setProperty("java.naming.provider.url","opmn:ormi://157.227.132.226:6003:home/orabpel");
props.setProperty("java.naming.security.principal","oc4jadmin");
props.setProperty("java.naming.security.credentials","oc4jadmin");
props.setProperty("dedicated.rmicontext", "true");
Locator locator = new Locator("default", "bpel", props);
System.out.println("After creating the locator object......");
IDeliveryService deliveryService =(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME);
System.out.println("Before creating the NormalizedMessage object......");
NormalizedMessage nm = new NormalizedMessage();
System.out.println("After creating the NormalizedMessage object.*.*.*...");
nm.addPart("payload", xml);
System.out.println("Before creating response object......");
NormalizedMessage res = deliveryService.request("BPELProcess1", "process", nm);
System.out.println("After calling the BPELProcess1 .*.*.*...");
Map payload = res.getPayload();
System.out.println("BPEL called");
XMLElement xmlEl=(oracle.xml.parser.v2.XMLElement)payload.get("payload");
String replyText=xmlEl.getText();
System.out.println("Reply from BPEL Process>>>>>>>>>>>>> "+replyText);
catch (Exception e) {
System.out.println("Exception : "+e);
e.printStackTrace();
JSP and Java Method Used:
JSP Code:
===============
<%@ page import=" bo.callbpel" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>FEATT - I30</title>
</head>
<body>
<%
String input=request.getParameter("dnvalue");
callbpel p=new callbpel();
String Output=p.Initiate(input);
out.print("The Input Given to the BPEL Process is : "+input);
%>
<BR><BR><BR><BR><BR><BR>
<%
out.print("The Reply from BPEL Process is : "+Output);
%>
</body>
</html>
Java Code:
package bo;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.NormalizedMessage;
import com.oracle.bpel.client.delivery.IDeliveryService;
import java.util.Map;
import java.util.Properties;
import oracle.xml.parser.v2.XMLElement;
/*import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; */
//import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class callbpel {
public String Initiate(String value){
String replyText=null;
String input = value;
System.out.println(input);
String xmlInput= "<ns1:AccessDBBPELProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/AccessDBBPEL\"><ns1:input>"+input+"</ns1:input></ns1:AccessDBBPELProcessRequest>";
String xml="<ns1:BPELProcess1ProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/BPELProcess1\">";
xml=xml+"<ns1:input>"+input+"</ns1:input>";
xml=xml+"</ns1:BPELProcess1ProcessRequest>";
try{
Properties props=new Properties();
props.setProperty("orabpel.platform","ias_10g");
props.setProperty("java.naming.factory.initial","com.evermind.server.rmi.RMIInitialContextFactory");
props.setProperty("java.naming.provider.url","opmn:ormi://157.227.132.226:6003:home/orabpel");
props.setProperty("java.naming.security.principal","oc4jadmin");
props.setProperty("java.naming.security.credentials","oc4jadmin");
props.setProperty("dedicated.rmicontext", "true");
Locator locator = new Locator("default", "bpel", props);
String uniqueBpelId = com.collaxa.cube.util.GUIDGenerator.generateGUID();
//System.out.println(uniqueBpelId);
//java.util.Map msgProps = new HashMap();
System.out.println("After creating the locator object......");
IDeliveryService deliveryService =(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME);
System.out.println("Before creating the NormalizedMessage object......");
NormalizedMessage nm = new NormalizedMessage();
System.out.println("After creating the NormalizedMessage object.*.*.*...");
//msgProps.put("conversationId",uniqueBpelId);
//nm.setProperty("conversationId",uniqueBpelId);
nm.addPart("payload", xml);
System.out.println("Before creating response object......");
NormalizedMessage res = deliveryService.request("BPELProcess1", "process", nm);
System.out.println("After calling the BPELProcess1 .*.*.*...");
Map payload = res.getPayload();
System.out.println("BPEL called");
XMLElement xmlEl=(oracle.xml.parser.v2.XMLElement)payload.get("payload");
replyText=xmlEl.getText();
System.out.println("Reply from BPEL Process>>>>>>>>>>>>> "+replyText);
catch (Exception e) {
System.out.println("Exception : "+e);
e.printStackTrace();
return replyText;
While Creating and Object for the Class callbpel and Whilw Calling that Method
callbpel p=new callbpel();
String Output=p.Initiate(input);
Its throwing an Error:
Error Occured is:
After creating the locator object......
Before creating the NormalizedMessage object......
After creating the NormalizedMessage object.*.*.*...
Before creating response object......
Apr 24, 2008 9:12:00 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: javax/ejb/EJBException
at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:76)
at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:254)
at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:83)
at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:53)
at bo.callbpel.Initiate(callbpel.java:55)
at org.apache.jsp.output_jsp._jspService(output_jsp.java:55)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
For Running JSP i am Using Eclipse 3.2.0 and apache-tomcat-5.5.25
Please Provide me a Solution......
Thanks in Advance.....
Regards,
Suresh KA JSP is not the same as a Java application. A Java application has package statment, import statements, try/catch block, a JSP doesn't.
-
How to lunch Java Console with java code?
Hi all,
I have an application which runs using JWS, everything is fine (running during 3 years), but sometimes an unexpected Exception happens, and my client doe not have the Java Console Activated to show (in Windows Control Panel).
What I want to do is:
set in the java code to whenever Exceptions occur the Java Console shows up and he (the client) can see and send me the Error Exception.
Does anybody know how can I set that in my code?
Thanks.Just some using XML, I dont want to use XML
configuratio.You don't need to use XML for log4j configuration. Log4j properties are set in a .properties file.
But it sounds like you should build your own logging framework where for every exception that occurs you call the framework and then it will display the exception and stack trace in a dialog box and proceed to email the exception to an email list specified within a property file. -
Hi im trying to sign up with printer code but i can not find the application
I just bought the printer and I am trying to set up the eprint Mobile.
Please read this post then provide some details.
http://h30434.www3.hp.com/t5/Other-printing-questions/Want-Good-Answers-Ask-Good-Questions/m-p/2094#...
Say "Thanks" by clicking the Kudos Star in the post that helped you.
Although I work for HP my posts and replies are my own
Please mark the post that solves your problem as "Accepted Solution" -
How to insert/update Date field in Oracle with java code
Dear All
I have to insert/update a date column while creating a new item, but the problem is i am able to insert/update only date but i need both date and time along with AM/PM.
By using these 3 lines i am able to insert/update only date.
java.util.Date date = new java.util.Date();
long dateLong = date.getTime();
stmtPrep.setDate(33, new java.sql.Date(dateLong));
Below code retrives the date exactly what i need but unable to pass in the statement:
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss a");
java.util.Date d = (Date) new java.util.Date();
String stringdate = formatter.format(d);
String tmpdate = dateFormat();
stmtPrep.setString(33, tmpdate); -- I tried with setObject as well but same error coming.
Error is:
ORA-01830: date format picture ends before converting entire input string
Can u guide me how to get full date time with AM/PM?sasikrishna wrote:
Dear All
I have to insert/update a date column while creating a new item, but the problem is i am able to insert/update only date but i need both date and time along with AM/PM.
By using these 3 lines i am able to insert/update only date.
java.util.Date date = new java.util.Date();
long dateLong = date.getTime();
stmtPrep.setDate(33, new java.sql.Date(dateLong));That's by design. A java.sql.Date object matches an SQL DATE column (which doesn't include a time component). If you want something which matches an SQL TIMESTAMP colum (which includes both date and time components) then you should use a java.sql.Timestamp object. -
Trying to run programs with java 1.4.2_07 after upgrading Eclipse
Hi All,
I'm using Eclipse version 3.1.0 and java 5.0 (1.5.0_03). I changed the JRE of a program back to 1.4.2_07, but when i try to run it i get this:
Exception in thread "main" java.lang.UnsupportedClassVersionError: controller/Controller (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)What the %^#@ ? Will appreciate any help.
Regards,
snayitAlso, another thing people may want to try. A coworker was having a problem where she kept getting the unsupported major minor version error from eclipse after upgrading to the latest version of java.
All the configuration settings were correct, pointing to the latest vm. I tried starting eclipse with the parameter
-vm "C:\Program Files\Java\jdk1.5.0_04\jre\bin\javaw.exe"
and it worked just fine. Without this, it was apparently finding some conflict between jdk1.5 and the older jdk1.4.
IDE's are nice, but I find configuring them after an upgrade to be exremely painful. -
How to use the XULRunner with JAVA Code
Hi, all
I have a big problem about XULRunner. I can not find a nice solution on the internet. So I have to request you to give me some ideas.
We know the XULRunner is nice solution when we want to embed a browser into desktop program which is thunderbird, firefox and so on.
My questions are the following:
1. Can I execute a Java function accross the JAVASCript? We can execute javascript code in the JAVA, but I'm not sure I can do opposite it.
2. What is javaxpcom?
If you did program like this, please give me some ideas, thanks very much.I marked this as "off-topic" since it's not a Firefox support question.
Another place for discussion related to XULRunner, besides the Mozilla community links at https://developer.mozilla.org/en-US/docs/Mozilla/Projects/XULRunner might be one of the [http://forums.mozillazine.org/ MozillaZine forums], such as the Mozilla Development forum:
*http://forums.mozillazine.org/viewforum.php?f=27
EDIT: I'm leaving this question open since it's about another Mozilla product and I'm escalating it to the Helpdesk in case anyone over there has a suggestion.
Maybe you are looking for
-
I do need mountain lion so I can use icloud. When I downloaded Mountain lion I couldn't find any of my docs because (as it turns out) my hard drive was split and so now everything is in sepperate places and I cant find bits etc. So....... I want ever
-
I have a small query where I have to retrieve vendor details not including the vendors starting with '9'. I have written the below query for that. select b~lifnr " Vendor number into corresponding fields of table gi_output_vendors from lfa1 wh
-
Drag and drop of multiple nodes between 2 trees
Hi, I am trying to implement a drag and drop of multiple nodes between two different trees. A simple drag drop written on the lines of the demo code RSDEMO_DRAG_DROP_TREE_MULTI works perfectly fine. But my requirement is, when a child (leaf) node is
-
What is the need for BWA1 , BWA5 , BWA7 and BWA8 transactions in the CRM system.Can I extract just like an R/3 extractors . I find some contradictions in other sdn docs.. Thanks in advance
-
Whats happened to my firewire???????
I haven't used my DV camcorder for a while but when I came to download some baby footage, my camera couldn't be seen by the computer. When I went to ' about this computer - more info - firewire, it used to have info on speed etc. but now it has nothi