String fullBriefDescription = "ຈົວ昨夜, 最高コンサ";
System.out.println("fullBriefDescription Line 1094 "+fullBriefDescription);
System.out.println("fullBriefDescription Length Line 1095 "+fullBriefDescription.length());
I have created a java file and run through Weblogic 12c as a Part of the project, but when I run the project and print output why I am getting "????? ???" instead of the above characters??
Please Help
Related
I wanted to encrypt the password in the configuration of connections to the database. I was stuck at the stage of generating an encrypted password
I wrote the script bat, the content of which is:
java -cp c:\servers\wildfly-10.0.0.Final\modules\system\layers\base\org\jboss\logging\main\jboss-logging-3.3.0.Final.jar:c:\servers\wildfly-10.0.0.Final\modules\system\layers\base\org\picketbox\main\picketbox-4.9.4.Final.jar:c:\servers\wildfly-10.0.0.Final\modules\system\layers\base\org\picketbox\main\picketbox-commons-1.0.0.final.jar:c:\servers\wildfly-10.0.0.Final\modules\system\layers\base\org\picketbox\main\picketbox-infinispan-4.9.4.Final.jar org.picketbox.datasource.security.SecureIdentityLoginModule password
Unfortunately, when you start this script i getting error:
C:\>test.bat
C:\>java -cp c:\servers\wildfly-10.0.0.Final\modules\system\layer
s\base\org\jboss\logging\main\jboss-logging-3.3.0.Final.jar:c:\ADS\JPK\wildfly_1
0_jpk\wildfly-10.0.0.Final\modules\system\layers\base\org\picketbox\main\picketb
ox-4.9.4.Final.jar:c:\servers\wildfly-10.0.0.Final\modules\system
\layers\base\org\picketbox\main\picketbox-commons-1.0.0.final.jar:c:\ADS\JPK\wil
dfly_10_jpk\wildfly-10.0.0.Final\modules\system\layers\base\org\picketbox\main\p
icketbox-infinispan-4.9.4.Final.jar org.picketbox.datasource.security.SecureIden
tityLoginModule password
Error: Could not find or load main class org.picketbox.datasource.security.Secur
eIdentityLoginModule
C:\>
I decompiled class SecureIdentityLoginModule and I see that you are there main method ...
I used the server to Wildfly 10.0.0 Final
You're using the wrong path separator. On Windows it's a semicolon ;. You're using the UNIX/Linux path separator :.
It should be:
java -cp C:\servers\wildfly-10.0.0.Final\modules\system\layers\base\org\jboss\logging\main\jboss-logging-3.3.0.Final.jar;C:\servers\wildfly-10.0.0.Final\modules\system\layers\base\org\picketbox\main\picketbox-4.9.4.Final.jar;C:\servers\wildfly-10.0.0.Final\modules\system\layers\base\org\picketbox\main\picketbox-commons-1.0.0.final.jar;C:\servers\wildfly-10.0.0.Final\modules\system\layers\base\org\picketbox\main\picketbox-infinispan-4.9.4.Final.jar org.picketbox.datasource.security.SecureIdentityLoginModule password
OS: Windows7, Jython2.7.0FR ("Final Release")
Trying to use Gord Thompson's solution with Jython: Manipulating an Access database from Java without ODBC
I can get the Ucanaccess module to work in Eclipse, but not when I try running from the CLI.
# -*- coding: utf-8 -*-
import java, sys
jars_dir = 'D:\\sysadmin\\Resources\\Java jar files\\'
sys.path.append( jars_dir + 'commons-lang-2.6.jar' )
sys.path.append( jars_dir + 'commons-logging-1.2.jar' )
sys.path.append( jars_dir + 'hsqldb.jar' )
sys.path.append( jars_dir + 'jackcess-2.1.2.jar' )
sys.path.append( jars_dir + 'ucanaccess-3.0.2.jar' )
import net.ucanaccess.jdbc.UcanaccessDriver
import net.ucanaccess
print( '# appear to have imported UcanaccessDriver' )
conn = java.sql.DriverManager.getConnection( 'jdbc:ucanaccess://D:/TESTING.mdb' )
print( '# conn OK...')
This prints out "# conn OK" when I run this in Eclipse.
When I run it from the CLI it prints out "# appear to have imported..." but then an error is thrown:
(NB this output was copied to Eclipse: it is indeed a CLI run)
Anyone got any idea why I might be getting "No suitable driver..."? NB I tried various permutations with backward slashes instead of forward ones in getConnection... to no avail.
By the way, in case this is relevant, this is an extract from the .bat file I'm using to run the thing:
cd "%SOFTWARE_PROJECTS%\workspace\Jython scratchpad\src\jython_scratchpad_root"
REM this is probably irrelevant and doesn't seem to work with Jython2.7.0FR. The jars are being loaded by sys.path.append, obviously
set CLASSPATH=.;"%SYSADMIN%\resources\java jar files/*"
D:\apps\jython2.7.0\bin\jython loading_test.py
It appears that sys.path has more to do with the PATH environment variable than the CLASSPATH environment variable. The following two methods have been tested and do work with Jython 2.7.0 to run a script called "jyTest.py" from the Windows command line
Method 1: Set the CLASSPATH from a batch file (or shell script) before launching Jython
SET CLASSPATH=C:/Users/Public/Downloads/UCanAccess/ucanaccess-3.0.2.jar;C:/Users/Public/Downloads/UCanAccess/lib/commons-lang-2.6.jar;C:/Users/Public/Downloads/UCanAccess/lib/commons-logging-1.1.1.jar;C:/Users/Public/Downloads/UCanAccess/lib/hsqldb.jar;C:/Users/Public/Downloads/UCanAccess/lib/jackcess-2.1.2.jar;.
c:\jython2.7.0\bin\jython jyTest.py
(For Linux et. al. that would be export CLASSPATH ..., and colon separators instead of semicolons.)
Method 2: Use -J-cp to set the CLASSPATH when invoking Jython
c:\jython2.7.0\bin\jython -J-cp C:/Users/Public/Downloads/UCanAccess/ucanaccess-3.0.2.jar;C:/Users/Public/Downloads/UCanAccess/lib/commons-lang-2.6.jar;C:/Users/Public/Downloads/UCanAccess/lib/commons-logging-1.1.1.jar;C:/Users/Public/Downloads/UCanAccess/lib/hsqldb.jar;C:/Users/Public/Downloads/UCanAccess/lib/jackcess-2.1.2.jar;. jyTest.py
(Again, Linux and friends would need the -cp entries to be separated by colons instead of semicolons.)
I have this little chain of components in my Mule ESB project:
<set-payload value="Получена заявка ##[sessionVars['ticketID']]" doc:name="Set SMS Text"/>
<scripting:transformer doc:name="Send SMS" ignoreBadInput="true">
<scripting:script engine="Groovy"><![CDATA[
def command = ["/tmp/call.sh", message.payload]
def proc = command.execute()
proc.waitFor()
]]></scripting:script>
</scripting:transformer>
And /tmp/call.sh listing:
#!/bin/bash
echo $# > /tmp/call.out
When message passes Mule chain in /tmp/call.out I can see "Џолучена заЯвка #4041" instead of expected "Получена заявка #4041" ("Получена заявка" - Russian words), i.e. there is a problem with unicode chars output and there are no problems with ASCII chars.
When I check /tmp/groovy.out with HEX editor I see that all Russain chars has 1-byte lenght (in unicode that must be 2-bytes length), i.e. output of my Groovy component is not unicode.
There is no problem with unicode output to Mule log when I user Echo and Logger components. Also in SMTP component everything is perfect: I successfully receive letters in unicode from Mule.
Can you help me with unicode arguments in Mule ESB with Groovy command call?
Solved by selecting UTF-8 ecoding in Run configuration options (menu Run -> Run configurations...). By default it was MacCyrilic encoding.
I am working on an application that executes a Jython 2.5.3 script from JAVA 1.6.027. The script just open a file using codecs library and it looks like this:
try:
from codecs import open as codecs_open
except ImportError:
print 'ERROR', 'Could not import.'
CODECS_LIST = ['latin-1', 'utf-8', 'utf-16', '1250', '1252']
def open_file(filename, mode):
'''
DOC
'''
for encoding in CODECS_LIST:
try:
f = codecs_open(filename, mode, encoding)
f.read()
f.close()
print 'INFO', "File %s supports encoding %s." % (filename.split("\\")[-1], encoding)
...
except:
...
When I execute this script debugging in Eclipse, everything works OK, but when I execute the part of the JAVA application that invokes this script, I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.nio.ch.FileChannelImpl
at java.io.RandomAccessFile.getChannel(RandomAccessFile.java:253)
at org.python.core.io.FileIO.fromRandomAccessFile(FileIO.java:173)
at org.python.core.io.FileIO.<init>(FileIO.java:79)
at org.python.core.io.FileIO.<init>(FileIO.java:57)
at org.python.core.PyFile.<init>(PyFile.java:135)
at org.python.core.PyTraceback.getLine(PyTraceback.java:65)
at org.python.core.PyTraceback.tracebackInfo(PyTraceback.java:38)
at org.python.core.PyTraceback.dumpStack(PyTraceback.java:109)
at org.python.core.PyTraceback.dumpStack(PyTraceback.java:120)
at org.python.core.Py.displayException(Py.java:1080)
at org.python.core.PySystemState.excepthook(PySystemState.java:1242)
at org.python.core.PySystemStateFunctions.__call__(PySystemState.java:1421)
at org.python.core.Py.printException(Py.java:1053)
at org.python.core.Py.printException(Py.java:1012)
at org.python.util.jython.run(jython.java:264)
at org.python.util.jython.main(jython.java:129)
The JAVA application is able to execute others similar jython scripts. I have detected that the class sun.nio.ch.FileChannelImpl is in the library rt.jar, which is inside /bin/common/ folder and included in my classpath via jvm.cfg file:
...
#LIBRARY PATH
./bin/common;...
...
The same way I do it with other libraries that work fine.
I have been stacked with this problem for a few days, so any help will be appreciated.
Thank you
The problem has been resolved by reinstalling Java Runtime Environment, in my case version jre-6u45
This happened to me because the mysql package that I had installed was installed globally and required root privileges, so when running java, I had to include sudo to get it to work correctly.
My application generates some reports to it's clients. But there's an error when generating the reports here's the exception:-
java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer.<init>(Lorg/eclipse/jdt/internal/compiler/env/IBinaryType;)V
net.sf.jasperreports.engine.design.JRJdtCompiler$1.findType(JRJdtCompiler.java:235)
net.sf.jasperreports.engine.design.JRJdtCompiler$1.findType(JRJdtCompiler.java:204)
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:119)
org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getType(PackageBinding.java:126)
org.eclipse.jdt.internal.compiler.lookup.Scope.findType(Scope.java:1355)
org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2472)
org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2194)
org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:39)
org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:141)
org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveSuperType(TypeReference.java:104)
org.eclipse.jdt.internal.compiler.lookup.ClassScope.findSupertype(ClassScope.java:1107)
org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectSuperclass(ClassScope.java:767)
org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:947)
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:266)
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:195)
org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:301)
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:315)
net.sf.jasperreports.engine.design.JRJdtCompiler.compileClass(JRJdtCompiler.java:392)
net.sf.jasperreports.engine.design.JRJdtCompiler.compileReport(JRJdtCompiler.java:109)
net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:106)
net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:128)
net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:110)
Recently I moved this application to JBOSS 4.0.5.GA. This application was running fine and there's no errors in generating reports in Tomcat 5
Thanks.
I believe there is a conflicting JAR file:
jdt-compiler-3.1.1.jar
I created a script to set the CLASSPATH before Tomcat runs:
#!/bin/bash
IREPORT_HOME=$HOME/bin/ireport
CLASSPATH=$IREPORT_HOME/platform9/modules/org-netbeans-core.jar:
for j in \
$IREPORT_HOME/ireport/modules/ext/*.jar \
$IREPORT_HOME/ide10/modules/ext/*.jar; do
BASENAME=$(basename $j)
# Append file names to the CLASSPATH, except those with Tomcat conflicts.
if [ "$BASENAME" != "jdt-compiler-3.1.1.jar" ]; then
CLASSPATH=$j:$CLASSPATH
fi
done
export CLASSPATH=$CLASSPATH.
Save it as setenv.sh and place it in $CATALINA_HOME/bin. You will have to change the IREPORT_HOME variable accordingly.