when running open office from a bootstrap routine or in headless mode for batch processing make sure the following settings to avoid an unsatisfied link error
soffice -accept="pipe,name=my_app;urp;"
java -Djava.library.path=/opt/openoffice.org/program java.app.class
useful reference on Oo: http://www.oooforum.org/forum/viewtopic.phtml?t=40263
Pattern p = Pattern.compile("[0-9]");
Matcher m = p.matcher("asdas12dsad");
System.out.println(m.find());
@In("myEntityManager")
private EntityManager em;
...
MyObject myObject = em.find(MyObject.class, myObjectPrimaryKey);
WARN [org.jboss.system.ServiceController] Problem starting service jboss:service=Hypersonic,database=localDB
java.sql.SQLException: User not found: SA
It's possible that your jboss deployment has gone a bit squiffy.. try deleting the following:
jboss/server/default/tmp
jboss/server/default/data
jboss/server/default/work
caused by: java.lang.RuntimeException: Exception creating identity: domainName
your computer can't find itself
go to:
etc/hosts
make sure the loopback address refers to the name of the box you are running on ie
127.0.0.1 documentationServerBox localhost.localdomain localhost
for other information on linux network configs look at the redhat linux network guide
public enum SecpayErrorType {
authorised ("Transaction authorised by bank. auth_code available as bank reference"),
notAuthorised ("Transaction not authorised. Failure message text available to merchant"),
commsProblem ("Communication problem. Trying again later may well work"),
fraud ("The SECPay system has detected a fraud condition and rejected the transaction. The message field will contain more details."),
amountInvalid ("Pre-bank checks. Amount not supplied or invalid"),
insufficientParams ("Pre-bank checks. Not all mandatory parameters supplied"),
paymentRepresented ("Pre-bank checks. Same payment presented twice"),
startInvalid ("Pre-bank checks. Start date invalid"),
expireInvalid ("Pre-bank checks. Expiry date invalid"),
issueInvalid ("Pre-bank checks. Issue number invalid"),
LUHNFailed ("Pre-bank checks. Card number fails LUHN check"),
cardTypeInvalid ("Pre-bank checks. Card type invalid - i.e. does not match card number prefix"),
nameInvalid ("Pre-bank checks. Customer name not supplied"),
merchantInvalid ("Pre-bank checks. Merchant does not exist or not registered yet"),
merchantAccountCardTypeInvalid ("Pre-bank checks. Merchant account for card type does not exist"),
merchardAccountCurrencyTypeInvalid ("Pre-bank checks. Merchant account for this currency does not exist"),
CVV2Invalid ("Pre-bank checks. CVV2 security code mandatory and not supplied / invalid"),
timeOut ("Pre-bank checks. Transaction timed out awaiting a virtual circuit. Merchant may not have enough virtual circuits for the volume of business."),
noMD5 ("Pre-bank checks. No MD5 hash / token key set up against account");
private final String description; // constructor
SecpayErrorType(String description) {
this.description = description;
}
public String getDescription(){
Runnable r = new Runnable() {
public void run(){
}
};
Runnable s = new MyRunnable();
return description;
}
private class MyRunnable implements Runnable {
public void run(){
}
}
}
for (OrderTransaction orderTransaction : secPayResultList) {
for(Payment payment : orderTransaction.getPayments()){
if(PaymentMethodType.CARD.equals(payment.getMemberPaymentMethod().getPaymentMethod().getType())){
//do a transaction in here
ValidateTransactionResult validateTransactionResult = doSecPayTransaction(payment.getReference());
if (validateTransactionResult.getValid() != true) { FacesMessages.instance().add("TransactionResult: " + validateTransactionResult.getMessage()) ;
}
}
}
}
When tomcat generates something similar to the following log output chances are its missing the Windows C dll MSVCR71.dll - Tomcat needs this to initialise java when the service starts. Put a copy in your c:\windows\system32 directory or wherever you want as long as its in your system path
[2007-09-13 04:12:54] [info] Running Service...
[2007-09-13 04:12:54] [info] Starting service...
[2007-09-13 04:12:54] [173 javajni.c] [error] The specified module could not be found.
[2007-09-13 04:12:54] [924 prunsrv.c] [error] Failed creating java C:\Program Files\Java\jre1.6.0_02\bin\client\jvm.dll
[2007-09-13 04:12:54] [1179 prunsrv.c] [error] ServiceStart returned 1
[2007-09-13 04:12:54] [info] Run service finished.
[2007-09-13 04:12:54] [info] Procrun finished.
public static void copyFile(String sourceFile, String filePath, String destinationFile) {
try {
FileInputStream streamSource = new FileInputStream(sourceFile);
FileOutputStream streamDest = new FileOutputStream(filePath + destinationFile);
byte[] buffer = new byte[1024];
int i = 0;
while ((i = streamSource.read(buffer)) != -1) {
streamDest.write(buffer, 0, i);
}
streamSource.close();
streamDest.close();
} catch (IOException e) {
// LOG.debug("file(input|output)stream error: " + e);
}
replacing two chars using an or (pipes)
String p = "text to search.. through with = and , and ^
System.out.println("result: "+ p.replaceAll(",|=", "") );
if you want to strip all the tags out you can use:
System.out.println("p: "+ p.replaceAll("\\W", " ") );
note.. that will strip spaces too hence we are replacing with " "
to strip tags properly and remove what's between them use
System.out.println("p: "+ p.replaceAll("<[^>]+>", "") );