2 phase commit in java..!!!!!!!! VERY URGENT!!!!!!!!
Hi,
Can I implement 2 phase commit in a standalone java application ?
I access multiple databases with different connection objects in a single class in a single transaction. But how do I implement the 2 phase commit manually in a java standalone application.
Please note that I dont have any environment(like server, jndi etc.,) where i can deploy the datasources.
So pls let me know whether i can implement distributed transactions in this scenario.
This is very urgent.
There are two ways:
1. use an existing transaction monitor, either via an app server, or I think some, such as Tuxedo, can be used on their own, but even then you might need some elements of J2EE such as JNDI to use this. JBoss is a free app server that allows you to access its services, such as connection pooling and transaction monitoring, without having to rewrite your app as EJB or servlet based.
2. write your own.
Similar Messages
-
How to pass data from SAP to JAVA ( very urgent )
Hi Experts,
I have worked in ABAP, but now I joined to a new company. Here in my project requirement is as below:
1. Need to transfer data ( account information ) from SCRM to SAP ( Business partner) using JCO.
2. Need to transfer material information from SAP to SCRM through JCO.
for 1st one I got solution in java and JSP , but for 2nd requirement I am unable to get. Can u please help me in this. How to do this and if any code required for this can u send me to me.
Very urgent , please help me.
Thanks in advance,
HP.Hi,
Follow the below link..
https://www.sdn.sap.com/irj/sdn/advancedsearch?query=crm+jco%27s&cat=sdn_all&start=11
Award Points If Useful... -
I have a rmi application runninfg on one server (called 1), and web application accessing that application (running on JRUN 3.0) from onother server (called 2).
[ I am newly setting up this structure on another servers (fallback server).
Its working file in the existing servers (live server) ]
There is a perticular methode in a class for which i get the java.rmi.servererror nosuchmethodefound error. If i try any other methode it works fine. the erro only comes for that perticular methode.
I have check the class files (interface, implementation etc.) the methode is perfect and working on the other server.
There is no flow found in any code on any server (1 or 2).the code is perferct.
I can not fild the flaw so please help me its very urgent and criticle.
please help me on thiswill the out of date interface or stub process other methodes and gives problem to perticular methode.
all other methodes in the class works fine its only that perticular methode gives me the problem.
I actualy recomplied every file and still the error is still there -
How to use a DropDownList in Java Swing.Its very very Urgent
Hi Sir,
Here i need to know how to do (or) create a dropdownlist by using Java Swing.I know that there is JMenuBar & JMenuItems without using that when i click a JButton for example the dropdownlist should come from the top to bottom.I have already posted this quesion once.And i found that it has been removed.So i hope that this time i will get a better answer.Pls.do provide the code as well sir.So that i will be very thankful to u.Since i am involved in a project which contains this
feature.It is very very Urgent.So pls.do provide the code i will be waiting for the reply.
Thanx,
m.ananthuuse JComboBox
JComboBox liste = new JComboBox(new Object[]{"azerty","qwerty});the api documentation :
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComboBox.html
the turotial on combobox :
http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html -
Distributed transactions and 2-phase commit in a SAP Netweaver environment
Hello,
I am a Java architect., I don't know very much the SAP technologies. I tried to found on forums or technical papers if SAP does support distributed transactions and two-phase commit, it's not clear. I found something on SAP WAS but my project is using a SAP PI 7.0 and I cannot find anything on the subject.
My goal is to include a SAP server (via PI 7.0) in a distributed transaction handled by a J2EE ESB (Oracle, ex-BEA Aqualogic) based on XA capabilities.
Does anyone have experience or feedback on this topic ?
Thanks.Hi,
Do you know this white paper ?
[Distributed Transaction and 2 phase commit|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3732d690-0201-0010-a993-b92aab79701f]
Regards,
Olivier -
XML SQL utility ( Very Urgent)
Hi,
Running the Client side Front-End works for me....Thank you
very much. These are all my questions.
1. As far as my understanding goes XML Parsers are used to parse
the incoming XML documents before updating the database. But
when I used the Oraxle XML class(getXML option)I found one
command line option called -useDOMDoc( Use the DOM API to
generate the XML doc). I am not clear about it's functionality.
Why it's being used to create a XML document? Or explain me
clearly about the functionality of getXML option?
2.With the help of putXML command line option I could insert one
XML document into Oracle 8i ( I could insert one table only). My
question is if I have a XML document which contains elements
from two tables( emp and detail) and tags from the same two
table too. In that case how could I insert into two tables? what
I should do?
For example my DTD has columns for two tables emp and detail.
Here is my xml document, and the command which I am going to use
in the command line would be
java OracleXML putXML -user "scott/tiger" -filename xxxxx emp,
details
<?xml version="1.0"?>
<!DOCTYPE ROWSET [
<!ELEMENT ROWSET (ROW)*>
<!ELEMENT ROW (EMPNO, ENAME?, JOB?, MGR?, HIREDATE?, SAL?,
COMM?, DEPTNO?)>
<!ATTLIST ROW num CDATA #REQUIRED>
<!ELEMENT EMPNO (#PCDATA)>-----------To Table EMP
<!ELEMENT ENAME (#PCDATA)>-----------To Table EMP
<!ELEMENT JOB (#PCDATA)>-------------To Table EMP
<!ELEMENT MGR (#PCDATA)>-------------To Table EMP
<!ELEMENT HIREDATE (#PCDATA)>--------To Table EMP
<!ELEMENT SAL (#PCDATA)>-------------To Table EMP
<!ELEMENT COMM (#PCDATA)>------------To Table EMP
<!ELEMENT DEPTNO (#PCDATA)>----------To Table EMP
<!ELEMENT LOCATION (#PCDATA)>--------To Table DETAILS
<!ELEMENT ALLOWANCE (#PCDATA)>-------To Table DETAILS
]>
<ROWSET>
<ROW num="1">
<EMPNO>88</EMPNO>
<ENAME>cmos</ENAME>
<LOCATION>usa</LOCATION>
<ALLOWANCE>1000</ALLOWANCE>
</ROW>
</ROWSET>
Thanks,
Chan...
nullHi Chan,
Hello Mr. "very urgent" Chan,
1- The command line front end of the XSU, besides being useful
for you users, it is also a great tool for us to test the XSU.
Basically the -useDOMDoc makes the XSU use OracleXMLDocGenDOM to
generate the doc. When using the query API you can pass the
OracleXMLDocGenDom class to the getXML request and instead of a
string contining the xml document you will get back a DOM tree
(i.e. Document object).
2- This issue is visited at:
http://f2.dejanews.com/oracletechnet/members/index.cgi?do=showmsg
&conf=Oracl1.XML&msg=1431&show=all&depth=all
Chan (guest) wrote:
: Hi,
: Running the Client side Front-End works for me....Thank you
: very much. These are all my questions.
: 1. As far as my understanding goes XML Parsers are used to
parse
: the incoming XML documents before updating the database. But
: when I used the Oraxle XML class(getXML option)I found one
: command line option called -useDOMDoc( Use the DOM API to
: generate the XML doc). I am not clear about it's functionality.
: Why it's being used to create a XML document? Or explain me
: clearly about the functionality of getXML option?
: 2.With the help of putXML command line option I could insert
one
: XML document into Oracle 8i ( I could insert one table only).
My
: question is if I have a XML document which contains elements
: from two tables( emp and detail) and tags from the same two
: table too. In that case how could I insert into two tables?
what
: I should do?
: For example my DTD has columns for two tables emp and detail.
: Here is my xml document, and the command which I am going to
use
: in the command line would be
: java OracleXML putXML -user "scott/tiger" -filename xxxxx emp,
: details
: <?xml version="1.0"?>
: <!DOCTYPE ROWSET [
: <!ELEMENT ROWSET (ROW)*>
: <!ELEMENT ROW (EMPNO, ENAME?, JOB?, MGR?, HIREDATE?, SAL?,
: COMM?, DEPTNO?)>
: <!ATTLIST ROW num CDATA #REQUIRED>
: <!ELEMENT EMPNO (#PCDATA)>-----------To Table EMP
: <!ELEMENT ENAME (#PCDATA)>-----------To Table EMP
: <!ELEMENT JOB (#PCDATA)>-------------To Table EMP
: <!ELEMENT MGR (#PCDATA)>-------------To Table EMP
: <!ELEMENT HIREDATE (#PCDATA)>--------To Table EMP
: <!ELEMENT SAL (#PCDATA)>-------------To Table EMP
: <!ELEMENT COMM (#PCDATA)>------------To Table EMP
: <!ELEMENT DEPTNO (#PCDATA)>----------To Table EMP
: <!ELEMENT LOCATION (#PCDATA)>--------To Table DETAILS
: <!ELEMENT ALLOWANCE (#PCDATA)>-------To Table DETAILS
: ]>
: <ROWSET>
: <ROW num="1">
: <EMPNO>88</EMPNO>
: <ENAME>cmos</ENAME>
: <LOCATION>usa</LOCATION>
: <ALLOWANCE>1000</ALLOWANCE>
: </ROW>
: </ROWSET>
: Thanks,
: Chan...
Oracle Technology Network
http://technet.oracle.com
null -
Error during GR(very very urgent)
Hi all,
i am using a developed program for GR.i used this program before.there was no error.but now i am facing error like
<b>PO ordered quqntity exceeded by 18,000 EA.</b>.i am using <b>BAPI_GOODSMVT_CREATE</b> for goods transfer.
In the selection screen, i am putting
PO number- PO1
material number- MAT
GR quantity- 18,000
delivery order-111
i want to receive the material MAT of quantity 18,000 from that PO.initially i have ordered PO quntity as 1 lakh. Till now i have received 42,000 materials,now i try to receive 18,000 materials.but it is showing this type of error.
This error is fired from the return parameter of that BAPI only.error having message class-M7 & error no-022
is comming.
i am giving my coding below.plz suggest where is the problem.it is very very urgent.recently my company has added some patches to update the SAP.is this the cause for that error.plz suggest.
any idea will be highly appreaciated.
Regards
REPORT zmui001
LINE-SIZE 140
LINE-COUNT 65
NO STANDARD PAGE HEADING.
*-- DATA DECLARATION--
*-- tables
TABLES : ekpo,
ekbe,
marv.
*--Includes
INCLUDE : <icon>. " Include for Icons
*-- Types
TYPES : BEGIN OF t_mseg,
ebeln LIKE ekko-ebeln,
name1 LIKE lfa1-name1,
lifnr LIKE lfa1-lifnr,
eknam LIKE t024-eknam,
mblnr LIKE mkpf-mblnr,
matnr LIKE ekpo-matnr,
maktx LIKE makt-maktx,
lgort LIKE mseg-lgort,
charg LIKE mseg-charg, "chg: 10/17/2005
menge LIKE mseg-menge,
budat LIKE mkpf-budat,
bldat LIKE mkpf-bldat, " chg : 08/18/2003
xblnr LIKE mkpf-xblnr,
END OF t_mseg.
DATA: BEGIN OF t_ekbe,
ebeln LIKE ekbe-ebeln,
ebelp LIKE ekbe-ebelp,
bwart LIKE ekbe-bwart,
matnr LIKE ekbe-matnr,
menge LIKE ekbe-menge,
END OF t_ekbe,
BEGIN OF t_ekpo,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
menge LIKE ekpo-menge,
END OF t_ekpo.
TYPES : BEGIN OF t_options.
INCLUDE STRUCTURE itcpo.
TYPES : END OF t_options.
*--Internal tables
DATA: BEGIN OF i_item OCCURS 50. "Create Material Document Item
INCLUDE STRUCTURE bapi2017_gm_item_create.
DATA: END OF i_item .
DATA: BEGIN OF i_return OCCURS 20. "Return parameter
INCLUDE STRUCTURE bapiret2.
DATA: END OF i_return.
DATA: BEGIN OF i_part OCCURS 0, " Internal table for split data
part(20),
END OF i_part.
DATA: BEGIN OF i_return1 OCCURS 20. "Return parameter
INCLUDE STRUCTURE bapiret1.
DATA: END OF i_return1.
*-- Work areas
DATA: BEGIN OF wa_header . "Material Document Header Data
INCLUDE STRUCTURE bapi2017_gm_head_01.
DATA: END OF wa_header .
DATA: BEGIN OF wa_return . "Output Structure
INCLUDE STRUCTURE bapi2017_gm_head_ret.
DATA: END OF wa_return .
*-- Work areas
DATA: wa_mseg TYPE t_mseg,
wa_ekbe LIKE t_ekbe,
wa_ekpo LIKE t_ekpo,
wa_options TYPE t_options,
i_ekbe LIKE STANDARD TABLE OF t_ekbe,
i_ekbe2 LIKE STANDARD TABLE OF t_ekbe,
i_ekpo LIKE STANDARD TABLE OF t_ekpo.
*---Variables
DATA: v_first, " variable to get first digit
v_set TYPE c,
v_found TYPE p,
v_menge TYPE p,
v_ebeln LIKE ekko-ebeln,
v_lifnr LIKE ekko-lifnr,
v_belnr LIKE ekbe-belnr,
v_postdate LIKE mkpf-budat,
v_bukrs LIKE marv-bukrs,
v_datum LIKE sy-datum,
v_lgort LIKE mard-lgort, " Stge. location
v_bwart LIKE mseg-bwart, " Movement type
v_infnr LIKE eina-infnr, " Info record no.
v_ltsnr LIKE eina-ltsnr.
*---Constants
CONSTANTS: c_comma TYPE c VALUE ',', " For splitting data at commas
c_01(2) TYPE c VALUE '01', " For movement code in Bapi
c_b TYPE c VALUE 'B', " For mvt. Indicator in Bapi
c_save(4) TYPE c VALUE 'SAVE', " For button text
c_clear(5) TYPE c VALUE 'CLEAR', " For clear button
c_mvmt(4) TYPE c VALUE 'MVMT',
c_ok(2) TYPE c VALUE 'OK',
c_error(5) TYPE c VALUE 'Error'.
*--SELECTION SCREEN DESIGN--
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
PARAMETERS: p_bar(75) , " Scanned data from barcode
p_ebeln LIKE ekko-ebeln, " PO number
p_matnr LIKE ekpo-matnr, " Material number
p_menge LIKE ekpo-menge, " Quantity
p_lifnr LIKE ekko-lifnr, " Vendor code
p_frbnr LIKE mkpf-frbnr, " Reference doc for goods mvt
p_status(5) TYPE c.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN PUSHBUTTON 15(10) v_save USER-COMMAND mvmt.
SELECTION-SCREEN PUSHBUTTON 40(10) v_clear USER-COMMAND clear.
INITIALIZATION -
INITIALIZATION.
v_save = c_save .
v_clear = c_clear.
*--AT SELECTION_SCREEN--
AT SELECTION-SCREEN .
IF sy-ucomm = c_clear.
PERFORM f_clear.
ELSE.
IF sy-ucomm <> c_mvmt.
if not sy-tabix is initial and sy-ucomm <> c_mvmt.
*--- Extracting the data by splitting the scanned values.
PERFORM f_get_split_data.
*--- Validating the input data.
PERFORM f_check_inputs.
ELSE .
*--- Validating the input data.
PERFORM f_check_inputs.
*-- Determining the posting date and period check.
PERFORM f_get_posting_date.
*---Post goods movement
PERFORM f_post_receipt.
ENDIF.
ENDIF.
SUBROUTINES *
*& Form f_check_inputs
Validating the input parameters
FORM f_check_inputs.
*-- Validating material no.
SELECT SINGLE matnr INTO p_matnr
FROM mara
WHERE matnr = p_matnr.
IF sy-subrc = 4.
p_status = c_error.
MESSAGE e003(zm) WITH 'Material no.'.
ENDIF.
*-- Validating JHT reference no.
SELECT SINGLE ebeln
lifnr
bukrs
INTO (p_ebeln, v_lifnr , v_bukrs)
FROM ekko
where unsez = p_unsez. chg:07072003
WHERE ebeln = p_ebeln.
IF sy-subrc = 4.
p_status = c_error.
MESSAGE e003(zm) WITH 'Purchase order no.'.
ENDIF.
*-- Validating material po combination
SELECT SINGLE *
FROM ekpo
WHERE ebeln = p_ebeln
AND matnr = p_matnr.
IF sy-subrc = 4.
p_status = c_error.
MESSAGE e003(zm) WITH 'Purchase order no.' ' and Material no.'.
ENDIF.
*--- Checking for DO entry . (chng : 30/06/2003)
IF p_frbnr IS INITIAL.
MESSAGE e018(m7) WITH 'Delivery no.'.
p_status = c_error.
PERFORM f_clear.
ENDIF.
*-- Validating material po do combination
SELECT SINGLE a~belnr
INTO v_belnr
FROM ekbe AS a
INNER JOIN mkpf AS b
ON abelnr = bmblnr
AND agjahr = bmjahr
WHERE a~ebeln = ekpo-ebeln
AND a~ebelp = ekpo-ebelp
AND b~xblnr = p_frbnr.
IF sy-subrc = 0.
MESSAGE e019(zm) WITH v_belnr.
p_status = c_error.
PERFORM f_clear.
ENDIF.
p_status = c_ok.
ENDFORM. " f_check_inputs
*& Form f_get_split_data
Extracting the data by splitting the Scanned data
FORM f_get_split_data.
*-- Splitting the data at commas
SPLIT p_bar AT c_comma INTO TABLE i_part.
*-- Assigning the parts to variables.
LOOP AT i_part.
v_first = i_part-part+0(1).
TRANSLATE v_first TO UPPER CASE.
CASE v_first .
WHEN 'V'.
p_lifnr = i_part-part+1(10).
WHEN 'P'.
p_matnr = i_part-part+1(18).
WHEN 'Q'.
p_menge = i_part-part+1(13).
WHEN 'K'.
p_ebeln = i_part-part+1(10).
WHEN 'D'.
p_frbnr = i_part-part+2(16).
WHEN OTHERS.
CONTINUE.
ENDCASE.
ENDLOOP.
ENDFORM. " f_get_split_data
*& Form f_get_posting_date
Determing the posting date for document
FORM f_get_posting_date.
*-- get the current period for todays date.
DATA: l_period LIKE t009b-poper.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum
i_periv = 'K4'
IMPORTING
e_buper = l_period
E_GJAHR =
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*-- Determining whether the open period
SELECT SINGLE *
FROM marv
WHERE bukrs = v_bukrs.
IF sy-subrc = 0.
IF l_period = marv-lfmon .
v_postdate = sy-datum.
ELSE.
CALL FUNCTION 'BAPI_CCODE_GET_FIRSTDAY_PERIOD'
EXPORTING
companycodeid = v_bukrs
fiscal_period = marv-lfmon
fiscal_year = marv-lfgja
IMPORTING
first_day_of_period = v_postdate
return = i_return1.
IF NOT i_return[] IS INITIAL.
LOOP AT i_return1.
MESSAGE i016(zm) WITH i_return-message.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " f_get_posting_date
*& Form f_post_receipt
Post the goods receipt for entered data.
FORM f_post_receipt.
PERFORM f_fill_item.
PERFORM f_fill_header.
PERFORM f_execute_transfer.
PERFORM f_clear.
ENDFORM. " f_post_receipt
*& Form f_fill_item
Updating the item data for the GR
FORM f_fill_item.
Checking for IQC cycle is done here.(chng : 23/07/2003)
PERFORM f_check_iqc.
*---- Assigning movement type as per IQC cycle.(chng : 23/07/2003)
IF v_lgort IS INITIAL.
MOVE '101' TO i_item-move_type.
SELECT SINGLE lgort INTO i_item-stge_loc
FROM ekpo
where ebeln = v_ebeln and " chg :07/07/2003
WHERE ebeln = p_ebeln AND
matnr = p_matnr .
ELSE.
MOVE v_lgort TO i_item-stge_loc.
MOVE v_bwart TO i_item-move_type.
ENDIF.
MOVE p_matnr TO i_item-material.
MOVE p_menge TO i_item-entry_qnt.
move v_ebeln to i_item-po_number. " 07/07/2003
MOVE p_ebeln TO i_item-po_number.
MOVE v_lifnr TO i_item-vendor.
MOVE c_b TO i_item-mvt_ind.
select single ebelp into i_item-po_item " chg :29/07/2003
from ekpo
where ebeln = p_ebeln
and matnr = p_matnr
and elikz = ''.
SELECT ebeln
ebelp
matnr
menge
INTO CORRESPONDING FIELDS OF TABLE i_ekpo
FROM ekpo
WHERE ebeln = p_ebeln
AND matnr = p_matnr
AND loekz = '' .
SORT i_ekpo BY ebeln ebelp matnr.
LOOP AT i_ekpo INTO wa_ekpo.
IF v_found = 0.
SELECT ebeln ebelp
bwart menge
INTO CORRESPONDING FIELDS OF TABLE i_ekbe
FROM ekbe
WHERE ebeln = p_ebeln
AND ebelp = wa_ekpo-ebelp
AND matnr = p_matnr.
and elikz = '' . CHG -- 03/19/2004
IF sy-subrc = 0.
LOOP AT i_ekbe INTO wa_ekbe .
IF wa_ekbe-bwart = '101'.
v_menge = v_menge + wa_ekbe-menge.
ENDIF.
IF wa_ekbe-bwart = '102'.
v_menge = v_menge - wa_ekbe-menge.
ENDIF.
IF wa_ekbe-bwart = '122'.
v_menge = v_menge - wa_ekbe-menge.
ENDIF.
ENDLOOP.
chng: 03/19/2004 compare po qty against receipt
v_menge = v_menge + p_menge .
IF wa_ekpo-menge >= v_menge .
v_found = 1.
MOVE wa_ekpo-ebelp TO i_item-po_item.
ENDIF.
ELSE .
v_found = 1.
MOVE wa_ekpo-ebelp TO i_item-po_item.
ENDIF.
ENDIF.
CLEAR : wa_ekbe, i_ekbe, v_menge.
ENDLOOP.
IF v_found = 0 .
MESSAGE e003(zm) WITH ' delivery items'.
ENDIF.
APPEND i_item.
CLEAR : i_item, v_found .
ENDFORM. " f_fill_item
*& Form f_check_iqc
Checking the storage location for the (chng : 23/07/2003)
FORM f_check_iqc.
CALL FUNCTION 'Z_M_GET_IQC_STATUS'
EXPORTING
matnr = p_matnr
lifnr = v_lifnr
IMPORTING
lgort = v_lgort
bwart = v_bwart
ltsnr = v_ltsnr
infnr = v_infnr
EXCEPTIONS
non_iqc_vendor = 1
OTHERS = 2.
IF sy-subrc <> 0.
CLEAR : v_lgort , v_bwart , v_ltsnr.
ENDIF.
ENDFORM. " f_check_iqc
*& Form f_fill_header
Updating data in the header
FORM f_fill_header.
MOVE v_postdate TO wa_header-pstng_date.
MOVE sy-datum TO wa_header-doc_date.
MOVE p_frbnr TO wa_header-ref_doc_no.
ENDFORM. " f_fill_header
*& Form f_execute_transfer
Executing the goods movement.
FORM f_execute_transfer.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_header
goodsmvt_code = c_01
IMPORTING
goodsmvt_headret = wa_return
TABLES
goodsmvt_item = i_item
return = i_return.
IF i_return[] IS INITIAL .
COMMIT WORK.
*--- UPdating Info record for IQC cycle ind.(chng : 23/07/2003)
IF NOT v_ltsnr IS INITIAL.
UPDATE eina SET ltsnr = v_ltsnr
WHERE infnr = v_infnr.
ENDIF.
REFRESH : i_item.
CLEAR : wa_header,v_ltsnr , v_infnr,v_bwart,v_lifnr.
MESSAGE i012(migo) WITH wa_return-mat_doc.
PERFORM f_do_print.
ELSE.
REFRESH : i_item.
CLEAR : wa_header,v_ltsnr , v_infnr,v_bwart,v_lifnr.
PERFORM write_errors.
ENDIF.
ENDFORM. " f_execute_transfer
FORM write_errors.
WRITE: 0(90) sy-uline ,
/0'|',
3 'System messages for GR posting',
90 '|',
/0(90) sy-uline .
LOOP AT i_return.
CASE i_return-type.
WHEN 'E'.
MESSAGE i016(zm) WITH i_return-message.
WHEN 'W'.
MESSAGE i017(zm) WITH i_return-message.
WHEN 'I'.
WRITE: /0'|',
icon_yellow_light AS ICON ,
'|',
10 i_return-message,
90 '|'.
MESSAGE i018(zm) WITH i_return-message.
WHEN 'S'.
WRITE: /0'|',
icon_green_light AS ICON ,
'|',
10 i_return-message,
90 '|'.
MESSAGE i018(zm) WITH i_return-message.
WHEN OTHERS.
WRITE: /0'|',
icon_red_light AS ICON ,
'|',
10 i_return-message,
90 '|'.
MESSAGE e016(zm) WITH i_return-message.
ENDCASE.
AT LAST .
WRITE:/0(90) sy-uline .
ENDAT.
ENDLOOP.
ENDFORM. " write_errors
*& Form f_clear
Clearing the input parameters
FORM f_clear.
CLEAR : p_ebeln ,
p_bar,
p_matnr,
p_frbnr,
v_lifnr,
p_menge,
p_status.Hi all,
can anyone suggest any idea?
Regrds
pabitra -
Two phase commit and bean managed transactions
To all the Transaction GURUS!
Hi guys (-and gals).
I've been doing J2EE for quite a while, but today was my first at
XA-Transactions and Bean Managed Transactions.
Why am I doing this?
====================
Well I have to be able to controll the transactionalbehaviour of my
bean
during runtime, since some bean calls would cause a transactional
overflow due to the stress they would cause to the system, whereas
smaller bean calls need to run in one transaction.
-> Therefore I need Bean Managed Transactions
Since the bean does a call on two Database Connections it has to use a
XA-Transaction.
-> Therefore I need XA-Transactions.
Abstract
========
- I just can't get a User TransAction into the right Status it stays
in 'STATUS_NO_TRANSACTION' all the time
- Therefore the SQL Commands can be comitted 'java.sql.SQLException:
Does not support SQL execution with no global transaction'
- Therefore I can't do a rollback 'java.lang.IllegalStateException:
Transaction does not exist'
- Therefore I wrote this mail.
I don't want to be a smart-"ass" writing such a detailed and indepth
mail. I just would like to show that I tried, and would like to have
some replies from you guys.
Below are my configurations, code and logfiles.
Thanx for taking your time and hope that the other people may learn
something as well.
cu
Stefan
Scenario
========
used Software
Bea Weblogic (WL) 6.0 SPx (not real sure which SP i have)
Oracle 8.1.6 using the API-Version 8
I configured the system as follows:
(ofcourse I 'xxx'ed out all of the confidential data, sorry guys;-))
excerpt from:
config.xml
<JDBCConnectionPool CapacityIncrement="5"
DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="2"
LoginDelaySeconds="1" MaxCapacity="5" Name="oraclePool"
Properties="user=xxx;password=xxx;dll=ocijdbc8;protocol=thin"
RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
TestTableName="languages" URL="jdbc:oracle:thin:@xxx:1521:xxx "/>
<!-- Since this is our Main Datasource I would not like to use a XA
Transaction due to performance Issues
and the TxDataSource:
-->
<JDBCTxDataSource EnableTwoPhaseCommit="true"
JNDIName="finstral.datasource.fbs" Name="finstral Content Datasource"
PoolName="oraclePool" Targets="fbsserver"/>
<!-- no comment required -I hope.
Next comes the "special" Pool
-->
<JDBCConnectionPool CapacityIncrement="5"
DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
Properties="user=xxx;password=xxx;server=xxx.xxx.xxx"
RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
TestTableName="Users" SupportsLocalTransaction="true"/>
<!-- Well since there can only be one none XARessourceManager involved
in a 2PC
(keyword: Two Phase Commit) I will have to use a XACapable Driver for
the other
Datasource. Due to all the bugs in the oracle.xxx driver. I'll be
using the jdriver for oci.
I activated 'SupportsLocalTransaction' hoping it would solve my
problem - without effect. I just left in there now, since it made
sense me. Not?
Again the TxDataSource:
-->
<JDBCTxDataSource EnableTwoPhaseCommit="true"
JNDIName="finstral.datasource.fbssecurity" Name="finstral Security
Datasource" PoolName="oracleSecurityPool" Targets="fbsserver"/>
<!-- The System starts right up and can locate the test tables and
everything. So I think all of this stuff is working here -->
ejb-jar.xml
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>TPCTestBean</ejb-name>
<home>de.sitewaerts.futuna.common.test.tpcbean.TPCHome</home>
<remote>de.sitewaerts.futuna.common.test.tpcbean.TPC</remote>
<ejb-class>de.sitewaerts.futuna.common.test.tpcbean.TPCBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor/>
</ejb-jar>
<!-- Originally I had the assembly-descriptor full of transaction
requirements. I thought since
the bean is handling all of the transaction stuff itself, it might get
confused by the 'container-transaction'
properties, and deleted them. Do I need them anyway?-->
weblogic-ejb-jar.xml
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>TPCTestBean</ejb-name>
<stateless-session-descriptor/>
<jndi-name>finstral/ejb/test_tpc</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
<!-- Nothing I have to explain here -->
BeanCode (from the implementingBeanClass:
'de.sitewaerts.futuna.common.test.tpcbean.TPCBean')
public void setupTables() throws RemoteException
UserTransaction tx = getTransaction();
//getTransaction calls: 'tx = sCtx.getUserTransaction()' and does
some errorhandling
log.info("Die Transaktion vor den Connections: "+tx.toString());
//Sorry bout the German. You should get the Message though.
log.info("Der Transaktionsstatus vor den Connections:
"+transactionStatus(tx));
Connection conSecurity = getConnection(DATASOURCE_SECURITY, tx);
//gets a Connection via a DataSourceName from the JNDI tree
Connection conContent = getConnection(DATASOURCE_CONTENT, tx);
log.info("Die frische Connection conSecurity: "+conSecurity);
log.info("Die frische Connection conContent: "+conContent);
tearDownTable(conSecurity);
//Does nothing special
tearDownTable(conContent);
log.info("Die Transaktion nach dem Teardown: "+tx.toString());
log.info("Der Transaktionsstatus nach dem Teardown:
"+transactionStatus(tx));
Statement stmt = null;
try
stmt = conSecurity.createStatement();
//Well its getting interesting now.....
log.info("Die Transaktion vor dem createtable: "+tx.toString());
log.info("Der Transaktionsstatus vor dem createtable:
"+transactionStatus(tx));
log.info("Die Connection conSecurity vor dem createtable:
"+conSecurity);
log.info("Die Connection conContent vor dem createtable:
"+conContent);
stmt.executeUpdate(CREATE_TABLE);
//above is the row 91 -> throws: 'java.sql.SQLException: Does
not support SQL execution with no global transaction'
stmt.close();
stmt = conContent.createStatement();
stmt.executeUpdate(CREATE_TABLE);
stmt.close();
commitTransaction(tx);
catch (SQLException sqle)
log.error("Konnte kein table init machen", sqle);
rollbackTransaction(tx);
//The Code for this method is below
throw new EJBException(sqle);
finally
closeConnection(conSecurity);
closeConnection(conContent);
protected void rollbackTransaction(UserTransaction tx)
log.info("Der Transaktionsstatus vor dem Rollback:
"+transactionStatus(tx));
log.info("Die Transaktion vor dem Rollback: "+tx.toString());
try
tx.rollback();
//above is row 200 -> throws: 'java.lang.IllegalStateException:
Transaction does not exist'
log.info("Der Transaktionsstatus nach dem Rollback:
"+transactionStatus(tx));
log.info("Die Transaktion nach dem Rollback: "+tx.toString());
catch (Exception e)
log.error("Konnte die Transaktion nicht backrollen.", e);
throw new EJBException(e);
Log Excerpt
===========
INFO setupTables() (66) - Die Transaktion vor den Connections:
[email protected]
INFO setupTables() (67) - Der Transaktionsstatus vor den Connections:
STATUS_NO_TRANSACTION
INFO setupTables() (72) - Die frische Connection conSecurity:
weblogic.jdbc.rmi.SerialConnection@7c6daa
INFO setupTables() (73) - Die frische Connection conContent:
weblogic.jdbc.rmi.SerialConnection@3b425
INFO setupTables() (78) - Die Transaktion nach dem Teardown:
[email protected]
INFO setupTables() (79) - Der Transaktionsstatus nach dem Teardown:
STATUS_NO_TRANSACTION
INFO setupTables() (86) - Die Transaktion vor dem createtable:
[email protected]
INFO setupTables() (87) - Der Transaktionsstatus vor dem createtable:
STATUS_NO_TRANSACTION
INFO setupTables() (88) - Die Connection conSecurity vor dem
createtable: weblogic.jdbc.rmi.SerialConnection@7c6daa
INFO setupTables() (89) - Die Connection conContent vor dem
createtable: weblogic.jdbc.rmi.SerialConnection@3b425
ERROR setupTables() (101) - Konnte kein table init machen
java.sql.SQLException: Does not support SQL execution with no global
transaction
at
weblogic.jdbc.oci.xa.XAConnection.beforeExecute(XAConnection.java:137)
at
weblogic.jdbc.oci.xa.Statement.executeUpdate(Statement.java:112)
at weblogic.jdbc.jta.Statement.executeUpdate(Statement.java:185)
at
weblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.jav
a:42)
at
weblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:54)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.jav
a:91)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBean
Impl.java:130)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCBe
anEOImpl.java:64)
at
de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseCo
mmitUnitTest.java:51)
at
org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTes
tCase.java:297)
at
org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servle
tTestCaller.java:148)
at
org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCal
ler.java:199)
at
org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTes
tRedirector.java:149)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:213)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
etContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
java:1631)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
INFO rollbackTransaction() (196) - Der Transaktionsstatus vor dem
Rollback: STATUS_NO_TRANSACTION
INFO rollbackTransaction() (197) - Die Transaktion vor dem Rollback:
[email protected]
ERROR rollbackTransaction() (206) - Konnte die Transaktion nicht
backrollen.
java.lang.IllegalStateException: Transaction does not exist
at
weblogic.transaction.internal.TransactionManagerImpl.rollback(Transactio
nManagerImpl.java:228)
at
weblogic.transaction.internal.TransactionManagerImpl.rollback(Transactio
nManagerImpl.java:222)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBean.rollbackTransaction(TPC
Bean.java:200)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.jav
a:102)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBean
Impl.java:130)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCBe
anEOImpl.java:64)
at
de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseCo
mmitUnitTest.java:51)
at
org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTes
tCase.java:297)
at
org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servle
tTestCaller.java:148)
at
org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCal
ler.java:199)
at
org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTes
tRedirector.java:149)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:213)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
etContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
java:1631)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
CONCLUSION
==========
I'm going nuts.
I just don't get it.
The transaction is the same. I don't change the Connection. I start
the Transaction at the beginning before I do anything!
Please guys help me out.
Thx alot.
Stefan "it's three o'clock in the morning, my girlfriend left me, and
my only friend is that stupid linux pinguine" Siprell
Software-Development
<<<<<<<<<<<<<<<<<<<<<<<<<<<
<sitewaerts> GmbH
Hebelstraße 15
D-76131 Karlsruhe
Tel: +49 (721) 920 918 22
Fax: +49 (721) 920 918 29
http://www.sitewaerts.de
>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hi Priscilla
(did you ever see the movie ? :-))
Well I moved away from the idea of using bean managed transaction. I'll
be using Container Managed Transactions. To modify the
transactionalbehaviour I'll write proxymethods which have certain
different containermanaged transaction properties, but which all call
the same private methods.
But it works! Here is my experience:
- I was doing a DDL statement: I was trying to create new Tables, which
is a definite "no-go"
- pay careful attention to:
http://edocs.bea.com/wls/docs60/jta/trxejb.html#1051405
and
http://edocs.bea.com/wls/docs60/jta/trxejb.html#1051741
and use these Settings for the Pool, don't ask me why, but it took me
hours to find it out by myself:
<JDBCConnectionPool CapacityIncrement="5"
DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
Properties="user=xxx; password=xxx; server=xxx.xxx.xxx"
RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
TestTableName="Users" SupportsLocalTransaction="true"/>
where as the server (shown as: xxx.xxx.xxx) is the TNS Name of the
Oracle Driver.
It works great.
Another thing you guys might want to do is write a simple StatelessSB
which does JDBC calls and two different database Connections.
Then write a UnitTest which calls this bean a couple hundred times (with
the same transaction). Have one test do clean writes, and another which
causes some SQL-Exception (too long Data Columns, or likewise).
Always count the entries and see if everything worked out. We're using
this SetupConstruction to test new combinations of AS(sorry Priscilla) /
Database / Db-Drivers to have a "standard test".
I know my two cents were uncalled for, but it might save you some
time.....
thanx for your help
Stefan
-----Ursprüngliche Nachricht-----
Von: Priscilla Fung [mailto:[email protected]]
Bereitgestellt: Donnerstag, 2. August 2001 21:42
Bereitgestellt in: transaction
Unterhaltung: Two phase commit and bean managed transactions
Betreff: Re: Two phase commit and bean managed transactions
Hi Stefan,
Looks like you have not actually begun a transaction by calling
UserTransaction.begin(),
so your setupTables method is really executing with no transaction
context.
Priscilla
Stefan Siprell <[email protected]> wrote:
>To all the Transaction GURUS!
>
>Hi guys (-and gals).
>I've been doing J2EE for quite a while, but today was my first at
>XA-Transactions and Bean Managed Transactions.
>
>Why am I doing this?
>====================
>Well I have to be able to controll the transactionalbehaviour of my
>bean
>during runtime, since some bean calls would cause a transactional
>overflow due to the stress they would cause to the system, whereas
>smaller bean calls need to run in one transaction.
>-> Therefore I need Bean Managed Transactions
>Since the bean does a call on two Database Connections it has to use
>a
>XA-Transaction.
>-> Therefore I need XA-Transactions.
>
>Abstract
>========
>- I just can't get a User TransAction into the right Status it stays
>in 'STATUS_NO_TRANSACTION' all the time
>- Therefore the SQL Commands can be comitted 'java.sql.SQLException:
>Does not support SQL execution with no global transaction'
>- Therefore I can't do a rollback 'java.lang.IllegalStateException:
>Transaction does not exist'
>- Therefore I wrote this mail.
>
>I don't want to be a smart-"ass" writing such a detailed and indepth
>mail. I just would like to show that I tried, and would like to have
>some replies from you guys.
>
>Below are my configurations, code and logfiles.
>
>Thanx for taking your time and hope that the other people may learn
>something as well.
>
>cu
>
>Stefan
>
>
>Scenario
>========
>
>used Software
>-------------
>Bea Weblogic (WL) 6.0 SPx (not real sure which SP i have)
>Oracle 8.1.6 using the API-Version 8
>
>
>I configured the system as follows:
>(ofcourse I 'xxx'ed out all of the confidential data, sorry guys;-))
>excerpt from:
>
>config.xml
>----------
><JDBCConnectionPool CapacityIncrement="5"
>DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="2"
>LoginDelaySeconds="1" MaxCapacity="5" Name="oraclePool"
>Properties="user=xxx;password=xxx;dll=ocijdbc8;protocol=thin"
>RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
>TestTableName="languages" URL="jdbc:oracle:thin:@xxx:1521:xxx "/>
>
><!-- Since this is our Main Datasource I would not like to use a XA
>Transaction due to performance Issues
>and the TxDataSource:
>-->
>
><JDBCTxDataSource EnableTwoPhaseCommit="true"
>JNDIName="finstral.datasource.fbs" Name="finstral Content Datasource"
>PoolName="oraclePool" Targets="fbsserver"/>
>
><!-- no comment required -I hope.
>Next comes the "special" Pool
>-->
>
><JDBCConnectionPool CapacityIncrement="5"
>DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
>LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
>Properties="user=xxx;password=xxx;server=xxx.xxx.xxx"
>RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
>TestTableName="Users" SupportsLocalTransaction="true"/>
>
><!-- Well since there can only be one none XARessourceManager involved
>in a 2PC
>(keyword: Two Phase Commit) I will have to use a XACapable Driver for
>the other
>Datasource. Due to all the bugs in the oracle.xxx driver. I'll be
>using the jdriver for oci.
>I activated 'SupportsLocalTransaction' hoping it would solve my
>problem - without effect. I just left in there now, since it made
>sense me. Not?
>Again the TxDataSource:
>-->
>
><JDBCTxDataSource EnableTwoPhaseCommit="true"
>JNDIName="finstral.datasource.fbssecurity" Name="finstral Security
>Datasource" PoolName="oracleSecurityPool" Targets="fbsserver"/>
>
><!-- The System starts right up and can locate the test tables and
>everything. So I think all of this stuff is working here -->
>
>
>
>ejb-jar.xml
>-----------
><ejb-jar>
> <enterprise-beans>
> <session>
> <ejb-name>TPCTestBean</ejb-name>
>
><home>de.sitewaerts.futuna.common.test.tpcbean.TPCHome</home>
>
><remote>de.sitewaerts.futuna.common.test.tpcbean.TPC</remote>
>
><ejb-class>de.sitewaerts.futuna.common.test.tpcbean.TPCBean</ejb-class>
> <session-type>Stateless</session-type>
> <transaction-type>Bean</transaction-type>
> </session>
> </enterprise-beans>
> <assembly-descriptor/>
></ejb-jar>
>
><!-- Originally I had the assembly-descriptor full of transaction
>requirements. I thought since
>the bean is handling all of the transaction stuff itself, it might get
>confused by the 'container-transaction'
>properties, and deleted them. Do I need them anyway?-->
>
>weblogic-ejb-jar.xml
>--------------------
><weblogic-ejb-jar>
> <weblogic-enterprise-bean>
> <ejb-name>TPCTestBean</ejb-name>
> <stateless-session-descriptor/>
> <jndi-name>finstral/ejb/test_tpc</jndi-name>
> </weblogic-enterprise-bean>
></weblogic-ejb-jar>
>
><!-- Nothing I have to explain here -->
>
>BeanCode (from the implementingBeanClass:
>'de.sitewaerts.futuna.common.test.tpcbean.TPCBean')
>-----------------------------------------------------------------------
>---------------------
>
> public void setupTables() throws RemoteException
> {
> UserTransaction tx = getTransaction();
> //getTransaction calls: 'tx = sCtx.getUserTransaction()' and does
>some errorhandling
>
> log.info("Die Transaktion vor den Connections: "+tx.toString());
> //Sorry bout the German. You should get the Message though.
> log.info("Der Transaktionsstatus vor den Connections:
>"+transactionStatus(tx));
>
> Connection conSecurity = getConnection(DATASOURCE_SECURITY, tx);
> //gets a Connection via a DataSourceName from the JNDI tree
> Connection conContent = getConnection(DATASOURCE_CONTENT, tx);
>
> log.info("Die frische Connection conSecurity: "+conSecurity);
> log.info("Die frische Connection conContent: "+conContent);
>
> tearDownTable(conSecurity);
> //Does nothing special
> tearDownTable(conContent);
>
> log.info("Die Transaktion nach dem Teardown: "+tx.toString());
> log.info("Der Transaktionsstatus nach dem Teardown:
>"+transactionStatus(tx));
>
> Statement stmt = null;
> try
> {
> stmt = conSecurity.createStatement();
> //Well its getting interesting now.....
>
> log.info("Die Transaktion vor dem createtable: "+tx.toString());
> log.info("Der Transaktionsstatus vor dem createtable:
>"+transactionStatus(tx));
> log.info("Die Connection conSecurity vor dem createtable:
>"+conSecurity);
> log.info("Die Connection conContent vor dem createtable:
>"+conContent);
>
> stmt.executeUpdate(CREATE_TABLE);
> //above is the row 91 -> throws: 'java.sql.SQLException: Does
>not support SQL execution with no global transaction'
>
> stmt.close();
>
> stmt = conContent.createStatement();
> stmt.executeUpdate(CREATE_TABLE);
> stmt.close();
> commitTransaction(tx);
> }
> catch (SQLException sqle)
> {
> log.error("Konnte kein table init machen", sqle);
> rollbackTransaction(tx);
> //The Code for this method is below
> throw new EJBException(sqle);
> }
> finally
> {
> closeConnection(conSecurity);
> closeConnection(conContent);
> }
> }
>
> protected void rollbackTransaction(UserTransaction tx)
> {
> log.info("Der Transaktionsstatus vor dem Rollback:
>"+transactionStatus(tx));
> log.info("Die Transaktion vor dem Rollback: "+tx.toString());
> try
> {
> tx.rollback();
> //above is row 200 -> throws: 'java.lang.IllegalStateException:
>Transaction does not exist'
> log.info("Der Transaktionsstatus nach dem Rollback:
>"+transactionStatus(tx));
> log.info("Die Transaktion nach dem Rollback: "+tx.toString());
> }
> catch (Exception e)
> {
> log.error("Konnte die Transaktion nicht backrollen.", e);
> throw new EJBException(e);
> }
> }
>
>Log Excerpt
>===========
>INFO setupTables() (66) - Die Transaktion vor den Connections:
>[email protected]
>INFO setupTables() (67) - Der Transaktionsstatus vor den Connections:
>STATUS_NO_TRANSACTION
>INFO setupTables() (72) - Die frische Connection conSecurity:
>weblogic.jdbc.rmi.SerialConnection@7c6daa
>INFO setupTables() (73) - Die frische Connection conContent:
>weblogic.jdbc.rmi.SerialConnection@3b425
>INFO setupTables() (78) - Die Transaktion nach dem Teardown:
>[email protected]
>INFO setupTables() (79) - Der Transaktionsstatus nach dem Teardown:
>STATUS_NO_TRANSACTION
>INFO setupTables() (86) - Die Transaktion vor dem createtable:
>[email protected]
>INFO setupTables() (87) - Der Transaktionsstatus vor dem createtable:
>STATUS_NO_TRANSACTION
>INFO setupTables() (88) - Die Connection conSecurity vor dem
>createtable: weblogic.jdbc.rmi.SerialConnection@7c6daa
>INFO setupTables() (89) - Die Connection conContent vor dem
>createtable: weblogic.jdbc.rmi.SerialConnection@3b425
>ERROR setupTables() (101) - Konnte kein table init machen
>java.sql.SQLException: Does not support SQL execution with no global
>transaction
> at
>weblogic.jdbc.oci.xa.XAConnection.beforeExecute(XAConnection.java:137)
> at
>weblogic.jdbc.oci.xa.Statement.executeUpdate(Statement.java:112)
> at weblogic.jdbc.jta.Statement.executeUpdate(Statement.java:185)
> at
>weblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.ja
v
>a:42)
> at
>weblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:54
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.ja
v
>a:91)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBea
n
>Impl.java:130)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCB
e
>anEOImpl.java:64)
> at
>de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseC
o
>mmitUnitTest.java:51)
> at
>org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTe
s
>tCase.java:297)
> at
>org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servl
e
>tTestCaller.java:148)
> at
>org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCa
l
>ler.java:199)
> at
>org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTe
s
>tRedirector.java:149)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl
>java:213)
> at
>weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServ
l
>etContext.java:1265)
> at
>weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl
>java:1631)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>INFO rollbackTransaction() (196) - Der Transaktionsstatus vor dem
>Rollback: STATUS_NO_TRANSACTION
>INFO rollbackTransaction() (197) - Die Transaktion vor dem Rollback:
>[email protected]
>ERROR rollbackTransaction() (206) - Konnte die Transaktion nicht
>backrollen.
>java.lang.IllegalStateException: Transaction does not exist
> at
>weblogic.transaction.internal.TransactionManagerImpl.rollback(Transacti
o
>nManagerImpl.java:228)
> at
>weblogic.transaction.internal.TransactionManagerImpl.rollback(Transacti
o
>nManagerImpl.java:222)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBean.rollbackTransaction(TP
C
>Bean.java:200)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.ja
v
>a:102)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBea
n
>Impl.java:130)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCB
e
>anEOImpl.java:64)
> at
>de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseC
o
>mmitUnitTest.java:51)
> at
>org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTe
s
>tCase.java:297)
> at
>org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servl
e
>tTestCaller.java:148)
> at
>org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCa
l
>ler.java:199)
> at
>org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTe
s
>tRedirector.java:149)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl
>java:213)
> at
>weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServ
l
>etContext.java:1265)
> at
>weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl
>java:1631)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
>
>CONCLUSION
>==========
>I'm going nuts.
>I just don't get it.
>The transaction is the same. I don't change the Connection. I start
>the Transaction at the beginning before I do anything!
>Please guys help me out.
>Thx alot.
>
>Stefan "it's three o'clock in the morning, my girlfriend left me, and
>my only friend is that stupid linux pinguine" Siprell
>Software-Development
><<<<<<<<<<<<<<<<<<<<<<<<<<<
><sitewaerts> GmbH
>Hebelstraße 15
>D-76131 Karlsruhe
>
>Tel: +49 (721) 920 918 22
>Fax: +49 (721) 920 918 29
>http://www.sitewaerts.de
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
>
>
-
Unable to start IDC Content Service(Very Urgent)
Hi,
My local system has Windows XP.I have installed Oracle 10g Express Edition,Apache,has jre1.6.0_03 and run the UCM installer.Both IDC Content Admin Service and IDC Content Service are set to start automatically during installation time."IDC Content Admin Service" is getting started automatically but "IDC Content Service" is not getting started.It is getting the following Error Message when we are starting IDC Content Service
Error 1064 : An exception occured in the service when handling the Control Request.
I have already installed Oracle Database 10g and D2k 10g also on my local system.
i am getting following error in the log file
Failed to initialize the server. Unable to initialize the system provider 'SystemDatabase'. Unable to create database connection for the database 'SystemDatabase' with connection string 'jdbc:oracle:thin:@localhost:1521:xe'. Please make sure that the connection string, user and password are correct. Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:xe
Unable to create database connection for the database 'SystemDatabase' with connection string 'jdbc:oracle:thin:@localhost:1521:xe'. Please make sure that the connection string, user and password are correct. Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:xe
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:xe [ Details ]
A fatal error has occurred. The stack trace below shows more information.
!csFailedToInitServer!csProviderUnableToInitialize,SystemDatabase!csJdbcUnableToCreateConnection,SystemDatabase,jdbc:oracle:thin:@localhost:1521:xe!$Listener refused the connection with the following error:<br>ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor<br>The Connection descriptor used by the client was:<br>localhost:1521:xe<br>!csJdbcUnableToCreateConnection,SystemDatabase,jdbc:oracle:thin:@localhost:1521:xe!$Listener refused the connection with the following error:<br>ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor<br>The Connection descriptor used by the client was:<br>localhost:1521:xe<br>!syExceptionType2,java.sql.SQLException,Listener refused the connection with the following error:<br>ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor<br>The Connection descriptor used by the client was:<br>localhost:1521:xe<br>
intradoc.common.ServiceException: !csProviderUnableToInitialize,SystemDatabase!csJdbcUnableToCreateConnection,SystemDatabase,jdbc:oracle:thin:@localhost:1521:xe!$Listener refused the connection with the following error:
ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:xe
at intradoc.server.IdcSystemLoader.loadProviders(IdcSystemLoader.java:1949)
at intradoc.server.IdcSystemLoader.initProviders(IdcSystemLoader.java:1729)
at intradoc.server.IdcSystemLoader.finishInit(IdcSystemLoader.java:221)
at intradoc.server.IdcSystemLoader.init(IdcSystemLoader.java:185)
at intradoc.server.IdcServerManager.init(IdcServerManager.java:73)
at IdcServerNT.init(IdcServerNT.java:86)
at IdcServerNT.main(IdcServerNT.java:54)
Caused by: intradoc.data.DataException: !csJdbcUnableToCreateConnection,SystemDatabase,jdbc:oracle:thin:@localhost:1521:xe!$Listener refused the connection with the following error:
ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:xe
at intradoc.jdbc.JdbcConnectionUtils.getConnection(JdbcConnectionUtils.java:88)
at intradoc.jdbc.JdbcWorkspace.init(JdbcWorkspace.java:97)
at intradoc.provider.Provider.init(Provider.java:68)
at intradoc.server.IdcSystemLoader.loadProviders(IdcSystemLoader.java:1937)
... 6 more
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:xe
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at intradoc.jdbc.JdbcConnectionUtils.getConnection(JdbcConnectionUtils.java:70)
... 9 more
The Oracle Homes are different for both the Oracle.
If somebody have idea about this problem,please help me. This is very urgent.
Manoj Baghel
[email protected]I think so..
Your Oracle Database doesn't connect to content server..
Maybe, you can edit the configuration of your UCM..
Please open the file at C:\oracle\ucm\server\config\config.cfg..
And then add the code :
NumConnection = 5;
CMIIW -
I have an eclipse application to open a new email message with an attachment (in the default mail client) clicking a button.
Below are my codes:-
Runtime.getRuntime().exec(new String[]{"cmd.exe","/c","start mailto:[email protected]?subject=MailTo&cc=[email protected]&attachment="e://myfile.txt"});
The problem is that the file can't be attached.
Appreciate suggestions and solutions.
Pls reply asap as this application is very urgent
Thanks.You should have simplified your problem by producing a valid Windows command before trying to Runtime.exec it. What you are doing there is testing with your eyes shut.
If you had typed that string you thought was a Windows command, and fiddled with it a bit, you would have found out that the & character is treated as a delimiter that separates a list of commands by the Windows shell. You would have seen the error message that says
'cc' is not recognized as an internal or external command, operable program or batch file.
Sorry, I don't know what you can do about that. But it isn't a Java question. -
How to recover in a two phase commit ?
I am implementing a two phase commit with Oracle XA in Oracle 8.1.6. I am wondering how I can recover from failures occur between the PREPARE and the COMMIT stage. If I lose the database connection after the changes have been prepared, then I can't find a way to rollback or commit the changes.
Appreciate any helps.
SamThe iPod OS takes care of where/how to store the files on the iPod and it has not done this. This is why you need to get the files off your iPod first.
My goal is to connect my iPod to my Mac, launch iTunes, and all of what's on my iPod displays in iTunes after single-clicking the iPod's icon in the Source pane of iTunes' window.
This is very, very simple. This is how iTunes works normally.
Since you now have the stuff from your iPod on your computer (using Ollie's iPod Extractor), load them into iTunes.
Sync them to the iPod. This will update the iPod database so all of the files are seen/identified correctly by the iPod.
Set the iPod prefs in iTunes to manually update.
Now you can delete the stuff on your computer and iTunes and view/edit/delete the stuff on the iPod using iTunes.
The outcome of using the utilities suggested in previous posts is that all of what's on my iPod gets copied to my Mac's hard drive (which is not what I'm trying to accomplish) and then that displays in iTunes' Library.
Only because the files on the iPod are not "useable" with the iPod or iTunes right now.
This is not something you will have to do everytime.
Once you get them on your computer, you can do the above steps and you will not have to use any utilities.
Just use iTunes. -
Error in Personnel Data Iview (its very urgent)
Hi All,
Personal Data
Critical Error
A critical error has occured. Processing of the service had to be terminated. Unsaved data has been lost.
Please contact your system administrator.
failed to create or init instance of model 'com.sap.xss.hr.per.in.pdata.model.HRXSS_PER_P0002_IN' in scope APPLICATION_SCOPE with instanceId 'null'
Caused by: com.sap.tc.webdynpro.progmodel.model.api.WDModelException: failed to create instance of model 'com.sap.xss.hr.per.in.pdata.model.HRXSS_PER_P0002_IN'
at com.sap.tc.webdynpro.progmodel.model.api.WDModelFactory.getNewModelInstance(WDModelFactory.java:392)
at com.sap.tc.webdynpro.progmodel.model.api.WDModelFactory.getOrCreateModelInstanceFromScopeMaintainer(WDModelFactory.java:329)
... 65 more
Caused by: com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: no jcoMetadata found for RFC function 'HRXSS_PER_GET_F4_P0002_IN'! Please verify, that your model is consistent with the ABAP backend: 'EC6'.
Hi Please help me to solve this error it's very urgent ?
thanks and regards,
Phanikumar.Hi,
I am not very much sure about this.
Are u calling a BAPi from WD application?
If yes then the error seems to be that : JCOs metadata is not available.
Please check that ur JCO definitions in portal and make sure the name in Portal and the name u defined in WD application are same( case sensitive).
Also TEST JCO in Portal.
Please revert back with current status and explain ur problem a bit more.
Regards,
Sumit -
Its very urgent:How to insert data one table to another table
Hi all,
i am very new to oaf.
i have employee_number(per_all_people_f) lov is there.once select the employee number and click on the submit button
what ever select the employee number it ll move to new_operation_manager in custom table.
plz help me how to move.
its very urgent.
Thanks
Latha.
Edited by: Latha on Dec 21, 2011 9:33 PMHi Gyan,
Sorry, i will not repate.how to close the thread.
Gyan i have no knowledge on this issue.
plz help me.and where to mention,data is which table to insert.
plz send one sample code.
its very urgent gyan.
i wrote the am,co codes
in am:
public void NewoperationManagerLogic()
ManagerCustomTableVOImpl vo1=getManagerCustomTableVO1();----> here which vo take
OADBTransaction oadbt=getOADBTransaction();
if(!vo1.isPreparedForExecution())
vo1.executeQuery();
Row row=vo1.createRow();
vo1.insertRow(row);
in Co processrequest:
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
am.invokeMethod("NewoperationManagerLogic");
in co processform request:
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
if(pageContext.getParameter("Submit")!=null)
ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
am.getOADBTransaction().commit();
throw new OAException("Records Saved Sucessfully",OAException.INFORMATION);
thanks
latha
Edited by: Latha on Dec 22, 2011 1:26 AM -
Very Urgent, files, threads, and swing !!!!
Dear friends, i have a swing application, in that application i have a class that extends a thread, that thread will do nothing but read the contents of my data file and puts them in an array, but i am getting a NullpointerException in my thread, could any friend help me please, it is very urgent, i will post my code below.
import java.awt.*;
import java.awt.event.*;
import java.text.DateFormat;
import java.util.*;
import javax.swing.*;
import java.sql.*;
import java.net.URL;
import java.io.*;
public class FinalMachine extends JFrame
private JPanel MainPanel, ThicknessPanel, MainManager,fieldsPanel, sub_panel;
private Container c;
private CardLayout CardManager;
private String timezone;
private static final int ONE_SECOND = 1000;
private JLabel welcome_label, label1, label2, label3,field_label;
private JTextField data_entry;
private Connection connection;
public JPanel thick_figure;
public int num_of_hits, next_index, recCount;
public int dataBuffer[];
public FileReader data_file;
public BufferedReader b_data_file;
public File tem_file;
final int num_of_rec = 20;
public FinalMachine()
super("PHOENIX MACHINERY s.a.l");
/* Start all threads */
/* Start filling data file in global array */
loadData dataFile = new loadData();
dataFile.start();
/* Adding control to window application */
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowevent)
// setDefaultCloseOperation(0);
System.exit(0);
public void windowDeiconified(WindowEvent eve)
setState(0);
addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent componentevent)
setSize(500, 500);
Dimension dimension1 = Toolkit.getDefaultToolkit().getScreenSize();
if(dimension1.width == 800 && dimension1.height == 600)
setLocation(150, 25);
else
if(dimension1.width == 1024 && dimension1.height == 768)
setLocation(200, 100);
/* Setting the location of the application on the screen */
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
if(dimension.width == 800 && dimension.height == 600)
setLocation(150, 25);
else
if(dimension.width == 1024 && dimension.height == 768)
setLocation(200, 100);
/* Constructing the main menu */
JMenuBar bar = new JMenuBar();
setJMenuBar( bar );
JMenu fileMenu = new JMenu( "File");
fileMenu.setMnemonic( 'F' );
JMenuItem mainItem = new JMenuItem( "Main page" );
mainItem.setMnemonic( 'M' );
mainItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
CardManager.show(MainManager, "main");
fileMenu.add( mainItem );
JMenuItem dataItem = new JMenuItem( "Database page" );
dataItem.setMnemonic( 'D' );
dataItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
CardManager.show(MainManager, "data_base");
fileMenu.add( dataItem );
JMenuItem printItem = new JMenuItem( "Print" );
printItem.setMnemonic( 'P' );
printItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
PrintUtilities.printComponent(MainManager);
fileMenu.add( printItem );
JMenuItem exitItem = new JMenuItem( "Exit" );
exitItem.setMnemonic( 'P' );
exitItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
System.exit(0);
fileMenu.add( exitItem );
bar.add( fileMenu );
JMenu figureMenu = new JMenu( "Figures");
figureMenu.setMnemonic( 'G' );
JMenuItem thicknessItem = new JMenuItem( "Thickness" );
thicknessItem.setMnemonic( 'T' );
thicknessItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
CardManager.show(MainManager, "thickness");
figureMenu.add( thicknessItem );
bar.add( figureMenu );
JMenu helpMenu = new JMenu( "Help");
helpMenu.setMnemonic( 'H' );
JMenuItem aboutItem = new JMenuItem( "About us" );
aboutItem.setMnemonic( 'A' );
aboutItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
JOptionPane.showMessageDialog(null, "Engineer Bilal Haidar (Computer & "+ "Communication Engineering)\n\n All Rights Reserevd. @ 2002",
"About me...", JOptionPane.PLAIN_MESSAGE);
helpMenu.add( aboutItem );
bar.add( helpMenu );
/* Intializing global values */
dataBuffer = new int[60];
/* Initializing the panels */
c = getContentPane();
c.setLayout(new FlowLayout());
CardManager = new CardLayout();
MainManager = new JPanel(false);
MainManager.setLayout(CardManager);
c.add(MainManager);
javax.swing.border.Border border = BorderFactory.createEmptyBorder(10, 10, 5, 10);
MainPanel = new JPanel(false);
MainPanel.setLayout(new BoxLayout(MainPanel, 1));
MainPanel.setBorder(border);
ThicknessPanel = new JPanel(false);
ThicknessPanel.setLayout(new BoxLayout(ThicknessPanel, 1));
ThicknessPanel.setBorder(border);
fieldsPanel = new JPanel(false);
fieldsPanel.setLayout( new BoxLayout( fieldsPanel,1));
fieldsPanel.setBorder(border);
sub_panel = new JPanel(false);
sub_panel.setLayout( new BoxLayout(sub_panel,0) );
sub_panel.setBorder(border);
thick_figure = new JPanel(false);
thick_figure.setBorder(border);
/* Filling the main panel */
JLabel jlmain = new JLabel("Main Page");
MainPanel.add(jlmain);
timezone = showTime(new Locale("en", "US"));
JLabel jltime = new JLabel(" " + timezone);
MainPanel.add(jltime);
MainManager.add(MainPanel, "main");
/* Filling the thickness panel */
num_of_hits = 0;
next_index = 0;
/* fill in with ero values for everything*/
/*display the figure*/
ThicknessPanel.add(thick_figure);
JLabel blanklabel = new JLabel(" ");
ThicknessPanel.add(blanklabel);
JButton build_fig = new JButton("Draw Figure");
build_fig.addActionListener(
new ActionListener() { // anonymous inner class
public void actionPerformed( ActionEvent e )
if ( num_of_hits == 0 )
/* draw figure based on first 20 points in the array */
next_index = num_of_rec;
else
if ( num_of_hits > 3 )
JOptionPane.showMessageDialog(null,"No more data to draw","Error Drawing",JOptionPane.ERROR_MESSAGE);
else
/* draw the figure starting the data from index 20*/
next_index = next_index + num_of_rec;
num_of_hits += 1;
ThicknessPanel.add(build_fig);
MainManager.add(ThicknessPanel, "thickness");
/* filling the database panel */
label1 = new JLabel(" ",SwingConstants.CENTER);
welcome_label = new JLabel(" Database Page ",SwingConstants.CENTER);
label2 = new JLabel(" ",SwingConstants.CENTER);
fieldsPanel.add( label1 );
fieldsPanel.add( welcome_label );
fieldsPanel.add( label2 );
field_label = new JLabel(" Enter your name: ");
data_entry = new JTextField( 10 );
sub_panel.add( field_label );
sub_panel.add( data_entry );
fieldsPanel.add( sub_panel );
JButton add_data = new JButton( "Add me" );
add_data.addActionListener(
new ActionListener() { // anonymous inner class
public void actionPerformed( ActionEvent e )
// try {
// url = "jdbc:odbc:DataEntry";
// Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
// connection = DriverManager.getConnection( url );
// System.out.println( "Connection Suucessfull");
// Statement statement = connection.createStatement();
// String get_field;
// get_field = data_entry.getText();
// String query = "INSERT INTO data (anyField) VALUES ('get_field')";
// int result1 = statement.executeUpdate( query );
// if ( result1 == 1 )
// JOptionPane.showMessageDialog(null, "Thanks for the info..."," Data Entry Success",JOptionPane.INFORMATION_MESSAGE);
// else
// JOptionPane.showMessageDialog(null, "Sorry, your name was not added...","Data entry error",JOptionPane.ERROR_MESSAGE);
// catch ( ClassNotFoundException cnfex ) {
// // process ClassNotFoundExceptions here
// cnfex.printStackTrace();
// System.out.println( "Connection UN Suucessfull");
// catch ( SQLException sqlex ) {
// // process SQLExceptions here
// sqlex.printStackTrace();
// System.out.println( "Connection UN Suucessfull");
// catch ( Exception ex ) {
// // process remaining Exceptions here
// ex.printStackTrace();
// System.out.println( "Connection UN Suucessfull");
fieldsPanel.add(add_data);
MainManager.add(fieldsPanel, "data_base");
/* display time */
Timer timer = new Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent actionevent)
timezone = showTime(new Locale("en", "US"));
setTitle("PHOENIX MACHINERY s.a.l " + timezone);
timer.start();
public static void main(String args[])
FinalMachine finalmachine = new FinalMachine();
finalmachine.setSize(500, 500);
ImageIcon imageicon = new ImageIcon("images/pc.gif");
finalmachine.setIconImage(imageicon.getImage());
finalmachine.show();
public static String showTime(Locale locale)
java.util.Date date = new java.util.Date();
byte byte0 = 2;
DateFormat dateformat = DateFormat.getTimeInstance(byte0, locale);
String s = dateformat.format(date);
return s;
/* Thread loadData starts here */
class loadData extends Thread
public void run()
try {
readMyFile();
catch( Exception x )
System.out.println("The following error occured in LoadData thread : "+x.toString() ); }
} // run() ends here
/* method read file inside thread loadData */
void readMyFile() {
String record = " ";
recCount = 0;
try {
tem_file = new File("mydata.dat");
data_file = new FileReader(tem_file);
b_data_file = new BufferedReader( data_file );
record = new String();
while ( (record = b_data_file.readLine()) != null ) {
dataBuffer[recCount] = Integer.parseInt(record);
recCount += 1; }
b_data_file.close();
catch (IOException e) {
System.out.println("Uh oh, got an IOException error!");
e.printStackTrace();
} // end of readMyFile()
} // thread loadData ends
mydata.dat
2
4
3
1
2
3
5
2
4
1
6
3
2
5
4
1
2
5
8
2
6
9
7
4
2
1
0
2
5
4
8
7
5
6
3
2
1
4
3
0
2
3
6
5
2
1
4
5
6
9
8
5
2
1
6
8
3
1
7
5Thank you Mr. jobuck, you helped me a lot, i wonder if you can provide me with a tutorial on how threads work and how runnables work too. i fixed the error ut old me about but still when i try to add another thread to my program i got an error saying that, i must decalre the new thread in a seperate file please can u have a look on what i have:
import java.awt.*;
import java.awt.event.*;
import java.text.DateFormat;
import java.util.*;
import javax.swing.*;
import java.sql.*;
import java.net.URL;
import java.io.*;
public class FinalMachine extends JFrame
private JPanel MainPanel, ThicknessPanel, MainManager,fieldsPanel, sub_panel;
private Container c;
private CardLayout CardManager;
private String timezone;
private static final int ONE_SECOND = 1000;
private JLabel welcome_label, label1, label2, label3,field_label;
private JTextField data_entry;
private JPanel thick_figure;
private int num_of_hits, next_index, recCount, read_flag;
private int dataBuffer[];
private FileReader data_file;
private BufferedReader b_data_file;
private File tem_file;
private Connection connection;
final int num_of_rec = 20;
public FinalMachine()
super("PHOENIX MACHINERY s.a.l");
/* load JDBC drivers */
try {
String url = "jdbc:odbc:DataEntry";
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
connection = DriverManager.getConnection( url );
System.out.println( "Connection Suucessfull");
catch ( ClassNotFoundException cnfex ) {
// process ClassNotFoundExceptions here
cnfex.printStackTrace();
System.out.println( "Connection UN Suucessfull");
catch ( SQLException sqlex ) {
// process SQLExceptions here
sqlex.printStackTrace();
System.out.println( "Connection UN Suucessfull");
catch ( Exception ex ) {
// process remaining Exceptions here
ex.printStackTrace();
System.out.println( "Connection UN Suucessfull");
/* Intializing global values */
dataBuffer = new int[60];
/* Start all threads */
/* Start filling data file in global array */
loadData dataFile = new loadData();
dataFile.start();
setData setdata = new setData();
setdata.start();
/* Adding control to window application */
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowevent)
// setDefaultCloseOperation(0);
System.exit(0);
public void windowDeiconified(WindowEvent eve)
setState(0);
addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent componentevent)
setSize(500, 500);
Dimension dimension1 = Toolkit.getDefaultToolkit().getScreenSize();
if(dimension1.width == 800 && dimension1.height == 600)
setLocation(150, 25);
else
if(dimension1.width == 1024 && dimension1.height == 768)
setLocation(200, 100);
/* Setting the location of the application on the screen */
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
if(dimension.width == 800 && dimension.height == 600)
setLocation(150, 25);
else
if(dimension.width == 1024 && dimension.height == 768)
setLocation(200, 100);
/* Constructing the main menu */
JMenuBar bar = new JMenuBar();
setJMenuBar( bar );
JMenu fileMenu = new JMenu( "File");
fileMenu.setMnemonic( 'F' );
JMenuItem mainItem = new JMenuItem( "Main page" );
mainItem.setMnemonic( 'M' );
mainItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
CardManager.show(MainManager, "main");
fileMenu.add( mainItem );
JMenuItem dataItem = new JMenuItem( "Database page" );
dataItem.setMnemonic( 'D' );
dataItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
CardManager.show(MainManager, "data_base");
fileMenu.add( dataItem );
JMenuItem printItem = new JMenuItem( "Print" );
printItem.setMnemonic( 'P' );
printItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
PrintUtilities.printComponent(MainManager);
fileMenu.add( printItem );
JMenuItem exitItem = new JMenuItem( "Exit" );
exitItem.setMnemonic( 'P' );
exitItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
System.exit(0);
fileMenu.add( exitItem );
bar.add( fileMenu );
JMenu figureMenu = new JMenu( "Figures");
figureMenu.setMnemonic( 'G' );
JMenuItem thicknessItem = new JMenuItem( "Thickness" );
thicknessItem.setMnemonic( 'T' );
thicknessItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
CardManager.show(MainManager, "thickness");
figureMenu.add( thicknessItem );
bar.add( figureMenu );
JMenu helpMenu = new JMenu( "Help");
helpMenu.setMnemonic( 'H' );
JMenuItem aboutItem = new JMenuItem( "About us" );
aboutItem.setMnemonic( 'A' );
aboutItem.addActionListener (
new ActionListener() {
public void actionPerformed( ActionEvent e )
JOptionPane.showMessageDialog(null, "Engineer Bilal Haidar (Computer & "+ "Communication Engineering)\n\n All Rights Reserevd. @ 2002",
"About me...", JOptionPane.PLAIN_MESSAGE);
helpMenu.add( aboutItem );
bar.add( helpMenu );
/* Initializing the panels */
c = getContentPane();
c.setLayout(new FlowLayout());
CardManager = new CardLayout();
MainManager = new JPanel(false);
MainManager.setLayout(CardManager);
c.add(MainManager);
javax.swing.border.Border border = BorderFactory.createEmptyBorder(10, 10, 5, 10);
MainPanel = new JPanel(false);
MainPanel.setLayout(new BoxLayout(MainPanel, 1));
MainPanel.setBorder(border);
ThicknessPanel = new JPanel(false);
ThicknessPanel.setLayout(new BoxLayout(ThicknessPanel, 1));
ThicknessPanel.setBorder(border);
fieldsPanel = new JPanel(false);
fieldsPanel.setLayout( new BoxLayout( fieldsPanel,1));
fieldsPanel.setBorder(border);
sub_panel = new JPanel(false);
sub_panel.setLayout( new BoxLayout(sub_panel,0) );
sub_panel.setBorder(border);
thick_figure = new JPanel(false);
thick_figure.setBorder(border);
/* Filling the main panel */
JLabel jlmain = new JLabel("Main Page");
MainPanel.add(jlmain);
timezone = showTime(new Locale("en", "US"));
JLabel jltime = new JLabel(" " + timezone);
MainPanel.add(jltime);
MainManager.add(MainPanel, "main");
/* Filling the thickness panel */
num_of_hits = 0;
next_index = 0;
/* fill in with ero values for everything*/
/*display the figure*/
ThicknessPanel.add(thick_figure);
JLabel blanklabel = new JLabel(" ");
ThicknessPanel.add(blanklabel);
JButton build_fig = new JButton("Draw Figure");
build_fig.addActionListener(
new ActionListener() { // anonymous inner class
public void actionPerformed( ActionEvent e )
if ( num_of_hits == 0 )
/* draw figure based on first 20 points in the array */
next_index = num_of_rec;
else
if ( num_of_hits > 3 )
JOptionPane.showMessageDialog(null,"No more data to draw","Error Drawing",JOptionPane.ERROR_MESSAGE);
else
/* draw the figure starting the data from index 20*/
next_index = next_index + num_of_rec;
num_of_hits += 1;
ThicknessPanel.add(build_fig);
MainManager.add(ThicknessPanel, "thickness");
/* filling the database panel */
label1 = new JLabel(" ",SwingConstants.CENTER);
welcome_label = new JLabel(" Database Page ",SwingConstants.CENTER);
label2 = new JLabel(" ",SwingConstants.CENTER);
fieldsPanel.add( label1 );
fieldsPanel.add( welcome_label );
fieldsPanel.add( label2 );
field_label = new JLabel(" Enter your name: ");
data_entry = new JTextField( 10 );
sub_panel.add( field_label );
sub_panel.add( data_entry );
fieldsPanel.add( sub_panel );
JButton add_data = new JButton( "Add me" );
add_data.addActionListener(
new ActionListener() { // anonymous inner class
public void actionPerformed( ActionEvent e )
try {
Statement statement = connection.createStatement();
String get_field;
get_field = data_entry.getText();
String query = "INSERT INTO data (anyField) VALUES ('"+get_field+"')";
int result1 = statement.executeUpdate( query );
if ( result1 == 1 )
JOptionPane.showMessageDialog(null, "Thanks for the info..."," Data Entry Success",JOptionPane.INFORMATION_MESSAGE);
data_entry.setText(" ");
else
JOptionPane.showMessageDialog(null, "Sorry, your name was not added...","Data entry error",JOptionPane.ERROR_MESSAGE);
catch ( SQLException sqlex ) {
// process SQLExceptions here
sqlex.printStackTrace();
System.out.println( "Connection UN Suucessfull");
catch ( Exception ex ) {
// process remaining Exceptions here
ex.printStackTrace();
System.out.println( "Connection UN Suucessfull");
fieldsPanel.add(add_data);
MainManager.add(fieldsPanel, "data_base");
/* display time */
Timer timer = new Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent actionevent)
timezone = showTime(new Locale("en", "US"));
setTitle("PHOENIX MACHINERY s.a.l " + timezone);
timer.start();
public static void main(String args[])
FinalMachine finalmachine = new FinalMachine();
finalmachine.setSize(500, 500);
ImageIcon imageicon = new ImageIcon("images/pc.gif");
finalmachine.setIconImage(imageicon.getImage());
finalmachine.show();
public static String showTime(Locale locale)
java.util.Date date = new java.util.Date();
byte byte0 = 2;
DateFormat dateformat = DateFormat.getTimeInstance(byte0, locale);
String s = dateformat.format(date);
return s;
/* Thread loadData starts here */
public class loadData extends Thread
public void run()
try {
readMyFile();
read_flag = 1;
notify();
catch( Exception x )
System.out.println("The following error occured in LoadData thread : "+x.toString() );
} // run() ends here
/* method read file inside thread loadData */
void readMyFile() {
String record = " ";
recCount = 0;
try {
tem_file = new File("mydata.dat");
data_file = new FileReader(tem_file);
b_data_file = new BufferedReader( data_file );
record = new String();
while ( (record = b_data_file.readLine()) != null ) {
dataBuffer[recCount] = Integer.parseInt(record);
recCount += 1; }
b_data_file.close();
catch (IOException e) {
System.out.println("Uh oh, got an IOException error!");
e.printStackTrace();
} // end of readMyFile()
} // thread loadData ends
public class setData extends Thread {
public void run()
try {
while ( !read_flag ) {
try { wait(); }
catch( InterruptedException e ) {
e.printStackTrace();
} // end while
for(int index = 0; index < 60; index++)
System.out.println("Array["+index+"] = "+dataBuffer[index]);
catch( Exception x )
System.out.println("The following error occured in LoadData thread : "+x.toString() );
} // run() ends here
the only added thing is the setData thread, i want this thread to start printing out the array whenever, loadData thread has finished filling the data inside the array please i need ur help. -
How use class file in jsp(very urgent)
i have class file called birds (birds is actually a xslt file transformed to java class file) now this class file i have to use in my jsp file. how can i use them. if possible can any one give me sample code please very urgent
can any one help mejava files
import org.w3c.dom.*;
import javax.servlet.http.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import java.io.*;
public class XmlParser
public String XmlParser()
try
String strXML= "employee.xml";
String xslFile = "employeeId.xsl";
TransformerFactory tFactory = TransformerFactory.newInstance();
StreamResult theTransformationResult = new StreamResult( new ByteArrayOutputStream() );
Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
transformer.transform(new StreamSource(new StringReader(strXML)), theTransformationResult);
String output = theTransformationResult.getOutputStream().toString()
catch(Exception e)
System.out.println(" ***** XmlParser.XmlParser ERROR ***** " + e);
return output;
using class files in jsp
<%@ page import="com.qqqq.aaaa.XmlParser"%>
<%
XmlParser xmlParser = new XmlParser();
out.println(xmlParser.XmlParser());
%>
i think it will help you.
Maybe you are looking for
-
IPhoto 9.1.2 Won't Launch - Disaster!
I have iPhoto 9.1.2 working on OSX 10.6.7. I believe all was fine until last time I loaded my SIM card, and iPhoto didn't auto launch. I checked the preferences, and it did show that it would auto launch when camera was connected (although I had alwa
-
Is anyone know how to change java3d program to swing3d
hi everyone , if you know anything , please help . i want to add some menu in my program , I have my code in here . if you can give me any suggest , i will be greatful . regards jojo import java.awt.BorderLayout; import java.awt.GraphicsConfigTemplat
-
Deactivating the field for input
Hi friends, I want to deactivate ( to make it read only) a field in standard Tcode for specific company codes. ( For example I want to deactivate company code field in ME22n -> Org data tab ) We have around 20 company codes and this change should be
-
How do I get credit for itunes double billing me for a purchase?
I just received an email from itunes that states that they double billed me for several TV show episodes I had already downloaded and paid for months ago. Since I cannot locate any means to directly phone call someone about this, I suppose that is wh
-
I give up. Can someone please help with pf24 on Canon?
I thought I understood how to do this but I don't. I have tried several things but the result doesn't look right to me. I have a Canon Vixia HG21 and today I recorded a little with the pf24 mode. After converting to apple pro res 422 in FCP 7.0, I ex