Fault Policies using retry and java hadler
Hi,
I am using fault policies to handle a remote and binding faults.Whenever i get a fault i want to retry for 5 times and then call a java handler, which will insert the error into queue.
I have written the fault policies and java handler.But the problem is for each retry it is going to Java handler and pushing the message to queue.
Here is my Fault policies file.
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<faultPolicy version="2.0.1" id="FaultHandling-faultpolicy">
<Conditions>
<faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
name="bpelx:remoteFault">
<condition>
<action ref="ora-retry"/>
</condition>
</faultName>
<faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
name="bpelx:bindingFault">
<condition>
<action ref="ora-retry"/>
</condition>
</faultName>
<faultName xmlns:bpelx="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
name="bpws:selectionFailure">
<condition>
<action ref="ora-retry"/>
</condition>
</faultName>
</Conditions>
<Actions>
<Action id="ora-terminate">
<abort/>
</Action>
<Action id="ora-replay-scope">
<replayScope/>
</Action>
<Action id="ora-retry">
<retry>
<retryCount>7</retryCount>
<retryInterval>2</retryInterval>
<retryFailureAction ref="ora-java"/>
</retry>
</Action>
<Action id="ora-java">
<javaAction className="faultpolicies.MyFaultHandler"
defaultAction="ora-human-intervention"
propertySet="customLogProps">
</javaAction>
</Action>
<Action id="ora-rethrow-fault">
<rethrowFault/>
</Action>
<Action id="ora-human-intervention">
<humanIntervention/>
</Action>
</Actions>
</faultPolicy>
</faultPolicies>
Pls guide me what should be done..
Thanks.
There is no point in retry on binding fault, rather you can raise it as exception and catch it in sepcific catch block or catch all will handle it.
Ideally this particular instance will be faulted and if required you can customize to send a mail with fault string to developer or support person or dba
This type of fault need human intervension to fix this code or it could be data issue.
- It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts).
Thanks,
Vijay
Similar Messages
-
Simple XML to Text onversion using XSLT and Java?
Hi all!
I'm completly new to using XSLT and Java and are trying to convert a XML file into a ordinary Textfile that I am gonna import into another application.
I started up writing a ordinary XML parser in Java which interpreted the XML file, but realized later on that it was possible to do with a ordinary XSLT.
So far it is a 2-step process right now, I've tied my XSLT to the XML file and then just open the XML file up in a ordinary browser and then get the result.
I found an example (http://www.onjava.com/pub/a/onjava/excerpt/java_xslt_ch5/index.html?page=3) where u hook up a XML file and a XSL file separately and the process it, and dump it to Stdout. But do I need to hook up a XSL file like this when the XML file is tied to a XSL file internally?Just to give you an example to show you how easy it is: http://www.daniweb.com/forums/thread137587.html
-
Information Retrieval with Genetic Programming using J2ME and Java WTK
i have a big project to make a software using java programming especially n using J2ME and Java Wireless Toolkit, and i'm a begginer for java programming. I have no idea for the interface and how to setting connection between my phone mobile and GPRS. what should i do? thank you
I believe MIT has lots of sourcecode. Try searching their site.
-
Not able to recognize any video/audio devices using jmf and java soun
Hi ,
I need one help from your side.
Here I am expecting some clarifications from you. Before that let you my environement.
My working environment :
Eclipse tool and added jmf jar to my project I did not do any thing more.
If any thing I need to do just let me know. My target platform is MAC & UBUNTU.
Please bare with my questions.
1) I am not able to recognize any video/audio devices using jmf and java sound APIs on My system.
( I checked with the app mentioned in the http://www.java-forums.org/new-java/11201-jmf-cannot-connect-device.html )
Do we need any administrives rights for our working PC.
What is the procedure/ setup I need to follow from a java application to enable particular audio/video device since I dont about end-user system setup right.
If possible send some sample code to recognize /r detect audio device ( voice input ). It should run on both MAC and UBUNTU.
2) I run the one sample audio recording application of this link (http://www.jsresources.org/examples/SimpleAudioRecorder.java.html) which is provided by YOU.
I got output audio file and able to hear voice on UBUNTU system but not able to hear voice on MAC system.
I heared that default line in ( audio setup of the sys) is wont take any voice data on MAC.Why I made this stmt means we are getting false when using isSupported methods of JAVA SOUND API.
( like for TragetdataLine ...i,e, all ports are getting false)
I have one sample audio recording app implemented by QUICKTIME API. In this case also he taking audio ftom device only using quicetime API.
With that we are able to record and hear audio ( voice input --> not line in , external device we added some thing like SSB...)
3) In case of Video capturing DataSource, Streams are implemented by PullBufferDataSource , PullBufferStream intefaces used.
In case of Audio capturing DataSource, Streams are implemented by PushBufferDataSource, PushBufferStream intefaces used.
Can you explain the reasons ? I gone through API but i am not clear.
HOPE I WILL BE CLARIFIED EVERY THING FROM YOU.
Thanks
RamaRao.GHi ,
I need one help from your side.
Here I am expecting some clarifications from you. Before that let you my environement.
My working environment :
Eclipse tool and added jmf jar to my project I did not do any thing more.
If any thing I need to do just let me know. My target platform is MAC & UBUNTU.
Please bare with my questions.
1) I am not able to recognize any video/audio devices using jmf and java sound APIs on My system.
( I checked with the app mentioned in the http://www.java-forums.org/new-java/11201-jmf-cannot-connect-device.html )
Do we need any administrives rights for our working PC.
What is the procedure/ setup I need to follow from a java application to enable particular audio/video device since I dont about end-user system setup right.
If possible send some sample code to recognize /r detect audio device ( voice input ). It should run on both MAC and UBUNTU.
2) I run the one sample audio recording application of this link (http://www.jsresources.org/examples/SimpleAudioRecorder.java.html) which is provided by YOU.
I got output audio file and able to hear voice on UBUNTU system but not able to hear voice on MAC system.
I heared that default line in ( audio setup of the sys) is wont take any voice data on MAC.Why I made this stmt means we are getting false when using isSupported methods of JAVA SOUND API.
( like for TragetdataLine ...i,e, all ports are getting false)
I have one sample audio recording app implemented by QUICKTIME API. In this case also he taking audio ftom device only using quicetime API.
With that we are able to record and hear audio ( voice input --> not line in , external device we added some thing like SSB...)
3) In case of Video capturing DataSource, Streams are implemented by PullBufferDataSource , PullBufferStream intefaces used.
In case of Audio capturing DataSource, Streams are implemented by PushBufferDataSource, PushBufferStream intefaces used.
Can you explain the reasons ? I gone through API but i am not clear.
HOPE I WILL BE CLARIFIED EVERY THING FROM YOU.
Thanks
RamaRao.G -
Using fault-policies with mediator and db Adapter doesn't work
Please help! I'm stuck on this for 2 days....
Hi Friends.
In my project I am trying to give some treatment to an exception from a db adapter running a pl/sql procedure.
I am forcing a raise_application_error in the procedure in order to treat the exception and I'd like the fault-police to treat it as "human-intervention".
The db-adapter is wired to a mediator:
jms-service ----> Mediator -----> Jca db adapter
When I get the exception the log says:
9d8bff56a1 due to: BINDING.JCA-12563[[
Exception occured when binding was invoked.
Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'PersistirODS' failed due to: Stored procedure invocation error.
Error while trying to prepare and execute the FORNECEDOR.UPSERTFORNECEDOR API.
An error occurred while preparing and executing the FORNECEDOR.UPSERTFORNECEDOR API. Cause: java.sql.SQLException: ORA-20101: Deu Merda
ORA-06512: at "FORNECEDOR.UPSERTFORNECEDOR", line 405
ORA-06512: at line 1
Check to ensure that the API is defined in the database and that the parameters match the signature of the API. This exception is considered not retriable, likely due to a modelling mistake. To classify it as retriable instead add property nonRetriableErrorCodes with value "-20101" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers.
The invoked JCA adapter raised a resource exception.
Please examine the above error message carefully to determine a resolution.
and then it looks like it's trying to run some fault-police but it says:
[2014-04-10T20:01:39.667-03:00] [AdminServer] [WARNING] [] [oracle.integration.platform.faulthandling] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\n] [userId: weblogic] [ecid: 11d1def534ea1be0:-1fa77a00:145468d59e7:-8000-000000000002801a,0] [APP: soa-infra] [RejectedMsgHandling]Unable to apply policies on the rejected message with id - 60046[[
oracle.fabric.common.FabricException: Cannot resolve binding to a fault policy [Faulted Activity Details:
Activity Name=null
Activity Id=null
Activity lineNumber=null
Reference Name=null
WsdlLocation=null
ActivityType=null
Here are my fault-policies and fault-bindings files:
<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicyBindings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.oracle.com/bpel/faultpolicy ../xsd/FaultBindings.xsd"
xmlns="http://schemas.oracle.com/bpel/faultpolicy">
<composite faultPolicy="fault-policy"/>
</faultPolicyBindings>
<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicies xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.oracle.com/bpel/faultpolicy ../xsd/FaultPolicies.xsd"
xmlns="http://schemas.oracle.com/bpel/faultpolicy">
<faultPolicy id="fault-policy">
<Conditions>
<faultName xmlns:medns="http://schemas.oracle.com/mediator/faults"
name="medns:mediatorFault" >
<condition>
<action ref="default-human-intervention"/>
</condition>
</faultName>
<faultName xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages" name="rjm:PersistirODS">
<condition>
<action ref="default-human-intervention"/>
</condition>
</faultName>
<faultName>
<condition>
<action ref="default-human-intervention"/>
</condition>
</faultName>
</Conditions>
<Actions>
<Action id="default-human-intervention">
<humanIntervention/>
</Action>
</Actions>
</faultPolicy>
</faultPolicies>
Again
Please help! I'm stuck on this for 2 days....Could you try specifying test element inside condition like the following one
<faultName xmlns:medns="http://schemas.oracle.com/mediator/faults" name="medns:mediatorFault">
<condition>
<test>contains($fault.mediatorErrorCode, "AppropriateErrorCode")</test>
<action ref="default-human-intervention"/>
</condition>
</faultName> -
Fault policies for Mediator and BPEL
Hi
Can i use same fault-policies.xml for both mediator and BPEL or i need to create different fault-policies.xmlYes you can use the same file, just you need to mention the BPEL/Mediator name with in component tag. Like below in fault policy file.
<component faultPolicy="FusionMidFaults">
<name>MediatorName</name>
<name>BPELName</name>
</component>
You can refer the below URL.
https://blogs.oracle.com/ateamsoab2b/entry/fault_management_framework_by_example
*7) Give points - it is good etiquette to reward an answerer points (5 - helpful; 10 - correct) for their post if they answer your question.*
thanks,
Vijay -
Syntax errors using sql and java
Could somebody inform of the correct syntax for using UPDATE and INSERT SQL commands in a java program? Any information I can find demonstrates this with:
INSERT INTO table_name(column_name, ..., column_name)
VALUES(value, ..., value)
However - this isn't working? any suggestions - and I know its very basic, but I'm just learning.
String query = " INSERT INTO SESSIONS (" +
"id,module_name, module_number, level, session " +
"term, class_list, location, lecturer" + ")
VALUES('"+
fields.id.getText() + "', '"+
fields.module_name.getText() + "', '" + fields.module_number.getText() + "', '" +
fields.level.getText() + "', '" fields.session.getText() "', '" +
fields.term.getText() + "', '" fields.class_list.getText() "', '" +
fields.location.getText() + "', '" fields.lecturer.getText() "')";
output.append( " \nSending query: " + connection.nativeSQL(query)+ "\n");
output.append( "query sent");
thanks
int result = statement.executeUpdate(query);With all those quotes and apostrophes and string concatenations, I'd be surprised if you got it right by the fourth try. (By the way, you appear to have missed a comma between "session" and "term".) Are you planning to insert more than one record in your program? If so, you should consider using a PreparedStatement. This will likely run faster, and your program will definitely be easier to read. Also, you won't have to come back here later to ask how you deal with data that includes apostrophes (the notorious "O'Brien" problem). Here's how you do that... you define the PreparedStatement only once:
String query =
"INSERT INTO SESSIONS (id,module_name, module_number, level, session, term, class_list, location, lecturer) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
PreparedStatement insert = connection.prepareStatement(query);and then every time you want to insert a record you do this:
insert.setString(1, fields.id.getText());
insert.setString(2, fields.module_name.getText());
// and so on...
insert.executeQuery(); -
Building a best practice web application using ColdFusion and Jave EE
I've been tasked with rewriting a software using ColdFusion. I cannot seem to find a lot of information on best practice development in ColdFusion. I am an experience Java developer who has never used ColdFusion before. I want to build this application using a synergy of ColdFusion and Java EE technologies. Can someone recommend me a book that outlines how to developer in ColdFusion? Ideally this book assumes the reader is an experienced developer with no exposure to ColdFusion. Ideally the methods outlined in the book are still "best practice" methods.
jaisheela wrote:
Hello Friends,
I am also in the same situation.
I am a building a new web application using JSF and AJAX.
Requirement is I need to use IBM version of DOJO and JSF but I need to develop the whole application using Eclipse 3.3,2 and Tomcat 5.5.
With IBM version of DOJO and JSF, will Eclipse and Tomcat help to speed up the development or do you suggest me to go for Rational Application Developer and WebSphere Application Server.
If I need to go with RAD and WAS, then I am new to RAD and WAS, is it easy to use RAD and WAS for this kind of application and implement web applicaiton fast.
Any feedback will be great help.Those don't sound like requirements of the system to me. They sound more like someone wants to improve their CV/resume
From what I've read recently, if it's just fast you want, look at Ruby on Rails -
How use XSD and Java? What classes/methods?
I want to use an XSD instead of a DTD with my XML and Java. Does anyone know the classes/methods I should use to do this? Is it even possible? Can you send sample code?
here is the helper function... hope it helps...
import java.io.IOException;
import java.math.*;
import java.text.*;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.ErrorHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
public class SAXParserDemo
public SAXParserDemo()
public void performDemo(String uri)
System.out.println("Parsing XML file: " + uri + "\n\n");
ContentHandler contentHandler = new MyContentHandler();
ErrorHandler errorHandler = new MyErrorHandler();
try
XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
parser.setContentHandler(contentHandler);
parser.setErrorHandler(errorHandler);
parser.setFeature("http://xml.org/sax/features/validation", true);
parser.parse(uri);
catch(IOException e)
System.out.println("Error reading URI: " + e);
catch(SAXException e)
System.out.println("Error in parsing: " + e);
public static void main(String[] args)
if(args.length != 1)
System.out.println("Usage: java SAXParserDemo [XML URI]");
System.exit(0);
String uri = args[0];
SAXParserDemo parserDemo = new SAXParserDemo();
parserDemo.performDemo(uri);
class MyErrorHandler implements ErrorHandler
public void warning(SAXParseException exception) throws SAXException
throw new SAXException("Warning encountered."+exception);
public void error(SAXParseException exception) throws SAXException
throw new SAXException("Error encountered: "+exception);
public void fatalError(SAXParseException exception) throws SAXException
throw new SAXException("Fatal error encountered."+exception);
class MyContentHandler implements ContentHandler
private Locator locator;
public void setDocumentLocator(Locator locator)
//System.out.println(" * setDocumentLocator() called");
this.locator = locator;
public void startDocument() throws SAXException
//System.out.println("System Message: Parsing begins...");
public void endDocument() throws SAXException
//System.out.println("System Message: ...Parsing ends.");
public void processingInstruction(String target, String data) throws SAXException
//System.out.println("System Message: PI: Target: "+target+" and Data: "+data);
public void startPrefixMapping(String prefix, String uri)
//System.out.println("System Message: Mapping starts on prefix "+prefix+" mapped to URI "+uri);
public void endPrefixMapping(String prefix)
//System.out.println("System Message: Mapping ends on prefix "+prefix);
public void startElement(String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException
//System.out.println("System Message: startElement: "+localName);
if(!namespaceURI.equals(""))
//System.out.println("System Message: in namespace "+namespaceURI+" ("+rawName+")");
else
//System.out.println("System Message: has no associated namespace");
int i;
for(i=0;i<atts.getLength();i++)
//System.out.println("System Message: Attribute: "+atts.getLocalName(i)+"="+atts.getValue(i));
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException
//System.out.println("System Message: endElement: "+localName+"\n");
public void characters(char[] ch, int start, int length) throws SAXException
String s = new String(ch, start, length);
//System.out.println("System Message: characters: "+s);
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
String s = new String(ch, start, length);
//System.out.println("System Message: ignorableWhitespace: ["+s+"]");
public void skippedEntity(String name) throws SAXException
//System.out.println("System Message: Skipping entity: "+name);
} -
Does anyone know how you can use JAVA and FLASH together for database access like you can use coldfusion and (I think PHP)?
Kind Regards
Schalk
Volume4
Dedicated to an OpenSource World(tm)I have used flash as a menu in jsp page and I am calling my jsp pages through Flash,
write if u need anything specific,
Samir -
Need Help Badly on Shopping Cart Using JSP And Java Servlet
Hi All,
This is the 1st time i am trying to create a shopping cart using JSP and Servlet.
I have read through a few acticles but i still do not get the whole idea of how it works.
Please guide me as i need help very badly.
Thanks.
This is one of the jsp page which displays the category of products user would like to buy : Products.jsp
<html>
<head>
<title>Purchase Order</title>
</head>
<body topmargin="30">
<table border="0" width="100%" id="table1" cellpadding="2">
<tr>
<td bgcolor="#990000" width="96">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
Code</font></b></td>
<td bgcolor="#990000" width="260">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
Description </font></b></td>
<td bgcolor="#990000" width="130">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">Brand
</font></b></td>
<td bgcolor="#990000" width="146">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">UOM
</font></b></td>
<td bgcolor="#990000" width="57">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">Unit<br>
Price </font></b></td>
<td bgcolor="#990000" width="62">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
Carton<br>
Price </font></b></td>
<td bgcolor="#990000" width="36">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">
Qty</font></b></td>
<td bgcolor="#990000" width="65">
<p align="center"><b><font face="Verdana" size="2" color="#FFFFFF">Add<br>
To Cart</font></b></td>
</tr>
<tr>
<td align="center" width="96" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">123</font>
</td>
<td align="center" width="260" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">Tom Yam</font>
</td>
<td align="center" width="130" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">Nissin</font>
</td>
<td align="center" width="146" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">12 x 10's</font>
</td>
<td align="center" width="57" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">$3.85</font>
</td>
<td align="center" width="62" bgcolor="#CCCCCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">$46.2</font>
</td>
<td align="center" width="36" bgcolor="#CCCCCC">
<!--webbot bot="Validation" S-Data-Type="Integer" S-Number-Separators="x" -->
<p align="center"><input type="Integer" name="Q10005" size="1"></p>
</td>
<td align="center" width="65" bgcolor="#CCCCCC">
<p><input type="checkbox" name="checkbox" value="123"></p>
</tr>
<tr>
</table>
<table border="0" width="100%" id="table2">
<tr>
<td>
<div align="right">
<input type="hidden" name="hAction" value="AddToCart"/>
<input type=submit name="submit" value="Add To Cart"/>
</div>
</td>
</tr>
</table>
</body>
</html>
After user has make his selection by entering the qty and ticking on the check box, he would click the "Add To Cart" button ... and this would call my servlet : AddToAddControlSerlvet.java
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
public class AddToCartControlServlet extends HttpServlet
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException
String action = req.getParameter("hAction");
if (action.equals("AddToCart"))
addToCart(req,res);
public void addToCart(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
try
String url = "";
String[] addList = req.getParameterValues("checkbox");
HttpSession sess = req.getSession(true);
//String sessionID = sess.getId();
DBClass dbClass = new DBClass();
ArrayList cartList = new ArrayList();
for (int i = 0; i < addList.length; i++)
String productCode = (String)addList;
int qty = Integer.parseInt(req.getParameter("Q"+productCode));
Products product = dbClass.getProductDetail(productCode);
double totalUnitAmt = qty * product.getUnitPrice();
double totalCartonAmt = qty * product.getCartonPrice();
Order order = new Order(product.getProductCode(),product.getProductDesc(),product.getBrandName(),product.getUom(),qty,product.getUnitPrice(),product.getCartonPrice(),totalUnitAmt,totalCartonAmt);
cartList.add(order);
sess.setAttribute("cartList", cartList);
url = "/Cart/CartDetails.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
rd.forward(req, res);
catch (Exception e)
System.out.println(e);
From here, i would get the list of items which user has selected and add to the cartList, then i would direct the user to CartDetails.jsp which displayed the items user has selected.
From there, user would be able to remove or to continue shopping by selecting other category.
How i do store all the items user has selected ... everytime he would wan to view his cart ...
As i would be calling from jsp to servlet .. or jsp to servlet ... and i do not know how i should go about in creating the shopping cart.Hi !
Yon can use a data structure as vector and store the items selected by the user into the vector . Keep the vector in session using session object , so the user can access the entire shopping cart from anywhere in the application .
Then , you can change the cart accordingly .
Hope this works.
Cheers ,
Pranav -
Hello all:
When I am in my file folder on my university of linux account, which contaning all the neccessary files(they are all in default package, which means that they are not in any sub folder of this folder) to run my program, I use the command(xml.jar is a jar file in the folder)
javac -classpath xml.jar Main.java
to compile my project, it says that it cannot file
symbol(the symbol is the name of a class I wrote in the current folder, so I do not why this error occurs?).
But when I was using the command
javac -classpath xml.jar *.java
No error was output, it compile successfully.
However, when I was using the command
java -classpath xml.jar Main < temp.input
It give me the following error message:
Exception in thread "main"
java.lang.NoClassDefFoundError: Main/java
I was so confused about it, because my program runs successful using eclipse. I do not know what is wrong with it? Any advice will helpBut I think it is in linux based system. And when it give me the following error message
y:~/Spring2006/project/MeeshQuest: java -classpath xml.jar;. Main < temp.input
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
/usr/local/bin/.: Permission denied. -
Sending email using SMTP and Java
Hi guys
I am using the following code to send an email:
private void sendEmail(String mDate, String time) {
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, Locale.ENGLISH);
// Open port to server
try {
smtpSocket = new Socket(SMTP_SERVER, SMTP_PORT);
os = new DataOutputStream(smtpSocket.getOutputStream());
is = new DataInputStream(smtpSocket.getInputStream());
// Connection was made. Socket is ready for use.
if(smtpSocket != null && os != null && is != null) {
try {
// email header
os.writeBytes("HELO\r\n");
// set the reply email address
os.writeBytes("MAIL From: <[email protected]>\r\n");
// give the address of the people that we want the email sent to
for(int i=0; i<RECIPIENTS.length; i++) {
os.writeBytes("RCPT To: <" + RECIPIENTS[i] + ">\r\n");
System.out.println(RECIPIENTS);
// data header
os.writeBytes("DATA\r\n");
os.writeBytes("X-Mailer: Via Java\r\n");
os.writeBytes("DATE: " + dateFormat.format(date) + "\r\n");
os.writeBytes("From: Characterisation System Update\r\n");
os.writeBytes("Mime-Version: 1.0\r\n");
os.writeBytes("Content-Type: text/html; charset=\"ISO-8859-1\"\r\n");
//os.writeBytes("Content-Transfer-Encoding: 7bit;\r\n");
for(int i=0; i<RECIPIENTS.length; i++) {
os.writeBytes("To: <" + RECIPIENTS[i] + ">\r\n");
// get the details of the test and enter them into the message body
String message = "<HTML><BODY>" +
"\r\nThe following System has not received a data packet for at leat 1 hour:" +
"\r\n<BR/><BR/><B>System:</B> " + rackName +
"\r\n<BR/><B>Time Last Pkt. Received:</B> " + time +
"\r\n<BR/><B>Date Last Pkt. Received:</B> " + mDate +
"\r\n<BR/><B>Job Number:</B> " + jobNoDispLabel.getText() +
"\r\n<BR/><B>Device:</B> " + deviceDispLabel.getText() +
"\r\n<BR/><B>Run Number:</B> " + runNoDispLabel.getText() +
"\r\n<BR/><B>Current Temperature:</B> " + tempDispLabel.getText() +
"\r\n<BR/><B>Current Module:</B> " + moduleDispLabel.getText() +
"\r\n<BR/><B>Current Test:</B> " + testingDispLabel.getText() +
"\r\n<BR/><BR/>This does not gurantee that the system has crashed!" +
"\r\n</BODY></HTML>";
os.writeBytes("Subject: " + rackName + " Packet Warning\r\n");
os.writeBytes(message + "\r\n");
os.writeBytes("\r\n.\r\n");
os.writeBytes("QUIT\r\n");
// Now send the email off and check the server reply.
// Was an OK is reached you are complete.
String responseline;
//DataInputStream d = new DataInputStream(is);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
while((responseline = reader.readLine())!= null) {
if(responseline.indexOf("Ok") != -1) {
break;
} catch(Exception e) {
System.out.println("Cannot send email as an error occurred.");
e.printStackTrace();
catch(Exception e) {
System.out.println("Host " + SMTP_SERVER + "unknown");
e.printStackTrace();
} finally {
// close all of the data streams
try {
if(!smtpSocket.isClosed()) {
smtpSocket.close();
smtpSocket = null;
} catch(Exception e) {
e.printStackTrace();
try {
if(os != null) {
os.close();
os = null;
} catch(Exception e) {
e.printStackTrace();
try {
if(is != null) {
is.close();
is = null;
} catch(Exception e) {
e.printStackTrace();
i have used an example on the web to help me do this, so it may look familiar!!
It works fine when i run the program in debug mode but doesn't work when i run the jar file, i was wondering if anyone could help me understand why? or give me a clue as to where to look as i have had the strange realisation that i rarely compile my code up to be used by other people!!
sad but true! Also apologies if i haven't posted adequate information, this is the first time i have posted on the forum asking for help!
Anyway help would be most appreciated and thanks in advanceSorry, by debug mode i mean running it using netbeans 5.5 and clicking on the "run main project" icon.
Once i have cleaned and built the main project all of the files are put into the jar file. Once i have done that i double click on the jar icon
is that ok? there doesn't seem to be any errors -
User parameter are not show in database using Servlet and java Bean
Hello Sir,
when I insert the parameter in run time, weblogic server and JSP show that parameter are saved.
Allthough row increment in database but they not show in database.
Here My Code:
login.html:
<html>
<head>
<title>A simple JSP application</title>
<head>
<body>
<form method="get" action="tmp" >
Name: <input type="text" name="user">
Password: <input type="password" name="pass">
<input type="Submit" value="Submit">
</form>
</body>
</html>LoginServlet.java:import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException{
try
String user=request.getParameter("user");
String pass=request.getParameter("pass");
co.SimpleBean st = new co.SimpleBean();
st.setuserName(user);
st.setpassword(pass);
request.setAttribute("user",st);
request.setAttribute("pass",st);
RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
dispatcher1.forward(request,response);
catch(Exception e)
e.printStackTrace();
}SimpleBean.java:
package co;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class SimpleBean {
private String user="";
private String pass="";
private String s="";
public String getuserName() {
return user;
public void setuserName(String user) {
this.user = user;
public String getpassword() {
return pass;
public void setpassword(String Pass) {
this.pass= pass ;
public String issueData()
try
System.out.println("Printed*************************************************************");
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Connection loaded");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
System.out.println("Connection created");
PreparedStatement st=con.prepareStatement("insert into vij2 values(?,?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String NAME=getuserName();
st.setString(1,NAME);
String PASSWORD=getpassword();
st.setString(2,PASSWORD);
st.executeUpdate();
System.out.println("Query Executed");
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
}submit.jsp:This is Submit page
<jsp:useBean id="st" class="co.SimpleBean"/>
<jsp:setProperty name="st" property="*" />
<jsp:getProperty name="st" property="userName" /> <br>
<jsp:getProperty name="st" property="password" /> <br>
<% st.issueData();%>
<%
out.println("Ur data is saved in DB");
%>Please Help me.
Thanks.Ok, this seems to be a long and convoluted path to do absolutely nothing.
You submit the form.
You run a servlet that gets the parameters correctly (good), creates a SimpleBean (good) and then sets this into request attribute space under the names "user" and "pass" - (why?)
You then forward to the jsp: submit.jsp.
Submit.jsp creates a new SimpleBean, and attempts to populate it with <jsp:setProperty>. You then call the issueData method on it.
Your complaint: Rows are being created in the database which have empty string values instead of the parameters you have passed.
So, why are the values blank? Where do you think these values should be coming from?
Looking at SimpleBean we find one mistake - you have mis-named your get/set methods.
To properly follow java beans standards, you should use camel-case for your methods.
Rather than getuserName() the method should be getUserName(). getpassword() should be getPassword() etc etc.
The method getUserName() defines a property "userName" for the bean.
Once that is fixed, lets go to submit.jsp. The <jsp:setProperty> statement will try and set all properties of the bean from the request parameters.
There are no request parameters "userName" or "password" so those values don't get set in the bean, therefore it uses their default value of empty string - "".
There ARE request parameters called "user" and "pass" but because they aren't properties of the bean, they get ignored.
As a result, the values are empty string, and that is exactly what gets inserted into the database.
Ways to fix this
1 - rename your parameters on your form to be "userName" and "password" to match the bean. That way the <jsp:setProperty> tag will populate them properly.
or
2 - Call issueData() method from your servlet after you have created the SimpleBean. Better in my opinion as you then don't have any scriptlet code on a JSP page.
Cheers,
evnafets -
Implementing password policie using Role and CoS
Hy all,
I have created a directory with the following partial structure (Sun directory 5.2 patch 2):
ou=people,o=accounts,c=an
|----- cn=user1
|----- cn=user2
|----- cn=user3
ou=services,o=accounts,c=an
|---------cn=user4
|---------cn=user5
|---------cn=user6
I want to assign different password policies based on the ou.
I read within the admin guide that there is a way to do that through CoS and Role: http://docs.sun.com/source/817-7613/useracct.html#wp19625
So I create following records:
- Customized Password Policy Container:
dn: cn=Customized Password Policy, c=an
objectClass: top
objectClass: nsContainer
cn: Customized Password Policy
- External User Customized Password Policy: (same as the global one)
dn: cn=externalUserPwdPolicy, cn=Customized Password Policy, c=an
objectClass: top
objectClass: passwordPolicy
cn: externalUserPwdPolicy
passwordInHistory: 5
passwordWarning: 432000
passwordExpireWithoutWarning: on
passwordRootdnMayBypassModsChecks: on
passwordLockout: on
passwordMaxFailure: 3
passwordMaxAge: 5184000
passwordCheckSyntax: off
passwordResetFailureCount: 1200
passwordMinLength: 8
passwordStorageScheme: SHA
passwordChange: on
passwordMinAge: 86400
passwordMustChange: off
passwordUnlock: off
passwordLockoutDuration: 3600
passwordExp: on
- Service Account Customized Password Policy: (same as the global one except that there is no expiration for password and the password minimum age is set to 2 days instead of one)
dn: cn=serviceAccountPwdPolicy, cn=Customized Password Policy, c=an
objectClass: top
objectClass: passwordPolicy
cn: serviceAccountPwdPolicy
passwordInHistory: 5
passwordWarning: 432000
passwordExpireWithoutWarning: on
passwordRootdnMayBypassModsChecks: on
passwordLockout: on
passwordMaxFailure: 3
passwordMaxAge: 5184000
passwordCheckSyntax: off
passwordResetFailureCount: 1200
passwordMinLength: 8
passwordStorageScheme: SHA
passwordChange: on
passwordMinAge: 172800
passwordMustChange: off
passwordUnlock: off
passwordLockoutDuration: 3600
passwordExp: off
- External User Role:
dn: cn=externalUserRole,c=an
objectclass: top
objectclass: LDAPsubentry
objectclass: nsRoleDefinition
objectclass: nsComplexRoleDefinition
objectclass: nsFilteredRoleDefinition
cn: externalUserRole
nsRoleFilter: (&(entrydn=*o=accounts*)(entrydn=*ou=people*))
Description: Filtered role for external users
- Service Account Role
dn: cn=serviceAccountRole,c=an
objectclass: top
objectclass: LDAPsubentry
objectclass: nsRoleDefinition
objectclass: nsComplexRoleDefinition
objectclass: nsFilteredRoleDefinition
cn: externalUserRole
nsRoleFilter: (&(entrydn=*o=accounts*)(entrydn=*ou=services*))
Description: Filtered role for external services account
- Template Container for Customized Password Policy:
dn: cn=pwdPolTemplateContainer, c=an
objectClass: top
objectClass: nscontainer
- Class of Service (CoS) Definition for password policy:
dn: cn=PwdPol_CoSDefinition, c=an
objectClass: top
objectClass: LDAPsubentry
objectClass: cosSuperDefinition
objectClass: cosClassicDefinition
cn: PwdPol_CoSDefinition
cosAttribute: passwordPolicySubentry operational
cosTemplateDn: cn=pwdPolTemplateContainer, c=an
cosSpecifier: nsRole
- Class of Service (CoS) Template for ExternalUserRole:
dn: cn="cn=externalUserRole, c=an", cn=PwdPolTemplateContainer, c=an
objectClass: top
objectClass: extensibleObject
objectClass: costemplate
objectClass: LDAPsubentry
cosPriority: 2
passwordPolicySubentry: cn=externalUserPwdPolicy, cn=Customized Password Policy, c=an
- Class of Service (CoS) Template for ServiceAccountRole:
dn: cn="cn=serviceAccountRole, c=an", cn=PwdPolTemplateContainer, c=an
objectClass: top
objectClass: extensibleObject
objectClass: costemplate
objectClass: LDAPsubentry
cosPriority: 2
passwordPolicySubentry: cn=serviceAccountPwdPolicy, cn=Customized Password Policy, c=an
- The thing is that it does not to work: if I disable the global password policy, I can set a 3 caracters password even if I specified in the sub password policy that passwordminlengnt is equal to 8 caracters.
Many thanks in advance for your help.
GregoireHmm,
Pretty cool.
I just finished doing it the hard-way when I saw your post :(.
I tried it anyways, and it did all the work that I had done by hand in the previous try. Which was ...
1) Creating the filtered role (same in both approaches).
2) Creating a Container for COS Templates.
3) Creating a COS Template with a dn having a cn string of the full dn to the role in 1) above. Had to use generic entry editor to add all the additional attributes as below ...
dn: cn="cn=TempFilter,ou=people,dc=example,dc=com",
�cn=PolTempl,dc=example,dc=com
objectclass: top
objectclass: extensibleObject
objectclass: LDAPsubentry
objectclass: costemplate
cosPriority: 1
passwordPolicySubentry: cn=TempPolicy,dc=example,dc=com
(started with a new costemplate and the added all the above attributes, also involved things like changing the naming attribute - the dn - from cosPriority to the one cn as shown above)
4) Creatiing a COS with ...
4.1) passwordpolicysubenty as a generated attribute that is overriding and operation (this is picked from the matched CoS template)
4.2) Use the template container's dn from 2) above for the TemplateDN value.
4.3) Use nsrole of the target enty to narrow down to the COS template as in 3) above. I.E. "template"->"attribute name" value is set to "nsRole"
(So when a user's nsrole maps to a cn value of an entry under the TemplateDN subtree. That template applies.)
Maybe you are looking for
-
whats the best FREE m4v to mp4 converter for mac osx? I have some m4v's that i want to put in iDVD.
-
Maintaining username and passwords in RAM
I need to be able to maintain a small list of usernames and passwords in memory after users logoff. I can't persist them to disk. What is the best object to use for this? I'm thinking some type of application object. I'm working with Weblogic and nee
-
How do I access classes and methods defined in a wsdl file
I have been provided a wsdl file I need to find out how do I access classes and methods defined in a wsdl file directly instead of doing a wsdl2java...
-
Cannot start Toshiba Recovery Disc Creator on my Satellite A300-15K
Hi! I'm from Poland so my English is a little poor.. (but I hope that is sufficient) My problem: I haven't Recovery disc (DVD) because I don't use earlier Toshiba Recobery Disc Creator (when all in my laptop was good). Now I haven't do this disc beca
-
Column Security - Users can't see it, but need to use it in the query WHERE Clause
I am looking at possible solutions (if any) on column security. We need to be able to restrict users from seeing certain columns, however, they will need these columns in the WHERE clause of queries. I thought about creating views, however, it would