DTW-problem using Business Obj: Product Tree
Hello Experts,
I am trying to upload BOM through DTW, as it has two templates "productTree and productTrees_Lines"
In DTW Data import wizard on the second screen It says QueryParams and ProductTree and ProductTree_Lines, i attach my files with the ProductTree and ProductTree_Lines and press next, it gives message source file missing
Please Help
Hi Muhammad
It sounds like you are using some old version DTW which will show
the source file as "QueryParams".(a known issue fixed in later version)
Please upgrade your DTW to latest version.Or you can try to attach your
souce file ProductTree to the QueryParams and import.That may work.
Regards,
Syn Qin
SAP Business One Forums Team
Similar Messages
-
DTW-problem using Business Obj: oStockTaking and Template: StockTaking
Hello Experts,
I am getting problem in using SotckTaking data upload, It uploaded the data using the above said template and Business Object option using DTW.
But neither I could see it in Inventory Audit Report or Stock Posting. where I can see my uploaded data ... ?
ThanksStockTaking will not post entries to Inventory instead it updates stock as counted and you should perform reconciliation to update the stock.
Please refer the following information that is extracted from following threads:
Re: wants put stock opening balance through DTW
You could import the inventory counts using the Stock Taking template and the prices can be imported along with the Items using the template Items_Prices (inside folder oItems)
In the Inventory Reconciliation Tab select the pricelist number you have imported the prices (cost) in the above step and RECONCILE
The SAP document, 'Data Migration and Opening Balances Implementation Guide.pdf' states the following: Page No: 14:
Load Inventory Beginning Balances via DTW
In the workbench, the process contains 2 stages:
1. Loading of the initial quantities for all items using the Stock Taking object in the DTW.
2. Perform Stock Posting manually using Inventory u2192 Inventory Transactions u2192 Beginning Quantities and Cycle Counting u2192 Stock Posting. This stage will create the stock transaction and the appropriate Journal Entry to reflect the stock value in the GL.
In the stock posting, the same rules apply for determination of the item cost prices as in manual process.
The quantities you loaded will appear as counted. For the beginning quantities, the difference should be zero.
Make sure the date is set for the day you go live.
o The increasing and decreasing accounts are defaulted from the G/L account determination. For the beginning balances only, you should overwrite these accounts with the opening balance account.
o If you donu2019t use the Continuous Stock System, only quantity transactions will be created, no journal entries.
Since the stock accounts are affected, you must consider these amounts when creating the G/L opening balances.
If a variance remains after reconciliation between SAP Business One and the legacy system, for example, due to different prices, you have to correct this difference manually.
Regards
Satish -
A problem with updating a production tree through the DI
Dear all,
I'm trying to update 2 properties of a production tree through the DI - ToWH and PriceList.
I'm using the next code:
SAPbobsCOM.ProductTrees tree = (SAPbobsCOM.ProductTrees)mCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductTrees);
Then, this tree object doesn't give me the option to update the pricelist and the target warehouse, although it is possible to do so through the UI.
Any ideas?
Thanks!Hi,
If the DI API does not expose the properties then it may not be possible at the moment. However, I have sometimes found that if you use the XML interface in the DI API that you can update properties that aren't exposed through properties in the DI API objects.
Try something like this:
1) Use the GetByKey method of the production tree object to get the BOM you want to update.
2) Use the GetAsXML method to generate an XML formatted string of the BOM
3) Load the xml string in to an XML parser such as the XMLDocument object in the .NET Framework
4) Use the XMLDocument object to update the header fields you want to change and save the xml string as a file to disk
5) Use the GetBusinessObjectFromXML method of the DI API company object to load the XML file back in to your production tree object
6) Call the Update method of the production tree object
If that doesn't work then there is no way I know of to achieve what you want through the DI API.
Kind Regards,
Owen -
Problem with business catalyst product shop layout?
I have set up a shop in business catalyst, but I am having trouble getting all the products to display on one page, 3 have moved to a second page, but left gaps on the previous page where they should fit in? Adobe support told me to post this on the forum, saying to 'alter the css and have it checked out', has anyone else had this problem? How do I fix this?
I have had this issue before and was told to weight the products, which then worked ok last time. So I now weight all product enteries, it's fine on all other pages of product catalogues in the shop, but this seems to be happeneing again on this one? See link below: page 2 from the engineered section, page 1 is fine, page 2 has gaps?
http://www.greystoneinteriors.co.uk/engineered?Page=2&Items=12Can i just check with you that this is correct?
Thanks
/* View Type: Grid */
.products-grid { width:100%; float:left; padding-top:15px;}
.products-grid.last { border-bottom:0; }
.products-grid .productSmall li { float:left; width:220px; padding: 0 10px 20px 0;
Height:330px;}
.products-grid .product-image { display:block; margin:0 0 5px; }
.products-grid .product-name { font-weight:bold; font-size:13px; font-weight:bold; }
.products-grid .product-name a{ color:#000!important; }
.products-grid .availability { line-height:21px; }
.products-grid .actions { font-size:11px; text-transform:uppercase; }
.products-grid .actions a { color:#3c7fa8;}
.col2-left-layout .products-grid,
.col2-right-layout .products-grid {margin:0 auto; }
.col1-layout .products-grid { margin:0 auto; } -
Problem Adding BOM using Product Trees Object
Hey I am having problems with the following code:
qProductTree = (SAPbobsCOM.ProductTrees)this.m_SboAddon.SboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductTrees);
int RetVal = 0;
qProductTree.TreeCode = "productTree1";
qProductTree.TreeType = SAPbobsCOM.BoItemTreeTypes.iProductionTree;
qProductTree.Quantity = 5;
qProductTree.Items.ItemCode = "test1";
qProductTree.Items.Price = 20;
qProductTree.Items.Quantity = 1;
qProductTree.Items.Currency = "Eur";
qProductTree.Items.Comment = "test comment";
qProductTree.Items.IssueMethod = SAPbobsCOM.BoIssueMethod.im_Manual;
RetVal = qProductTree.Add();
string errMsg;
int errCode;
if (RetVal != 0 )
this.m_SboAddon.SboCompany.GetLastError(out errCode, out errMsg);
MessageBox.Show(errMsg);
I get an error message with ID 2028 which when I look it up in the SDK it states DataSource - No Data found.
Any ideas?Hi Laura!
In DI reference you can find topic 'Add a Bill Of Material sample', hope it'll help you.
Note, that there are some lines in that sample:
Dim vItem As SAPbobsCOM.Items
<b>Set vItem = vCmp.GetBusinessObject(oItems)</b>
Dim vProdTree As SAPbobsCOM.ProductTrees
Set vProdTree = vCmp.GetBusinessObject(oProductTrees)
'Get the Item I want to create as Product Tree
<b>RetVal = vItem.GetByKey("MyProdTree")</b>
'Set Values to the fields
vProdTree.TreeCode = <b>"MyProdTree"</b>
vProdTree.TreeType = iProductionTree
In my mind, you should find an existing Item (via GetByKey) before you create ProductTree. -
DTW Production tree headers - price list
I have 2000+ production Bom's headers that I would like to update via DTW. I want to change the price list on the header. The field on the OITT file is PriceList but the DTW template for production trees does not have this field on it. I know the DTW production tree lines template has price list & price fields on them to update ITT1 but not the header. Does anyone know the field name to use to update the price list number on the headers by DTW please?
Hi Gordon,
Thanks for the reply. It wasn't the answer I would have liked but that's the way it is sometimes.
Regards,
Stuart J. -
SAP Crystal Reports data source connection problem using sap business one
Hi,
I m facing a problem regarding: SAP Crystal Reports data source connection problem using sap business one
I am trying to create a Crystal report but when I try to configure a new connection it does not work.
I select Sap Business One data source and try to complete the information required to connection but it does not list my companies databases, what is the problem?
Our Current SAP related software details are as follows:
OS: Windows Server 2008
SAP B1 Version: SAP B1 9 (902001) Patch 9
SAP Crystal Report Version: 14.0.4.738 RTM
Database: MS SQL Server 2008 R2
I have also added some screenshots of the issues.
Please have a look and let me know if you have any questions or any further clarifications.
I m eagerly waiting for a quick and positive reply.Hi,
There is problem with SAP Business One date source.
I had faced same problem, I used OLEDB Data-source, and it worked fine for me.
So, try to use OLEDB.
Regards,
Amrut Sabnis. -
Hi,
Whenever I start any of my microsoft programs I get an error message stating "non-commercial use, not licenced product" and I cannot do anything in the programs. I havve the Home and Business 2013 version.
My husband bought the office programs for his and my computer and so they are both registered to his name however my email is the login, I dont know if this is relevant.
How do I fix this?Hi,
Based on your description, several possibilities come to my mind.
1. You mentioned your husband bought the Office Suite for you, did he purchase one product key or two? We need to confirm if the product key can be installed on multiple machines, if a product key can be only installed once and he installed it
on his computer first, you should purchase a new product key to activate your Office.
Since the policy differs in different areas, to confirm how many machines the product key can be installed on, let your husband ask the retailer or contact the local customer service to get the answer:
http://support2.microsoft.com/gp/customer-service-phone-numbers/en-us
2. Please confirm your Office version. Based on the message "non-commercial use", I found this kb:
http://support.microsoft.com/kb/937676/
But it's for Office Home and Student instead of Office Home and Business, we can perform the steps below to find the Microsoft Software License Terms:
1. Start and Office program.
2. On the File (Backstage) tab, click Account.
3. Click About (Product name: Word, Excel etc..), in the window that opens, click
View the Microsift Software License Terms link.
3. If your Office is a trial version or the product key is not for the version that you are using, consider to uninstall it first, and install the appropriate version. You can probably get the installation media from your husband.
Regards,
Melon Chen
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Any problem if we use Business area concept other than Profit Centr
Hi,
what are the problems and difficulties if we use Business area concept other than Profit Center.
Kindly give me brief deatils,,,will assign points
thanks
Sap Guru
kischowdary*gmail.comHi:
Business area will not be supported by SAP in the future
The problem of splitting of account balance is more pertinent in case of tax accounts.
In month end procedures, there are big problem in reconciliation.
Not Efficient in Reporting.
SAP Recommends Profit Center Accounting instead of Business area
Please let me know if you need more information.
Assign points if useful.
Regards
MSReddy -
Problem occured when create a tree table for master-detail view objects using SQL queries?
I am programming a tree table for master-detail view objects using SQL queries and these 2 view objects are not simple singel tables queries, and 2 complex SQL are prepared for master and view objects. see below:
1. Master View object (key attribute is SourceBlock and some varaible bindings are used for this view object.)
SELECT cntr_list.SOURCE_BLOCK,
sum(
case when cntr_list.cntr_size_q = '20'
then cntr_list.cntr_qty
else 0 end ) as cntr20 ,
sum(
case when cntr_list.cntr_size_q = '40'
then cntr_list.cntr_qty
else 0 end ) as cntr40 ,
sum(
case when cntr_list.cntr_size_q = '45'
then cntr_list.cntr_qty
else 0 end ) as cntr45
FROM (
SELECT yb1.BLOCK_M as SOURCE_BLOCK,
scn.CNTR_SIZE_Q,
count(scn.CNTR_SIZE_Q) AS cntr_qty
FROM SHIFT_CMR scm, SHIFT_CNTR scn, YARD_BLOCK yb1, YARD_BLOCK yb2
WHERE
scm.cmr_n = scn.cmr_n
AND (scm.plan_start_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS')
OR scm.plan_end_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS'))
AND scm.shift_mode_c = :ShiftModeCode
AND scm.end_terminal_c = :TerminalCode
AND scm.start_terminal_c = yb1.terminal_c
AND scm.start_block_n = yb1.block_n
AND substr(scn.start_location_c,(instr(scn.start_location_c,',',1,5)+1),instr(scn.start_location_c,',',1,6)-(instr(scn.start_location_c,',',1,5)+1)) BETWEEN yb1.slot_from_n AND yb1.slot_to_n
AND scm.end_terminal_c = yb2.terminal_c
AND scm.end_block_n = yb2.block_n
AND substr(scn.end_location_c,(instr(scn.end_location_c,',',1,5)+1),instr(scn.end_location_c,',',1,6)-(instr(scn.end_location_c,',',1,5)+1)) BETWEEN yb2.slot_from_n AND yb2.slot_to_n
AND scn.status_c not in (1, 11)
AND scn.shift_type_c = 'V'
AND scn.source_c = 'S'
GROUP BY yb1.BLOCK_M, scn.CNTR_SIZE_Q
) cntr_list
GROUP BY cntr_list.SOURCE_BLOCK
2. Detail View object (key attributes are SourceBlock and EndBlock and same varaible bindings are used for this view object.)
SELECT cntr_list.SOURCE_BLOCK, cntr_list.END_BLOCK,
sum(
case when cntr_list.cntr_size_q = '20'
then cntr_list.cntr_qty
else 0 end ) as cntr20 ,
sum(
case when cntr_list.cntr_size_q = '40'
then cntr_list.cntr_qty
else 0 end ) as cntr40 ,
sum(
case when cntr_list.cntr_size_q = '45'
then cntr_list.cntr_qty
else 0 end ) as cntr45
FROM (
SELECT yb1.BLOCK_M as SOURCE_BLOCK,
yb2.BLOCK_M as END_BLOCK,
scn.CNTR_SIZE_Q,
count(scn.CNTR_SIZE_Q) AS cntr_qty
FROM SHIFT_CMR scm, SHIFT_CNTR scn, YARD_BLOCK yb1, YARD_BLOCK yb2
WHERE
scm.cmr_n = scn.cmr_n
AND (scm.plan_start_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS')
OR scm.plan_end_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS'))
AND scm.shift_mode_c = :ShiftModeCode
AND scm.end_terminal_c = :TerminalCode
AND scm.start_terminal_c = yb1.terminal_c
AND scm.start_block_n = yb1.block_n
AND substr(scn.start_location_c,(instr(scn.start_location_c,',',1,5)+1),instr(scn.start_location_c,',',1,6)-(instr(scn.start_location_c,',',1,5)+1)) BETWEEN yb1.slot_from_n AND yb1.slot_to_n
AND scm.end_terminal_c = yb2.terminal_c
AND scm.end_block_n = yb2.block_n
AND substr(scn.end_location_c,(instr(scn.end_location_c,',',1,5)+1),instr(scn.end_location_c,',',1,6)-(instr(scn.end_location_c,',',1,5)+1)) BETWEEN yb2.slot_from_n AND yb2.slot_to_n
AND scn.status_c not in (1, 11)
AND scn.shift_type_c = 'V'
AND scn.source_c = 'S'
GROUP BY yb1.BLOCK_M, yb2.BLOCK_M, scn.CNTR_SIZE_Q
) cntr_list
GROUP BY cntr_list.SOURCE_BLOCK, cntr_list.END_BLOCK
3. I create a view link to create master-detail relationship for these 2 view objects.
masterview.SourceBlock (1)->detailview.SourceBlock (*).
4. I create a tree table using these 2 view objects with master-detail relationship.
When I set default value for variable bindings of these 2 view objects and the matching records exist, tree table can work well. I can expand the master row to display detail row in UI.
But I need to pass in dymamic parameter value for variable bindings of these 2 view objects, tree table cannnot work again. when I expand the master row and no detail row are displayed in UI.
I am sure that I pass in correct parameter value for master/detail view objects and matching records exist.
Managed Bean:
DCIteratorBinding dc = (DCIteratorBinding)evaluteEL("#{bindings.MasterView1Iterator}");
ViewObject vo = dc.getViewObject();
System.out.println("Before MasterView1Iterator vo.getEstimatedRowCount()="+ vo.getEstimatedRowCount());
System.out.println("Before MasterView1Iterator ShiftModeCode="+ vo.ensureVariableManager().getVariableValue("ShiftModeCode"));
vo.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
vo.ensureVariableManager().setVariableValue("DateTo", dateTo);
vo.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
vo.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
vo.executeQuery();
System.out.println("MasterView1Iterator vo.getEstimatedRowCount()="+ vo.getEstimatedRowCount());
DCIteratorBinding dc1 = (DCIteratorBinding)evaluteEL("#{bindings.DetailView1Iterator}");
ViewObject vo1 = dc1.getViewObject();
System.out.println("Before DetailView1Iterator vo1.getEstimatedRowCount()="+ vo1.getEstimatedRowCount());
System.out.println("Before DetailView1Iterator ShiftModeCode="+ vo1.ensureVariableManager().getVariableValue("ShiftModeCode"));
vo1.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
vo1.ensureVariableManager().setVariableValue("DateTo", dateTo);
vo1.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
vo1.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
vo1.executeQuery();
System.out.println("after DetailView1Iterator vo1.getEstimatedRowCount()="+ vo1.getEstimatedRowCount());
5. What's wrong in my implementation? I don't have no problem to implement such a tree table if using simple master-detail tables view object, but now I have to use such 2 view objects using complex SQL for my requirement and variable bindings are necessary for detail view object although I also think a bit strange by myself.Hi Frank,
Thank you and it can work.
public void setLowHighSalaryRangeForDetailEmployeesAccessorViewObject(Number lowSalary,
Number highSalary) {
Row r = getCurrentRow();
if (r != null) {
RowSet rs = (RowSet)r.getAttribute("EmpView");
if (rs != null) {
ViewObject accessorVO = rs.getViewObject();
accessorVO.setNamedWhereClauseParam("LowSalary", lowSalary);
accessorVO.setNamedWhereClauseParam("HighSalary", highSalary);
executeQuery();
but I have a quesiton in this way. in code snippet, it is first getting current row of current master VO to determine if update variables value of detail VO. in my case, current row is possibly null after executeQuery() of master VO and I have to change current row manually like below.
any idea?
DCIteratorBinding dc = (DCIteratorBinding)ADFUtil.evaluateEL("#{bindings.SSForecastSourceBlockView1Iterator}");
ViewObject vo = dc.getViewObject();
vo.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
vo.ensureVariableManager().setVariableValue("DateTo", dateTo);
vo.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
vo.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
vo.executeQuery();
vo.setCurrentRowAtRangeIndex(0);
((SSForecastSourceBlockViewImpl)vo).synchornizeAccessorVOVariableValues(); -
Using DTW to update Bill Of Production
Hi ,we are using SAP B1 2005B. When using DTW to update Bill Of Production, i can not find target file in object:OProductTrees for warehouse(table:OITT, file name:ToWH) in Bill Of Production header!
Any suggestion?
Thanks!Hi.........
When you run DTW it asks you to give path where file has been store and from there it picks up the file and imports data.
Generally DTW support several file formats those are CSV Comma, CSV SemiColon, Tab Delimited, ODBC.
At the 4th step of DTW where it asks to specify the path you will find one dropdown of Select File Type
So select the proper File type in drop down and then only you can find your file saved in drive.........
Regards,
Rahul -
Ora 00918 normalizing problem using cartesian product
I am using a cartesian product to normalise a table. Is there a better way of doing this to avoid the 00918 error?
Thanks in advance ...
select
/* select clause */
from
z_dvo_proj_milestone_summary t1,
z_dvo_proj_milestone_summary t2
where
/* where clause */
create or replace view z_dvo_proj_milestone_summary as
select
query1.projid
,query1.projname
,query1.projtype
,query1.projcode
,query1.report_month
,query1.report_year
,query1.SubProjID
,query1.DVONUM
,query1.measure_type
,query1.MEASURE
,hier.level0_vosa_prj_type
from
(select
score.project as projid
,srm.name as projname
,hier.level0_vosa_prj_type as projtype
,score.code as projcode
,score.report_month as report_month
,score.report_year as report_year
,CASE
when (subprojtab.subprojid = 1) then score.sub_project_1
when (subprojtab.subprojid = 2) then score.sub_project_2
End as SubProjID
,dvonumtab.dvonum as DVONUM
,typetab.measure_type as measure_Type
,CASE
WHEN (subprojtab.subprojid = 1) then
CASE
when typetab.measure_type = 'baseline' then
CASE
when (dvonumtab.dvonum = 1) then score.proj1_dvo1_baseline
when (dvonumtab.dvonum = 2) then score.proj1_dvo2_baseline
End
when typetab.measure_type = 'planned' then
CASE
when (dvonumtab.dvonum = 1) then score.proj1_dvo1_planned
when (dvonumtab.dvonum = 2) then score.proj1_dvo2_planned
End
End
WHEN (subprojtab.subprojid = 2) then
CASE
when typetab.measure_type = 'baseline' then
CASE
when (dvonumtab.dvonum = 1) then score.proj2_dvo1_baseline
when (dvonumtab.dvonum = 2) then score.proj2_dvo2_baseline
End
when typetab.measure_type = 'planned' then
CASE
when (dvonumtab.dvonum = 1) then score.proj2_dvo1_planned
when (dvonumtab.dvonum = 2) then score.proj2_dvo2_planned
End
End
End as MEASURE
from
ODF_CA_PROJSCORE score
left outer join
srm_projects srm on (srm.id = score.project)
left outer join
Z_PROJECT_HIERARCHY hier on (srm.id = hier.level0)
Join
(select 1 as subprojid from dual
union
select 2 as subprojid from dual) subprojtab on (1=1)
/* There will be 11 measures here eventually */
Join
(select 'baseline' as measure_type from dual
union
select 'planned' as measure_type from dual) typetab on (1=1)
Join
(select 1 as dvonum from dual
union
select 2 as dvonum from dual) dvonumtab on (1=1)
WHERE
(CASE
when (subprojtab.subprojid = 1) then score.sub_project_1
when (subprojtab.subprojid = 2) then score.sub_project_2
End) IS NOT NULL) query1
left outer join Z_PROJECT_HIERARCHY hier
on (query1.SubProjID = hier.level0)I am using a cartesian product to normalise a table. Is there a better way of doing this to avoid the 00918 error?
Thanks in advance ...
select
/* select clause */
from
z_dvo_proj_milestone_summary t1,
z_dvo_proj_milestone_summary t2
where
/* where clause */
create or replace view z_dvo_proj_milestone_summary as
select
query1.projid
,query1.projname
,query1.projtype
,query1.projcode
,query1.report_month
,query1.report_year
,query1.SubProjID
,query1.DVONUM
,query1.measure_type
,query1.MEASURE
,hier.level0_vosa_prj_type
from
(select
score.project as projid
,srm.name as projname
,hier.level0_vosa_prj_type as projtype
,score.code as projcode
,score.report_month as report_month
,score.report_year as report_year
,CASE
when (subprojtab.subprojid = 1) then score.sub_project_1
when (subprojtab.subprojid = 2) then score.sub_project_2
End as SubProjID
,dvonumtab.dvonum as DVONUM
,typetab.measure_type as measure_Type
,CASE
WHEN (subprojtab.subprojid = 1) then
CASE
when typetab.measure_type = 'baseline' then
CASE
when (dvonumtab.dvonum = 1) then score.proj1_dvo1_baseline
when (dvonumtab.dvonum = 2) then score.proj1_dvo2_baseline
End
when typetab.measure_type = 'planned' then
CASE
when (dvonumtab.dvonum = 1) then score.proj1_dvo1_planned
when (dvonumtab.dvonum = 2) then score.proj1_dvo2_planned
End
End
WHEN (subprojtab.subprojid = 2) then
CASE
when typetab.measure_type = 'baseline' then
CASE
when (dvonumtab.dvonum = 1) then score.proj2_dvo1_baseline
when (dvonumtab.dvonum = 2) then score.proj2_dvo2_baseline
End
when typetab.measure_type = 'planned' then
CASE
when (dvonumtab.dvonum = 1) then score.proj2_dvo1_planned
when (dvonumtab.dvonum = 2) then score.proj2_dvo2_planned
End
End
End as MEASURE
from
ODF_CA_PROJSCORE score
left outer join
srm_projects srm on (srm.id = score.project)
left outer join
Z_PROJECT_HIERARCHY hier on (srm.id = hier.level0)
Join
(select 1 as subprojid from dual
union
select 2 as subprojid from dual) subprojtab on (1=1)
/* There will be 11 measures here eventually */
Join
(select 'baseline' as measure_type from dual
union
select 'planned' as measure_type from dual) typetab on (1=1)
Join
(select 1 as dvonum from dual
union
select 2 as dvonum from dual) dvonumtab on (1=1)
WHERE
(CASE
when (subprojtab.subprojid = 1) then score.sub_project_1
when (subprojtab.subprojid = 2) then score.sub_project_2
End) IS NOT NULL) query1
left outer join Z_PROJECT_HIERARCHY hier
on (query1.SubProjID = hier.level0) -
Problem of Product Tree in Production Order
Dear Experts,
My query is related to product tree when i am trying to add production order then it will give me error that " Item already defined at a higher level in the Product Tree [ Production Order -Rows- Item No] [line : 1], ' Row no. 1]', [Message 3566 -12]".And where i can find the path of Product Tree.
Thanks & Regards
AmolSorry some kind of missunderstanding.
Ok i see your error message. This is often caused, when a item is already related to another BOM or production order.
Example :
Item 1 consists of Item B and Item C
Item B could not consists of Item 1 cause Item B is a part of Item 1.
Regards Steffen -
Problem using SmartCard with 2 Certificates stored and SunPKCS11
Hi,
I'm trying to access one SmartCard token in Java 1.5 using SunPKCS11 provider for crypt, decrypt and digital signature operations.
I have 2 certificates stored on Token:
- CertA;
- CertB.
There are also 2 PIN:
- PIN1;
- PIN2.
I use:
- PIN1 for logging into the token;
- PIN1 for operation involving CertA;
- PIN2 for operation involving CertB;
There is no problem to logging into the token using Java and, without any troubles, I can read certificates and key from the
cryptographic card.
There is no problem using CertA for all my operation, but every attempt of using Private Key of CertB (for the same operations) returns with an Exception:
java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_DEVICE_ERROR
Here there's an extract of my source code.
public void loginToken() {
Provider UserProvider = new sun.security.pkcs11.SunPKCS11(C:\\pkcs11.cfg);
Security.addProvider(UserProvider);
try {
KeyStore ks = null;
X509Certificate UserCert = null;
PrivateKey UserCertPrivKey = null;
PublicKey UserCertPubKey = null;
//PIN
char PIN1[] = "11111".toCharArray();
char PIN2[] = "22222".toCharArray();
//logging into token
ks = KeyStore.getInstance("PKCS11", UserProvider);
ks.load(null, PIN1);
//enumeration alias
String alias = "";
Enumeration e = ks.aliases();
while (e.hasMoreElements()) {
alias = (String) e.nextElement();
//Certificate
UserCert = (X509Certificate) ks.getCertificate(alias);
//PublicKey
UserCertPubKey = (PublicKey) ks.getCertificate(alias).getPublicKey();
if (alias.compareToIgnoreCase("Cert1") == 0) {
//PrivateKey reference
UserCertPrivKey = (PrivateKey) ks.getKey(alias, PIN1);
} else if (alias.compareToIgnoreCase("Cert2") == 0) {
//PrivateKey reference
UserCertPrivKey = (PrivateKey) ks.getKey(alias, PIN2);
} else {
System.out.println("ALIAS UNKNOW");
System.exit(1);
//Signature Test
if (!MakeSignature(UserCertPrivKey, UserProvider))
System.out.println(" *** SIGNATURE OK *** ");
else
System.out.println(" *** SIGNATURE KO *** ");
catch (Exception ex) {
System.out.println("ERROR: " + ex);
public boolean MakeSign(PrivateKey PrivKey, Provider p) {
try {
//File I/O
FileInputStream txtfis = new FileInputStream("C:\\Test.txt");
FileOutputStream sigfos = new FileOutputStream("C:\\Test_Signature.txt");
//Signature Obj init
Signature dsa = Signature.getInstance("SHA1withRSA", p.getName());
dsa.initSign(PrivKey);
//Update data
BufferedInputStream bufin = new BufferedInputStream(txtfis);
byte[] buffer = new byte[1024];
int len;
while (bufin.available() != 0) {
len = bufin.read(buffer);
dsa.update(buffer, 0, len);
bufin.close();
//Make signature
byte[] realSig = dsa.sign();
//save signature on file
sigfos.write(realSig);
sigfos.close();
return true;
catch (Exception ex) {
System.out.println("ERROR: " + ex);
return false;
Any help would be grateful...
Thanks in advance.
P.S. Sorry for my EnglishThis is the same my initial problem.
I resolved it using IAIK-PKCS#11Wrapper (it is FREE) insted of sun.security.pkcs11.SunPKCS11.
You can find it here:
http://jce.iaik.tugraz.at/sic/products/core_crypto_toolkits/pkcs_11_wrapper
Here an exemple of code.
The main class:
import iaik.pkcs.pkcs11.Module;
import iaik.pkcs.pkcs11.DefaultInitializeArgs;
import java.util.Hashtable;
import iaik.pkcs.pkcs11.Token;
import iaik.pkcs.pkcs11.Slot;
import iaik.pkcs.pkcs11.Session;
import iaik.pkcs.pkcs11.objects.RSAPrivateKey;
import java.util.Vector;
import iaik.pkcs.pkcs11.objects.PrivateKey;
import iaik.pkcs.pkcs11.objects.X509PublicKeyCertificate;
import java.util.Enumeration;
import iaik.pkcs.pkcs11.objects.Key;
import java.security.cert.CertificateFactory;
import java.io.ByteArrayInputStream;
import iaik.pkcs.pkcs11.Mechanism;
import java.security.Security;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import java.io.File;
import java.io.FileInputStream;
import org.bouncycastle.cms.CMSSignedDataGenerator;
import org.bouncycastle.cms.CMSProcessableByteArray;
import java.util.ArrayList;
import java.security.cert.CertStore;
import java.security.cert.CollectionCertStoreParameters;
import org.bouncycastle.cms.CMSSignedData;
import java.io.FileOutputStream;
import java.security.cert.X509Certificate;
import iaik.pkcs.pkcs11.TokenInfo;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
public class MakeSignature {
public static void main(String[] args) {
String USER_PIN = "12345678";
String DLL_NAME = "C:\\windows\\system32\\dll_P11_name.dll";
String OBJ_LABEL1 = "CNS0"; //this is the label of my 1th cert
String OBJ_LABEL2 = "CNS1"; //this is the label of my 2th cert
String INPUT_FILE = "C:\\Temp\\test.txt";
String OUTPUT_FILE = "C:\\Temp\\test.p7m";
try {
// ********** INITIALIZE PKCS#11 MODULE WITH DEFAULT PARAMETERS **********
Module pkcs11Module = Module.getInstance(DLL_NAME);
pkcs11Module.initialize(new DefaultInitializeArgs());
// ********** SELECT TOKEN **********
Slot[] slotsWithToken = pkcs11Module.getSlotList(Module.SlotRequirement.TOKEN_PRESENT);
Token[] tokens = new Token[slotsWithToken.length];
Hashtable tokenIDtoToken = new Hashtable(tokens.length);
long tokenID = -1;
Token tokenUsed = null;
//enum readers
for (int i = 0; i < slotsWithToken.length; i++) {
tokens[i] = slotsWithToken.getToken();
tokenID = tokens[i].getTokenID();
tokenIDtoToken.put(new Long(tokenID), tokens[i]);
System.out.println("Active tokens:");
System.out.println("Token ID: " + tokenID);
if (tokens.length == 0) { //No SC found
System.out.println("No SC presents");
else {
System.out.println("Using token: " + tokens[0].getTokenID());
tokenUsed = tokens[0];
//Note: if you have more reader and more SC inserted, you have to write
//here the code for select the right token
// ********** OPEN SESSION VS THE TOKEN AND IF REQUIRED SUBMIT PIN **********
TokenInfo tokenInfo = tokenUsed.getTokenInfo();
Session session = tokenUsed.openSession(Token.SessionType.SERIAL_SESSION, false, null, null);
if (tokenInfo.isLoginRequired()) {
session.login(Session.UserType.USER, USER_PIN.toCharArray());
// ********** SET SEARCH TEMPLATE FOR THE P11 OBJECT **********
RSAPrivateKey privateSignatureKeyTemplate = new RSAPrivateKey();
privateSignatureKeyTemplate.getSign().setBooleanValue(Boolean.TRUE);
privateSignatureKeyTemplate.getLabel().setCharArrayValue(OBJ_LABEL2.toCharArray());
// ********** SEARCH P11 OBJECT USING TEMPLATE **********
Vector keyList = new Vector(4);
session.findObjectsInit(privateSignatureKeyTemplate);
Object[] matchingKeys;
while ( (matchingKeys = session.findObjects(1)).length > 0) {
keyList.addElement(matchingKeys[0]);
session.findObjectsFinal();
//Try to find the corresponding certificates for the signature keys
Hashtable keyToCertificateTable = new Hashtable(4);
Enumeration keyListEnumeration = keyList.elements();
while (keyListEnumeration.hasMoreElements()) {
PrivateKey signatureKey = (PrivateKey) keyListEnumeration.nextElement();
byte[] keyID = signatureKey.getId().getByteArrayValue();
X509PublicKeyCertificate certificateTemplate = new X509PublicKeyCertificate();
certificateTemplate.getId().setByteArrayValue(keyID);
session.findObjectsInit(certificateTemplate);
Object[] correspondingCertificates = session.findObjects(1);
if (correspondingCertificates.length > 0) {
keyToCertificateTable.put(signatureKey, correspondingCertificates[0]);
session.findObjectsFinal();
//There are three cases now: 1 no obj found; 2 found only one obj, 3 found more obj
Key selectedKey = null;
X509PublicKeyCertificate correspondingCertificate = null;
//no object found for template
if (keyList.size() == 0) {
System.out.println("No object found for template");
throw new Exception("No object found for template");
//Founf only one object
else if (keyList.size() == 1) {
selectedKey = (Key) keyList.elementAt(0);
// create a IAIK JCE certificate from the PKCS11 certificate
correspondingCertificate = (X509PublicKeyCertificate)keyToCertificateTable.get(selectedKey);
System.out.println("One object Found");
//Found more object ... user can select one
else {
System.out.println("Many obj found!!!");
//write here the code for select the right object
// ********** GET THE OBJECT **********
RSAPrivateKey signerPriKey = (RSAPrivateKey) selectedKey;
java.security.cert.CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
byte[] derEncodedCertificate = correspondingCertificate.getValue().getByteArrayValue();
//Cast to java.security.cert.X509Certificate
java.security.cert.X509Certificate signerCert = (java.security.cert.X509Certificate) certificateFactory.
generateCertificate(new ByteArrayInputStream(derEncodedCertificate));
// ********** SIGNATURE OPERATION **********
//Add BouncyCastle as provider
Security.addProvider(new BouncyCastleProvider());
//initialize signature operation
session.signInit(Mechanism.RSA_PKCS, (PrivateKey) signerPriKey);
//get input data
File src = new File(INPUT_FILE);
int sizecontent = ( (int) src.length());
byte[] contentData = new byte[sizecontent];
FileInputStream freader = new FileInputStream(src);
freader.read(contentData, 0, sizecontent);
freader.close();
//calculate digest of the input data
byte[] toEncrypt = buildBits(contentData); //I've already posted the code for this function
//make signature
byte[] signature = session.sign(toEncrypt);
// ********** MAKE P7 WELL FORMAT DOCUMENT **********
//CMSSignedDataGenerator fact = new CMSSignedDataGenerator();
Signature2CMSSignedData fact = new Signature2CMSSignedData();
CMSProcessableByteArray content = new CMSProcessableByteArray(contentData);
//Creation of BC CertStore
ArrayList certList = new ArrayList();
certList.add(signerCert);
CertStore certs = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certList), "BC");
//Signature Alg
String algorithm = CMSSignedDataGenerator.DIGEST_SHA1;
//add element to P7
fact.addSignature(signature, signerCert, algorithm);
fact.addCertificatesAndCRLs(certs);
//generate enveloped using Bouncycastle provider
CMSSignedData envdata = fact.generate(PKCSObjectIdentifiers.data.getId(), content, true);
byte[] enveloped = envdata.getEncoded();
//Write P7 file
FileOutputStream efos = new FileOutputStream(OUTPUT_FILE);
efos.write(enveloped);
efos.close();
// ********** END **********
session.closeSession();
pkcs11Module.finalize(null);
catch (Exception ex) {
ex.printStackTrace();
}Main class uses buildBits function (already posted in this topic) and Signature2CMSSignedData class.import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.security.cert.CertStore;
import java.security.cert.X509CRL;
import java.security.cert.X509Certificate;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1Set;
import org.bouncycastle.asn1.BERConstructedOctetString;
import org.bouncycastle.asn1.DEREncodable;
import org.bouncycastle.asn1.DERNull;
import org.bouncycastle.asn1.DERObject;
import org.bouncycastle.asn1.DERObjectIdentifier;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.cms.ContentInfo;
import org.bouncycastle.asn1.cms.IssuerAndSerialNumber;
import org.bouncycastle.asn1.cms.SignedData;
import org.bouncycastle.asn1.cms.SignerIdentifier;
import org.bouncycastle.asn1.cms.SignerInfo;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.CertificateList;
import org.bouncycastle.asn1.x509.TBSCertificateStructure;
import org.bouncycastle.asn1.x509.X509CertificateStructure;
import org.bouncycastle.cms.CMSProcessable;
import org.bouncycastle.cms.CMSSignedData;
* class for generating a RSA pkcs7-signature message.
public class Signature2CMSSignedData2 {
CertStore certStore;
List certs = new ArrayList();
List crls = new ArrayList();
List signerInfs = new ArrayList();
List signers = new ArrayList();
public static final String DATA = PKCSObjectIdentifiers.data.getId();
public static final String ENCRYPTION_RSA = "1.2.840.113549.1.1.1";
private byte[] signatureData = null;
private X509Certificate cert = null;
private String digestOID = null;
private String encOID = null;
public Signature2CMSSignedData2() {
public void addSignature(byte[] signatureData, X509Certificate cert, String digestOID) {
this.signatureData = signatureData;
this.cert = cert;
this.digestOID = digestOID;
this.encOID = ENCRYPTION_RSA;
public void addCertificatesAndCRLs(CertStore certStore) throws Exception{
try {
Iterator it = certStore.getCertificates(null).iterator();
while (it.hasNext()) {
X509Certificate c = (X509Certificate) it.next();
certs.add(new X509CertificateStructure((ASN1Sequence) makeObj(c.getEncoded())));
Iterator it2 = certStore.getCRLs(null).iterator();
while (it2.hasNext()) {
X509CRL c = (X509CRL) it2.next();
crls.add(new CertificateList((ASN1Sequence) makeObj(c.getEncoded())));
catch (Exception e) {
throw new Exception(e.getMessage());
private DERObject makeObj(byte[] encoding) throws Exception {
if (encoding == null) {
return null;
ByteArrayInputStream bIn = new ByteArrayInputStream(encoding);
ASN1InputStream aIn = new ASN1InputStream(bIn);
return aIn.readObject();
public CMSSignedData generate(String signedContentType, CMSProcessable content, boolean encapsulate) throws Exception {
try {
ASN1EncodableVector digestAlgs = new ASN1EncodableVector();
ASN1EncodableVector signerInfos = new ASN1EncodableVector();
DERObjectIdentifier contentTypeOID = new DERObjectIdentifier(signedContentType);
// add the SignerInfo objects
Iterator it = signerInfs.iterator();
AlgorithmIdentifier digAlgId = new AlgorithmIdentifier(new DERObjectIdentifier(digestOID), new DERNull());
AlgorithmIdentifier encAlgId;
encAlgId = new AlgorithmIdentifier(new DERObjectIdentifier(encOID), new DERNull());
digestAlgs.add(digAlgId);
ASN1Set signedAttr = null;
ASN1Set unsignedAttr = null;
ASN1OctetString encDigest = new DEROctetString(signatureData);
ByteArrayInputStream bIn = new ByteArrayInputStream(cert.getTBSCertificate());
ASN1InputStream aIn = new ASN1InputStream(bIn);
TBSCertificateStructure tbs = TBSCertificateStructure.getInstance(aIn.readObject());
IssuerAndSerialNumber encSid = new IssuerAndSerialNumber(tbs.getIssuer(), tbs.getSerialNumber().getValue());
signerInfos.add(new SignerInfo(new SignerIdentifier(encSid), digAlgId, signedAttr, encAlgId, encDigest, unsignedAttr));
ASN1Set certificates = null;
if (certs.size() != 0) {
ASN1EncodableVector v = new ASN1EncodableVector();
it = certs.iterator();
while (it.hasNext()) {
v.add( (DEREncodable) it.next());
certificates = new DERSet(v);
ASN1Set certrevlist = null;
if (crls.size() != 0) {
ASN1EncodableVector v = new ASN1EncodableVector();
it = crls.iterator();
while (it.hasNext()) {
v.add( (DEREncodable) it.next());
certrevlist = new DERSet(v);
ContentInfo encInfo;
if (encapsulate) {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
content.write(bOut);
ASN1OctetString octs = new BERConstructedOctetString(bOut.toByteArray());
encInfo = new ContentInfo(contentTypeOID, octs);
else {
encInfo = new ContentInfo(contentTypeOID, null);
SignedData sd = new SignedData(new DERSet(digestAlgs), encInfo, certificates, certrevlist, new DERSet(signerInfos));
ContentInfo contentInfo = new ContentInfo(PKCSObjectIdentifiers.signedData, sd);
return new CMSSignedData(content, contentInfo);
catch (Exception e) {
throw new Exception(e.getMessage());
}Bye. -
Hi,
I have a question on using EJB / or RMI servers with CORBA clients using
RMI-IIOP transport, which in theory should work, but in practice has few
glitches.
Basically, I have implemented a very simple server, StockTreader, which
looks up for a symbol and returns a 'Stock' object. In the first example, I
simplified the 'Stock' object to be a mere java.lang.String, so that lookup
would simply return the 'synbol'.
Then I have implemented the above, as an RMI-IIOP server (case 1) and a
CORBA server (case 2) with respective clients, and the pair of
client-servers work fine as long as they are CORBA-to-CORBA and RMI-to-RMI.
But the problem arises when I tried using the RMI server (via IIOP) with the
CORBA client, when the client tries to narrow the object ref obtained from
the naming service into the CORBA idl defined type (StockTrader) it ends up
with a class cast exception.
This is what I did to achieve the above results:
[1] Define an RMI interface StockTrader.java (extending java.rmi.Remote)
with the method,
public String lookup( String symbol) throws RMIException;
[2] Implement the StorckTrader interface (on a PortableRemoteObject derived
class, to make it IIOP compliant), and then the server to register the stock
trader with COS Naming service as follows:
String homeName =....
StockTraderImpl trader =new StockTraderImpl();
System.out.println("binding obj <" homeName ">...");
java.util.Hashtable ht =new java.util.Hashtable();
ht.put("java.naming.factory.initial", args[2]);
ht.put("java.naming.provider.url", args[3]);
Context ctx =new InitialContext(ht);
ctx.rebind(homeName, trader);
[3] Generate the RMI-IIOP skeletons for the Implementation class,
rmic -iiop stock.StockTraderImpl
[4] generate the IDL for the RMI interface,
rmic -idl stock.StockTraderImpl
[5] Generate IDL stubs for the CORBA client,
idlj -v -fclient -emitAll StockTraderImpl.idl
[6] Write the client to use the IDL-defined stock trader,
String serverName =args[0];
String symList =args[1];
StockClient client =new StockClient();
System.out.println("init orb...");
ORB orb =ORB.init(args, null);
System.out.println("resolve init name service...");
org.omg.CORBA.Object objRef
=orb.resolve_initial_references("NameService");
NamingContext naming =NamingContextHelper.narrow(objRef);
... define a naming component etc...
org.omg.CORBA.Object obj =naming.resolve(...);
System.out.println("narrow objRef: " obj.getClass() ": " +obj);
StockTrader trader =StockTraderHelper.narrow(obj);
[7] Compile all the classes using Java 1.2.2
[8] start tnameserv (naming service), then the server to register the RMI
server obj
[9] Run the CORBA client, passing it the COSNaming service ref name (with
which the server obj is registered)
The CORBA client successfully finds the server obj ref in the naming
service, the operation StockTraderHelper.narrow() fails in the segment
below, with a class cast exception:
org.omg.CORBA.Object obj =naming.resolve(...);
StockTrader trader =StockTraderHelper.narrow(obj);
The <obj> returned by naming service turns out to be of the type;
class com.sun.rmi.iiop.CDRInputStream$1
This is of the same type when stock trader object is registered in a CORBA
server (as opposed to an RMI server), but works correctly with no casting
excpetions..
Any ideas / hints very welcome.
thanks in advance,
-hariOn the contrary... all that is being said is that we needed to provide clearer examples/documentation in the 5.1.0 release. There will be no difference between the product as found in the service pack and the product found in the 5.1.1. That is, the only substantive will be that 5.1.1 will also
include the examples.
"<=one way=>" wrote:
With reference to your and other messages, it appears that one should not
expect that WLS RMI-IIOP will work in a complex real-life system, at least
not now. In other words, support for real-life CORBA clients is not an
option in the current release of WLS.
TIA
"Eduardo Ceballos" <[email protected]> wrote in message
news:[email protected]...
We currently publish an IDL example, even though the IDL programmingmodel in Java is completely non-functional, in anticipation of the support
needs for uses who need to use IDL to talk to the Weblogic server,
generically. This example illustrates the simplest connectivity; it does not
address how
to integrate CORBA and EJB, a broad topic, fraught with peril, imo. I'llnote in passing that, to my knowledge, none of the other vendors attempt
this topic either, a point which is telling if all the less happy to hear.
For the record then, what is missing from our distribution wrt RMI-IIOPare a RMI-IIOP example, an EJB-IIOP example, an EJB-C++. In this you are
correct; better examples are forth coming.
Still, I would not call our RMI-IIOP implementation fragile. I would saythat customers have an understandably hard time accepting that the IDL
programming model is busted; busted in the sense that there are no C++
libraries to support the EJB model, and busted in the sense that there is
simply no
support in Java for an IDL interface to an EJB. Weblogic has nothing to doit being busted, although we are trying to help our customers deal with it
in productive ways.
For the moment, what there is is a RMI (over IIOP) programming model, aninherently Java to Java programming model, and true to that, we accept and
dispatch IIOP request into RMI server objects. The way I look at it is this:
it's just a protocol, like HTTP, or JRMP; it's not IDL and it has
practically nothing to do with CORBA.
ST wrote:
Eduardo,
Can you give us more details about the comment below:
I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult ot
use an idl client in java to work.It seems to me that Weblogic's RMI-IIOP is a very fragile
implementation. We
don't need a "HelloWorld" example, we need a concrete serious example(fully
tested and seriously documented) that works so that we can get a betteridea
on how to integrate CORBA and EJB.
Thanks,
Said
"Eduardo Ceballos" <[email protected]> wrote in message
news:[email protected]...
Please post request to the news group...
As I said, you must separate the idl related classes (class files and
java
files) from the rmi classes... in the rmic step, you must set a newtarget
(as you did), emit the java files into that directory (it's not clearyou
did this), then remove all the rmi class files from the class path... ifyou
need to compile more classes at that point, copy the java files to theidl
directly is you must, but you can not share the types in any way.
I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult otuse
an idl client in java to work.
Harindra Rajapakshe wrote:
Hi Eduardo,
Thanks for the help. That is the way I compiled my CORBA client, by
separating the IDL-generated stubs from the RMI ones, but still I
get a
CORBA.BAD_PARAM upon narrowing the client proxy to the interfacetype.
Here's what I did;
+ Define the RMI interfaces, in this case a StockTrader interface.
+ Implement RMI interface by extendingjavax.rmi.PortableRemoteObject
making
it IIOP compliant
+ Implemnnt an RMI server, and compile using JDK1.2.2
+ use the RMI implementation to generate CORBA idl, using RMI-IIOPplugin
utility rmic;
rmic -idl -noValueMethods -always -d idl stock.StockTraderImpl
+ generate Java mappings to the IDL generated above, using RMI-IIOPplugin
util,
idlj -v -fclient -emitAll -tf src stocks\StockTrader.idl
This creates source for the package stock and also
org.omg.CORBA.*
package, presumably IIOP type marshalling
+ compile all classes generated above using JDK1.2.2
+ Implement client (CORBA) using the classes generated above, NOTthe
RMI
proxies.
+ start RMI server, with stockTrader server obj
+ start tnameserv
+ start CORBA client
Then the client errors when trying to narrow the obj ref from the
naming
service, into the CORBA IDL defined interface using,
org.omg.CORBA.Object obj =naming.resolve(nn);
StockTrader trader =StockTraderHelper.narrow(obj); // THIS
ERRORS..!!!
throwing a CORBA.BAD_PARAM exception.
any ideas..?
Thanks in advance,
-hari
----- Original Message -----
From: Eduardo Ceballos <[email protected]>
Newsgroups: weblogic.developer.interest.rmi-iiop
To: Hari Rajapakshe <[email protected]>
Sent: Wednesday, July 26, 2000 4:38 AM
Subject: Re: problem using CORBA clients with RMI/EJBservers..!!!???
Please see the post on june 26, re Errors compiling... somewherein
there,
I suspect, you are referring to the rmi class file when you are
obliged
to
completely segregate these from the idl class files.
Hari Rajapakshe wrote:
Hi,
I have a question on using EJB / or RMI servers with CORBA
clients
using
RMI-IIOP transport, which in theory should work, but in practice
has
few
glitches.
Basically, I have implemented a very simple server,
StockTreader,
which
looks up for a symbol and returns a 'Stock' object. In the firstexample, I
simplified the 'Stock' object to be a mere java.lang.String, so
that
lookup
would simply return the 'synbol'.
Then I have implemented the above, as an RMI-IIOP server (case
1)
and a
CORBA server (case 2) with respective clients, and the pair of
client-servers work fine as long as they are CORBA-to-CORBA andRMI-to-RMI.
But the problem arises when I tried using the RMI server (via
IIOP)
with
the
CORBA client, when the client tries to narrow the object ref
obtained
from
the naming service into the CORBA idl defined type (StockTrader)
it
ends
up
with a class cast exception.
This is what I did to achieve the above results:
[1] Define an RMI interface StockTrader.java (extending
java.rmi.Remote)
with the method,
public String lookup( String symbol) throws RMIException;
[2] Implement the StorckTrader interface (on a
PortableRemoteObject
derived
class, to make it IIOP compliant), and then the server to
register
the
stock
trader with COS Naming service as follows:
String homeName =....
StockTraderImpl trader =new StockTraderImpl();
System.out.println("binding obj <" homeName ">...");
java.util.Hashtable ht =new java.util.Hashtable();
ht.put("java.naming.factory.initial", args[2]);
ht.put("java.naming.provider.url", args[3]);
Context ctx =new InitialContext(ht);
ctx.rebind(homeName, trader);
[3] Generate the RMI-IIOP skeletons for the Implementation
class,
rmic -iiop stock.StockTraderImpl
[4] generate the IDL for the RMI interface,
rmic -idl stock.StockTraderImpl
[5] Generate IDL stubs for the CORBA client,
idlj -v -fclient -emitAll StockTraderImpl.idl
[6] Write the client to use the IDL-defined stock trader,
String serverName =args[0];
String symList =args[1];
StockClient client =new StockClient();
System.out.println("init orb...");
ORB orb =ORB.init(args, null);
System.out.println("resolve init name service...");
org.omg.CORBA.Object objRef
=orb.resolve_initial_references("NameService");
NamingContext naming=NamingContextHelper.narrow(objRef);
... define a naming component etc...
org.omg.CORBA.Object obj =naming.resolve(...);
System.out.println("narrow objRef: " obj.getClass() ":"
+obj);
StockTrader trader =StockTraderHelper.narrow(obj);
[7] Compile all the classes using Java 1.2.2
[8] start tnameserv (naming service), then the server to
register
the
RMI
server obj
[9] Run the CORBA client, passing it the COSNaming service ref
name
(with
which the server obj is registered)
The CORBA client successfully finds the server obj ref in the
naming
service, the operation StockTraderHelper.narrow() fails in thesegment
below, with a class cast exception:
org.omg.CORBA.Object obj =naming.resolve(...);
StockTrader trader =StockTraderHelper.narrow(obj);
The <obj> returned by naming service turns out to be of the
type;
class com.sun.rmi.iiop.CDRInputStream$1
This is of the same type when stock trader object is registeredin a
CORBA
server (as opposed to an RMI server), but works correctly with
no
casting
excpetions..
Any ideas / hints very welcome.
thanks in advance,
-hari
Maybe you are looking for
-
Deauthorize Computer? My own Music?
I've been a LONG time user of mac (1986+) and i actually feel embarrased to NOT understand this: I Just bought 2 days ago a Macbook. I LOVE the ipod-style remote interface, and decided to import some of me cds so when I hook up the laptop to my theat
-
Is there such a Cable my Speaker System?
I have a Sony 5.1 Home Theater System hooked up to my Audigy 2 sound card, with a Audio L/R to single mini-jack(line out ). Is there a cable to go from the Home Theater System Audio L/R to 3-way mini-jack to go to all 3 line outs of my Audigy 2? And
-
Multiple IP address (alias) - 1 NIC - setting default outgoing IP
I have a mac that I use for a web server. I have two IP addresses on the same interface, say x.x.x.5 and x.x.x.6, Usually when starting a connection out of this box, I get x.x.x.5 as my IP address. Occasionally though, I end up with x.x.x.6 which cau
-
What has happened with Quality with an Acer Product?
My son purchased an Acer Aspire E1 in the Spring of 2014, the Hard Drive failed within 8 months. No problem, the warranty took care of it. I now have had the Hard Drive replaced again within the 7 months of the factory replaced one. Acer's tech suppo
-
PDF Optimizer, Postscript Conversion and Distiller features in Adobe Acrobat X
I use Adobe Acrobat Professional 7 and make considerable use of the "PDF Optimizer"; "Save as Postscript" and "Distiller" features. We are looking at upgrading to Adobe Acrobat X, either the Standard or Professional version. Can someome tell me if "