Applying XSLT to XSLT result in Java
I want to apply a 2nd XSLT to results of ProcessXSL. I started from JDeveloper sample code: TransformedShoppingCart.java. After I have applied one XSL I want to apply another. Code snip:
//Up to here have read in an xml file,
//parsed it and read an xsl file.
//This processXSL works fine.
DocumentFragment df1 = processor.processXSL(theXSLStylesheet, theXMLDoc1);
//The next one fails:
//Read another XSL file
XSLStream = FindElement.class.getResourceAsStream("/product1.xsl");
if (XSLStream == null) {
System.out.println("product1.xsl not found in the CLASSPATH.");
XSLStylesheet theXSLStylesheet2 = new XSLStylesheet(XSLStream,null);
// Transform df1 by theXSLStylesheet2 to create df2
DocumentFragment df2 = processor.processXSL(theXSLStylesheet2, df1);
I get this error:
Error: (76) method processXSL(oracle.xml.parser.v2.XSLStylesheet, org.w3c.dom.DocumentFragment) not found in class oracle.xml.parser.v2.XSLProcessor.
Why? When I look at documentation on OTN at: http://technet.oracle.com/doc/oracle8i_816/server.816/a76935/oracle_x.htm#1027364
I see a version of processXSL:
processXSL(XSLStylesheet, XMLDocumentFragment)
Is my problem that I am passing DocumentFragment instead of XMLDocumentFragment? If so how do I convert my DocumentFragment to XMLDocumentFragment? I tried casting but it didnt like that either.
null
You'll have to write an adapter for that in Interconnect. BPEL uses XSLT for transformations.
Similar Messages
-
How can i display the result of java class in InputText ?
Hi all,
How can i get the result of java class to InputText Or OutputText ???
also can every one in the forum give me road map for dealing with java in oracle adf because i'm beginner in oracle adf
i saw some samples in oracle adf corner but it's difficult for me.User,
Always mention your JDev version, technologies used and clear usecase description (read through this announcement : https://forums.oracle.com/forums/ann.jspa?annID=56)
How can i get the result of java class to InputText Or OutputText ???Can you elaborate on your requirement? Do you mean the return value of a method in a class as output text? Or an attribute in your class (bean?) as text field?
-Arun -
Converting Oracle XML Query Result in Java String by using XSU
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
ThanksHmmm.. Pretty basic just look at the example:
OracleXMLQuery qry = new OracleXMLQuery(conn,"Select max(ps.datum) from preise ps where match='"+args[0]+"'");
String xmlString = qry.getXMLString();
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
Thanks -
XSLT Mapping : RFC Lookup using java helper class
Hi All,
I am doing RFC Lookup in xslt mapping using java helper class. I have found blog for the same (http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14) However this blog is very advanced.
Can anybody help me with step by step approach for the same?
My basic questions are not answered in the blog as:
1) where to add the jar file of the java class used in xslt mapping.
I have added zip file of XSLT mapping in imported archived and using that in mapping.
Thanks in advace.
Regards,
RohanHi,
Can u please have look at this in detail , u can easily point out yourself the problem...
http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm
Please observe the line,
xmlns:javamap="java:com.company.group.MappingClass
in XSLT mapping..
The packagename of class and class name and XSLT namespace should be matching...
Babu
Edited by: hlbabu123 on Sep 29, 2010 6:04 PM -
XSLT - How to pass a Java object to the xslt file ?
Hi ,
I need help in , How to pass a java object to xslt file.
I am using javax.xml.transform.Tranformer class to for the xsl tranformation. I need to pass a java object eg
Class Employee {
private String name;
private int empId;
public String getName() {
return this.name;
public String getEmpId() {
return this.empId;
public String setName(String name) {
this.name = name;
public String setEmpId(int empId){
this.empId = empId;
How can i access this complete object in the xsl file ? is there any way i can pass custom objects to xsl using Transformer class ?This is elementary. Did you ask google ? http://www.google.com/search?q=calling+java+from+xsl
ram. -
XSLT producing different results via debugger and xslt.Transform()
I'm producing the body of an email via an xsl. I've been having a problem with the html nested inside a <table> tag not displaying correctly. With a bit of help from the good folks over at the asp.net forums, I've tracked the problem down to getting
different results if I run the xsl via the debugger or via a compiled transform.
When I debug the xsl it produces
<table border="1" cellpadding="4" cellspacing="0" style="..." id="tmsEmailTable">
<tr>
<th width="50%" align="center"><b>Issue</b></th>
<th width="50%" align="center"><b>Resolution</b></th>
</tr>
<tr>
<td>Missing Acknowledgement date</td>
<td><p> Test test</p></td>
</tr>
<tr>
<td>Missing Agent and/or Seller signature</td>
</table>
And that's absolutely correct and displays perfectly if I save the result as an html file. But when I use xslt.Transform(..), where xslt is a compiled transform, it produces
<table border="1" cellpadding="4" cellspacing="0" style="..." id="tmsEmailTable">
<tr><th width="50%" align="center"><b>Issue</b></th><th width="50%" align="center"><b>Resolution</b></th></tr>
<tr>
<td>
Missing Acknowledgement date
</td>
<td></td>
</tr>
</table>
</p><p> Test test</p></td></tr><tr>
<td>Missing Agent and/or Seller signature</td>
<td>
</table>
And to make it even more interesting, that extra </table> tag and the misplaced table data only occur on the first table row, but the table rows are generated by an xsl:for-each.
The relevant bit of the xsl is:
<table border="1" cellpadding="4" cellspacing="0" style="..." id="tmsEmailTable">
<tr>
<th width="50%" align="center">
<b>Issue</b>
</th>
<th width="50%" align="center">
<b>Resolution</b>
</th>
</tr>
<xsl:for-each select="emailbody/checklist/item">
<xsl:if test="string-length(select='issue')>0">
<tr>
<td>
<xsl:value-of select="issue" disable-output-escaping="yes" />
</td>
<td>
<xsl:value-of select="resolution" disable-output-escaping="yes" />
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
The code that generates the compiled transform and the (incorrect) output is:
Dim xslt As XslCompiledTransform = New XslCompiledTransform(True)
'Dim xslt As XslTransform = New XslTransform
xslt.Load(templatePath)
Dim objStream As Stream = New MemoryStream(UTF8Encoding.UTF8.GetBytes(xmlData))
Dim strbldrXML As StringBuilder = New StringBuilder()
Dim objXmlReader As XmlReader = XmlReader.Create(objStream)
Dim objXmlWriter As XmlWriter = XmlWriter.Create(strbldrXML)
xslt.Transform(objXmlReader, objXmlWriter)
I've checked that templatePath is pointing to the right file, and the source file I'm debugging the xsl against was copied from the xmlData parameter, so I know the same stuff is getting fed into it.
I've been chasing this for days, and I'm about ready to quit and go get a job at a fast food joint. I'm not wonderful with xsl in general, or xsl in .NET in particular. Somebody PLEASE tell me I'm doing something stupid....
Rebecca M. RiordanThanks for the replay, Fred, but that wasn't the problem.
I still don't know what the problem was, but in putting together a sample for review, I cleaned up the code a little (I inherited this), and while it
appears to be functionally identical, it's working now. Since we're scheduled to go live on Friday, I'm gonna just take the win ;)
In the unlikely event that anybody's curious, the original, non-functional code, looked like this:
Public Function createEmailBody(ByVal templateType As String, ByVal xmlData As String) As String
Dim templatePath, emailBody As String
templatePath = Me.templatePath & "\" & templateType & ".xsl"
Dim xpd As New XPathDocument(New StringReader(xmlData))
Dim xslt As XslCompiledTransform = New XslCompiledTransform(False)
xslt.Load(templatePath)
Dim objStream As Stream = New MemoryStream(UTF8Encoding.UTF8.GetBytes(xmlData))
Dim strbldrXML As StringBuilder = New StringBuilder()
Dim objXmlReader As XmlReader = XmlReader.Create(objStream)
Dim objXmlWriter As XmlWriter = XmlWriter.Create(strbldrXML)
xslt.Transform(objXmlReader, objXmlWriter)
emailBody = strbldrXML.ToString()
Return emailBody
End Function
In cleaning it up, I wrote this:
Public Function createEmailBody(ByVal templateType As String, ByVal xmlData As String) As String
Dim xslt As XslCompiledTransform = New XslCompiledTransform(False)
Dim templatePath As String = Me.templatePath & templateType & ".xsl"
xslt.Load(templatePath)
Dim reader As XmlReader = XmlReader.Create(New MemoryStream(UTF8Encoding.UTF8.GetBytes(xmlData)))
Dim outSB As StringBuilder = New StringBuilder()
Dim writer As XmlWriter = XmlWriter.Create(outSB)
xslt.Transform(reader, writer)
Dim emailBody As String = outSB.ToString()
Return emailBody
End Function
As I said, they look functionally identical to me, but obviously they're not, because the second one works....
Rebecca M. Riordan -
Stateful session EJB is deployed on cluster members A and B. Client calls a method
on the bean and the request is routed to server A, then A is shut down. The client's
next method invocation is routed to server B where the bean's state has been replicated.
Server A re-joins the cluster and B is shut down, the request routed to A results
in the following:
java.rmi.NoSuchObjectException: Activation failed with: java.io.StreamCorruptedException:
InputStream does not contain a serialized object
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:33)
at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:43)
at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:54)
at weblogic.ejb20.swap.PassivationUtils.read(PassivationUtils.java:50)
at weblogic.ejb20.swap.ReplicatedMemorySwap.read(ReplicatedMemorySwap.java:111)
at weblogic.ejb20.manager.StatefulSessionManager.getBean(StatefulSessionManager.java:178)
at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessionManager.java:236)
at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:113)
at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject.java:148)
at com.access360.enrole.apps.ejb.organization.SearchManagerBeanEOImpl.findAllPeople(SearchManagerBeanEOImpl.java:644)
at com.access360.enrole.webclient.organization.person.PeopleList.getPeople(PeopleList.java:148)
at com.access360.enrole.webclient.organization.person.PeopleListServlet.constructPeopleListXML(PeopleListServlet.java:284)
at com.access360.enrole.webclient.organization.person.PeopleListServlet.service(PeopleListServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:275)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:183)
at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.forwardToPeopleList(SubmitPersonAddServlet.java:134)
at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.service(SubmitPersonAddServlet.java:114)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.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)
We are certain that the EJB's entire object graph is Serializable. Any comments on
this failover scenario?
Alex Rodriguez
Software Engineer, Access360
[email protected]
Rajesh,
Thanks for the reply. We are running WL 6.0 SP2 with RP3. We cannot reproduce it
consistently. In your reply you mention "... and EJB handles". Does that refer to
another patch?
As for the code, we will run tests with a scaled down version of the stateful bean
and a simple client servlet. I will post the code asap. The high level call sequence
is: servlet service() -> lookup ejb home -> get cluster aware stub from home -> put
bean handle in http session -> call bean method -> server A goes down -> next call
to the bean -> get handle from replicated http session -> get bean from handle ->
request is routed to server B. java.io.StreamCorruptedException is thrown, sometimes,
when server A re-joins the cluster and a request is routed to it (i.e. server B is
shut-down). One thing I did not mention is that the bean is deployed on server A,
and server A is also the Admin server. We are considering not using the Admin server
to deploy the bean, however, but will add another Managed server.
Will contact support about CR073917: can it be applied to WL 6.0 SP3 with RP3?
Regards,
Alex J. Rodriguez
Rajesh Mirchandani <[email protected]> wrote:
>
>Alex,
>
>Are you able to consitently reproduce this? Could you post your code here?
>
>What version of the Server with Service pack are you using?
>
>If you are using WLS 6.1SP2 and EJB handles contact support and get a patch
>for CR073917.
>
>
>"Alex J. Rodriguez" wrote:
>
>> Stateful session EJB is deployed on cluster members A and B. Client calls
>a method
>> on the bean and the request is routed to server A, then A is shut down.
>The client's
>> next method invocation is routed to server B where the bean's state has
>been replicated.
>> Server A re-joins the cluster and B is shut down, the request routed to
>A results
>> in the following:
>>
>> java.rmi.NoSuchObjectException: Activation failed with: java.io.StreamCorruptedException:
>> InputStream does not contain a serialized object
>> at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
>> at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
>> at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:33)
>> at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:43)
>> at weblogic.common.internal.ReplacerObjectInputStream.<init>(ReplacerObjectInputStream.java:54)
>> at weblogic.ejb20.swap.PassivationUtils.read(PassivationUtils.java:50)
>> at weblogic.ejb20.swap.ReplicatedMemorySwap.read(ReplicatedMemorySwap.java:111)
>> at weblogic.ejb20.manager.StatefulSessionManager.getBean(StatefulSessionManager.java:178)
>> at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessionManager.java:236)
>> at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:113)
>> at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject.java:148)
>> at com.access360.enrole.apps.ejb.organization.SearchManagerBeanEOImpl.findAllPeople(SearchManagerBeanEOImpl.java:644)
>> at com.access360.enrole.webclient.organization.person.PeopleList.getPeople(PeopleList.java:148)
>> at com.access360.enrole.webclient.organization.person.PeopleListServlet.constructPeopleListXML(PeopleListServlet.java:284)
>> at com.access360.enrole.webclient.organization.person.PeopleListServlet.service(PeopleListServlet.java:238)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
>> at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:275)
>> at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:183)
>> at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.forwardToPeopleList(SubmitPersonAddServlet.java:134)
>> at com.access360.enrole.webclient.organization.person.SubmitPersonAddServlet.service(SubmitPersonAddServlet.java:114)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>> at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
>> at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.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)
>>
>> We are certain that the EJB's entire object graph is Serializable. Any
>comments on
>> this failover scenario?
>>
>> Alex Rodriguez
>> Software Engineer, Access360
>> [email protected]
>
-
RFC Import from own SAP XI results in java.lang.NullPointerException
Hi All,
I'm trying to do an import of a local RFC (developed in SAP XI) but this results in a java.lang.NullPointerException
RFC import from other SAP system is no problem.
Anyone an idea?
Cheers,
FrankHi,
But we are using custom RFCs from SAP XI only. We are using XI3.0 SP11.
Could you pls check the following sap notes..
SAP Notes 677732, 672745, 212011, and 718320.
Have a look at the following link...
http://help.sap.com/saphelp_nw04/helpdata/en/2b/a48f3c685bc358e10000000a11405a/frameset.htm
Thanks,
Sasi -
Calling Portal Service using result as Java Bean Model impossible?
Hello folks,
we try to achieve to call a portal service (working) which gives as a result a list of object of type com.foo.Report. We want to make use of this class as a model class, so we have the class as a model node in the context. The class itself is part of the service DC.
Unfortunately at run time it gives us a NoClassDefFound Exception of com.foo.Report.
As the com.foo.Report is part of the same DC as the service, it is no option to add the PAR public part to the used DCs of the WD DC because then there is this type conflict when we call the service (service look up). Or am I wrong and this is the way to do it? I mean I struggled quite a while to get the service look up right and needed to remove all the PAR/lib used DCs from the used DCs of the WD Project, when I got it working this Model error came up. I also tried to put the Model class in a separate DC but that caused the same error.
how is it possible to call a Portal service from WD and using it's return vale as a Model class
our system iis 7.0.17
best
StefanHi,
Refers the following docs..
EJBs in Web Dynpro Application Using Wrapper Class
Here Java Bean Model used in web dynpro.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00be903b-8551-2b10-c28a-8520400c6451
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c
Accessing database table using EJB and web dynpro
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70929198-0d36-2b10-04b8-84d90fa3df9c
Oracle Connectivity with EJB using WebDynpro Application
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/wdjava/oracle%2bconnectivity%2bwith%2bejb%2busing%2bwebdynpro%2bapplication
Hope it will help u.
thanks
Abhilasha -
EJB lookup via JNDI results in java.lang.NoClassDefFoundError
Hello,
I have created and deployed an EJB to the WebAS (ver 6.40). There is no problem looking up the bean via JNDI and calling its methods from a J2EE application - I successfully did this via a servlet.
However, a JNDI lookup from a Web Dynpro application - on the same server - results in a java.lang.NoClassDefFoundError error.
The code for the JNDI lookup is identical in either case.
Any thoughts?Hello,
I am calling ejb from .jsp use following code
Properties props = new Properties();
InitialContext ctx = new InitialContext();
Object ob = ctx.lookup("java:comp/env/ejb/CalculatorBean");
CalculatorHome home = (CalculatorHome) PortableRemoteObject.narrow(ob, CalculatorHome.class);
calc = home.create();
I have a error:
java.lang.ClassNotFoundException: class com.sap.examples.calculator.beans.CalcProxy : com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at calculator, the whole lookup name is java:comp/env/ejb/CalculatorBean
My ejb-jar.xml is:
<display-name>
CalculatorEjb</display-name>
<enterprise-beans>
<session>
<icon/>
<ejb-name>Calculator</ejb-name>
<home>com.sap.examples.calculator.CalculatorHome</home>
<remote>com.sap.examples.calculator.CalculatorRemote</remote>
<local-home>com.sap.examples.calculator.CalculatorLocalHome</local-home>
<local>com.sap.examples.calculator.CalculatorLocal</local>
<service-endpoint>com.sap.examples.calculator.CalculatorServiceEndpoint</service-endpoint>
<ejb-class>com.sap.examples.calculator.CalculatorBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/CalculatorBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.sap.examples.calculator.CalculatorHome</home>
<remote>com.sap.examples.calculator.CalculatorRemote</remote>
<ejb-link>Calculator</ejb-link>
</ejb-ref>
<ejb-local-ref>
<description/>
<ejb-ref-name>ejb/CalculatorBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.sap.examples.calculator.CalculatorLocalHome</local-home>
<local>com.sap.examples.calculator.CalculatorLocal</local>
<ejb-link>Calculator</ejb-link>
</ejb-local-ref>
</session>
</enterprise-beans>
my ejb-j2ee-engine.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-j2ee-engine
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ejb-j2ee-engine.xsd">
<enterprise-beans>
<enterprise-bean>
<ejb-name>Calculator</ejb-name>
<ejb-ref>
<ejb-ref-name>ejb/CalculatorBean</ejb-ref-name>
<jndi-name>ejb/CalculatorBean</jndi-name>
</ejb-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/CalculatorBean</ejb-ref-name>
<jndi-name>ejb/CalculatorBean</jndi-name>
</ejb-local-ref>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine> -
Retrieve asyn process result via java
How can I get the asyn process result through com.oracle.bpel.client.Locator?
I have already got the conversation id and the IInstanceHandle
but the getResult and getField are not return a value
Can anyone help me?
Thank you
RoyHi Priya,
Please check the links
Working with Tuples
http://help.sap.com/saphelp_nwmdm71/helpdata/en/f9/ff1d5f39c048eaa6e1eb7012004c32/content.htm
and check
programming interfaces-What's New in MDM Java and .NET API-MDM 7.1
http://help.sap.com/saphelp_nwmdm71/helpdata/en/07/75ee377070466c9fb65030ae2ae4af/frameset.htm
Thanks,
Sudhanshu -
How to display sqlplus result in java?
I want to call sqlplus to execute some sql commands in java,but how can i print the result of sqlplus?
In java code ,i call sqlplus like:
Process p;
//execute the command
p = Runtime.getRuntime().exec(commandString);
//print return result of the command
InputStream inputStream = p.getInputStream();
How to display the execution result?
Edited by: Yi on Feb 26, 2012 11:41 PMYou can use ProcessBuilder. This code launches sql*plus and runs the script in the 'filename' variable. It displays the results in NetBeans console.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.File;
import java.util.Map;
public class test1 {
public static void main (String args []) {
test_script();
public static void test_script () {
String fileName = "@test_table.sql";
String sqlPath = "E:\\";
String sqlCmd = "sqlplus";
String arg1 = "user/password@sid"; -- plug in your user, password and db name
String arg2 = fileName;
try {
String line;
ProcessBuilder pb = new ProcessBuilder(sqlCmd, arg1, arg2);
Map<String, String> env = pb.environment();
env.put("VAR1", arg1);
env.put("VAR2", arg2);
pb.directory(new File(sqlPath));
pb.redirectErrorStream(true);
Process p = pb.start();
BufferedReader bri = new BufferedReader
(new InputStreamReader(p.getInputStream()));
BufferedReader bre = new BufferedReader
(new InputStreamReader(p.getErrorStream()));
while ((line = bri.readLine()) != null) {
System.out.println(line);
bri.close();
while ((line = bre.readLine()) != null) {
System.out.println(line);
bre.close();
System.out.println("Done.");
catch (Exception err) {
err.printStackTrace();
}Here is the contents of the script placed at E:\\test_table.sql
Prompt drop TABLE ANOTHER_TEST;
DROP TABLE ANOTHER_TEST CASCADE CONSTRAINTS
Prompt Table ANOTHER_TEST;
CREATE TABLE ANOTHER_TEST
BATCH_SEQ NUMBER,
BATCH_GROUP_ID NUMBER,
STATUS_FLAG VARCHAR2(30 BYTE),
OBJ_BEING_PROCESSED VARCHAR2(80 BYTE),
BATCH_RUN_START_DTTM DATE,
BATCH_RUN_END_DTTM DATE,
CREATE_DTTM DATE,
CREATE_USER VARCHAR2(30 BYTE),
UPDATE_DTTM DATE,
UPDATE_USER VARCHAR2(30 BYTE)
LOGGING
NOCOMPRESS
NOCACHE
PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT )
MONITORING
COMMENT ON TABLE ANOTHER_TEST IS 'This is a test table.'
EXIT
/ -
Hi All,
I'm building an web service that needs to make an URL connection.
In order to build the connection, I must set the proxy.
The problem is it seems that I cannot do
Properties Sys=System.getProperties();
since it results in the following exception :
java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
here is part of my code (part of the implementation of the SEI of my web service)
Properties Sys=System.getProperties();
Sys.put("proxySet","true");
Sys.put("proxyPort","8080");
Sys.put("proxyHost","webcache.singapore.sun.com");
URL url = new URL("http://www.geobytes.com/IpLocator.htm?GetLocation");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
I'm using SUN App Server 8, my IDE is netbeans 4.1
Any other way in setting the proxy without getting properties from my system? or any work around to make my code working. Please help me, any suggestions are highly appreciated.
Regards,
maggyI have changed the server.policy and adding the read access permission, now everything can work properly.
thanks -
Applying patches 4406640 & 4496111 results in errors
I applied Patch 1 & Patch 2 (4406640 & 4496111) to a working instance of 10.1.2.0.0 and now when I start the BPEL PM I get the errors below for many of the BPEL processes.
Does anyone have any idea what is causing this?
<2008-01-10 11:34:57,109> <ERROR> <UTEST.collaxa.cube.activation> <AdapterFramework::Inbound> JCAActivationAgent::load - Error while performing endpoint activation:java.lang.NoSuchMethodError: com.collaxa.cube.engine.deployment.DeploymentHelper.getLocationResolver(Lcom/collaxa/cube/engine/ICubeContext;)Lcom/collaxa/cube/rm/LocationResolver;
<2008-01-10 11:34:57,109> <ERROR> <UTEST.collaxa.cube.activation> <AdapterFramework::Inbound>
java.lang.NoSuchMethodError: com.collaxa.cube.engine.deployment.DeploymentHelper.getLocationResolver(Lcom/collaxa/cube/engine/ICubeContext;)Lcom/collaxa/cube/rm/LocationResolver;
at oracle.tip.adapter.fw.agent.jca.JCAActivationAgent.load(JCAActivationAgent.java:161)
at com.collaxa.cube.engine.core.BaseCubeProcess.loadActivationAgents(BaseCubeProcess.java:931)
at com.collaxa.cube.engine.core.BaseCubeProcess.load(BaseCubeProcess.java:302)
at com.collaxa.cube.engine.deployment.CubeProcessFactory.create(CubeProcessFactory.java:66)
at com.collaxa.cube.engine.deployment.CubeProcessLoader.create(CubeProcessLoader.java:391)
at com.collaxa.cube.engine.deployment.CubeProcessLoader.load(CubeProcessLoader.java:302)
at com.collaxa.cube.engine.deployment.CubeProcessHolder.loadAndBind(CubeProcessHolder.java:881)
at com.collaxa.cube.engine.deployment.CubeProcessHolder.getProcess(CubeProcessHolder.java:789)
at com.collaxa.cube.engine.deployment.CubeProcessHolder.loadAll(CubeProcessHolder.java:361)
at com.collaxa.cube.engine.CubeEngine.loadAllProcesses(CubeEngine.java:960)
at com.collaxa.cube.admin.ServerManager.loadProcesses(ServerManager.java:284)
at com.collaxa.cube.admin.ServerManager.loadProcesses(ServerManager.java:250)
at com.collaxa.cube.ejb.impl.ServerBean.loadProcesses(ServerBean.java:219)
at IServerBean_StatelessSessionBeanWrapper14.loadProcesses(IServerBean_StatelessSessionBeanWrapper14.java:2399)
at com.collaxa.cube.admin.agents.ProcessLoaderAgent$ProcessJob.execute(ProcessLoaderAgent.java:395)
at org.quartz.core.JobRunShell.run(JobRunShell.java:141)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:281)
<2008-01-10 11:34:57,109> <ERROR> <UTEST.collaxa.cube.engine.deployment> <CubeProcessLoader::create> com.collaxa.cube.engine.deployment.DeploymentHelper.getLocationResolver(Lcom/collaxa/cube/engine/ICubeContext;)Lcom/collaxa/cube/rm/LocationResolver;
<2008-01-10 11:34:57,110> <ERROR> <UTEST.collaxa.cube.engine.deployment> Process "OrderResponse" (revision "3.0") load FAILED!!
<2008-01-10 11:34:57,113> <ERROR> <UTEST.collaxa.cube.engine.deployment> <CubeProcessHolder::loadAll> Error while loading process 'OrderResponse', rev '3.0': Error while loading process.
The process domain encountered the following errors while loading the process "OrderResponse" (revision "3.0"): com.collaxa.cube.engine.deployment.DeploymentHelper.getLocationResolver(Lcom/collaxa/cube/engine/ICubeContext;)Lcom/collaxa/cube/rm/LocationResolver;.
If you have installed a patch to the server, please check that the bpelcClasspath domain property includes the patch classes.looks like the patch was not applied correctly, you are seeing some mismatched classes. the signature of the methods are different.
is it possible to move to 10.1.3.3.0. there are some cool features and tons of issues fixed on 10.1.3.3.0. -
ERROR WHILE APPLYING SP ON NETWEAVER 7.30 JAVA STACK
Hi Experts,
We are trying to apply Support pack on netweaver java stack using JSPM. While applying we are getting below error.
I have attached deploy_api.0.log also. Can any one tel how to resolve this issue.
Thanks & Regards,
Jithin MHi Sriram,
As per 1882305 - Could not establish connection to AS Java for principal [test] note you shared i tried to apply below core components but same error i am getting
SERVERCORE, ENGINEAPI, J2EE-FRMW, J2EE-APPS and CORETOOLS SCA
Regards,
Jithin M
Maybe you are looking for
-
How do I clear the recently edited files in the file menu?
How do I clear the recently edited files in the file menu? (ie. cache)
-
IOS5, WHERE ARE MY PICTURES AND VIDEOS? i take pictures but it says "there's no photos"
it's getting worst... almost like windows... I take pictures normally, but it says "there's no photos" what I have to do? Pray for Steve Jobs?
-
Email Account Question for Photoshop Elements 10 Organizer
I can create draft photo emails and email messages with attachments in Photoshop Elements 10 Organizer, but I cannot activate and send them apparently unless my client is Microsoft Outlook. I have two other email accounts that I want to use, but not
-
Restoring in Lion, using Time Machine saved in Snow
I just replaced my HD and am in the process of reinstalling numerous items. I now have Lion, but prior to replacing the HD, I had Snow. I simply imported my vcard into address book, but it combined all the groups. I must have them separated, and ther
-
Elements 12 - what happened to 'make dull skies blue'?
I shoot a lot of landscapes and outdoor scenes. I also digitized a lot of old photos taken without polarizing filters. I used Elements 10 and its 'make dull skies blue' extensively. Now, having converted to Elements 12, I'm looking for the same fe