Hibernate, Oracle, Play: Unable to build EntityManagerFactory error - oracle
I'm getting a really vague exception from Hibernate when trying to use it with Oracle.(it works normally with MySQL)
I have the following configuration:
Play Framework: 2.3.7
ojdbc14.jar
Hibernate: 4.3.8.Final
I'm using Oracle 10i
The application manages to connect, but fails when trying to build the Entity Manager.
I tried to build it manually, but I got the same error when using Play's annotation #play.db.jpa.Transactional
For example: Accessing via raw JDBC works normally.
My database settings in application.conf:
db.default.driver=oracle.jdbc.driver.OracleDriver
db.default.url="jdbc:oracle:thin:#IP:1521:SID"
db.default.user=USER_NAME
db.default.pass=ROOT
db.default.jndiName=DefaultDS
jpa.default=defaultPersistenceUnit
My Persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
</properties>
</persistence-unit>
</persistence>
Here's the exception:
play.api.UnexpectedException: Unexpected exception[PersistenceException: Unable to build entity manager factory]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:166) ~[play_2.11-2.3.7.jar:2.3.7]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:130) ~[play_2.11-2.3.7.jar:2.3.7]
at scala.Option.map(Option.scala:145) ~[scala-library-2.11.1.jar:na]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:130) ~[play_2.11-2.3.7.jar:2.3.7]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(App licationProvider.scala:128) ~[play_2.11-2.3.7.jar:2.3.7]
Caused by: javax.persistence.PersistenceException: Unable to build entity manager factory
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:83) ~[hibernate-entitymanager-4.3.8.Final.jar:4.3.8.Final]
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54) ~[hibernate-entitymanager-4.3.8.Final.jar:4.3.8.Final]
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55) ~[hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39) ~[hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
at play.db.jpa.JPAPlugin.onStart(JPAPlugin.java:38) ~[play-java-jpa_2.11-2.3.7.jar:2.3.7]
Caused by: java.lang.NullPointerException: null
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:244) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
/////////////////////////////////////////////
UPDATED:
The properties that hibernate receives are:
0 = {HashMap$Node#10729} "gopherProxySet" -> "false"
1 = {HashMap$Node#10730} "awt.toolkit" -> "sun.lwawt.macosx.LWCToolkit"
2 = {HashMap$Node#10731} "file.encoding.pkg" -> "sun.io"
3 = {HashMap$Node#10732} "java.specification.version" -> "1.8"
4 = {HashMap$Node#10733} "sun.cpu.isalist" ->
5 = {HashMap$Node#10734} "sun.jnu.encoding" -> "UTF-8"
6 = {HashMap$Node#10735} "hibernate.dialect" -> "org.hibernate.dialect.Oracle10gDialect"
7 = {HashMap$Node#10736} "java.class.path" -> "/Users/rodrigoarantes1/Library/Application Support/IntelliJIdea14/Scala/launcher/sbt-launch.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/idea_rt.jar"
8 = {HashMap$Node#10737} "java.naming.provider.url" -> "/"
9 = {HashMap$Node#10738} "sbt.global.base" -> "/private/var/folders/8l/k806t46d2fl5sq2rt6gzp7z00000gp/T/sbt-global-plugin1stub"
10 = {HashMap$Node#10739} "java.vm.vendor" -> "Oracle Corporation"
11 = {HashMap$Node#10740} "sun.arch.data.model" -> "64"
12 = {HashMap$Node#10741} "jline.shutdownhook" -> "false"
13 = {HashMap$Node#10742} "java.vendor.url" -> "http://java.oracle.com/"
15 = {HashMap$Node#10744} "javax.persistence.jdbc.user" -> "USERNAME"
16 = {HashMap$Node#10745} "hibernate.transaction.factory_class" -> "class org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory"
17 = {HashMap$Node#10746} "javax.persistence.jdbc.url" -> "jdbc:oracle:thin:#127.0.0.1:1521:XE"
18 = {HashMap$Node#10747} "jline.terminal" -> "none"
19 = {HashMap$Node#10748} "os.name" -> "Mac OS X"
20 = {HashMap$Node#10749} "java.vm.specification.version" -> "1.8"
21 = {HashMap$Node#10750} "sun.java.launcher" -> "SUN_STANDARD"
23 = {HashMap$Node#10752} "sun.boot.library.path" -> "/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib"
24 = {HashMap$Node#10753} "sun.java.command" -> "xsbt.boot.Boot run"
25 = {HashMap$Node#10754} "http.nonProxyHosts" -> "local|*.local|169.254/16|*.169.254/16"
26 = {HashMap$Node#10755} "sun.cpu.endian" -> "little"
27 = {HashMap$Node#10756} "user.home" -> "/Users/rodrigoarantes1"
28 = {HashMap$Node#10757} "user.language" -> "en"
29 = {HashMap$Node#10758} "java.specification.vendor" -> "Oracle Corporation"
30 = {HashMap$Node#10759} "java.home" -> "/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre"
31 = {HashMap$Node#10760} "file.separator" -> "/"
32 = {HashMap$Node#10761} "line.separator" -> "\n"
33 = {HashMap$Node#10762} "java.vm.specification.vendor" -> "Oracle Corporation"
34 = {HashMap$Node#10763} "java.specification.name" -> "Java Platform API Specification"
35 = {HashMap$Node#10764} "java.awt.graphicsenv" -> "sun.awt.CGraphicsEnvironment"
36 = {HashMap$Node#10765} "javax.persistence.jdbc.driver" -> "oracle.jdbc.driver.OracleDriver"
37 = {HashMap$Node#10766} "sun.boot.class.path" -> "/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/classes"
38 = {HashMap$Node#10767} "jline.esc.timeout" -> "0"
39 = {HashMap$Node#10768} "sun.management.compiler" -> "HotSpot 64-Bit Tiered Compilers"
40 = {HashMap$Node#10769} "ftp.nonProxyHosts" -> "local|*.local|169.254/16|*.169.254/16"
41 = {HashMap$Node#10770} "java.runtime.version" -> "1.8.0_45-b14"
42 = {HashMap$Node#10771} "java.naming.factory.initial" -> "tyrex.naming.MemoryContextFactory"
43 = {HashMap$Node#10772} "user.name" -> "rodrigoarantes1"
44 = {HashMap$Node#10773} "path.separator" -> ":"
45 = {HashMap$Node#10774} "os.version" -> "10.10.4"
46 = {HashMap$Node#10775} "java.endorsed.dirs" -> "/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/endorsed"
47 = {HashMap$Node#10776} "java.runtime.name" -> "Java(TM) SE Runtime Environment"
48 = {HashMap$Node#10777} "sbt.log.noformat" -> "true"
49 = {HashMap$Node#10778} "hibernate.ejb.persistenceUnitName" -> "oraclePersistenceUnit"
50 = {HashMap$Node#10779} "file.encoding" -> "UTF8"
51 = {HashMap$Node#10780} "sun.nio.ch.bugLevel" ->
52 = {HashMap$Node#10781} "java.vm.name" -> "Java HotSpot(TM) 64-Bit Server VM"
53 = {HashMap$Node#10782} "java.vendor.url.bug" -> "http://bugreport.sun.com/bugreport/"
54 = {HashMap$Node#10783} "java.io.tmpdir" -> "/var/folders/8l/k806t46d2fl5sq2rt6gzp7z00000gp/T/"
55 = {HashMap$Node#10784} "java.version" -> "1.8.0_45"
57 = {HashMap$Node#10786} "os.arch" -> "x86_64"
58 = {HashMap$Node#10787} "java.vm.specification.name" -> "Java Virtual Machine Specification"
59 = {HashMap$Node#10788} "java.awt.printerjob" -> "sun.lwawt.macosx.CPrinterJob"
60 = {HashMap$Node#10789} "sun.os.patch.level" -> "unknown"
61 = {HashMap$Node#10790} "java.library.path" -> ":/Library/Oracle/instantclient_11_2:/Users/rodrigoarantes1/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.:/Users/rodrigoarantes1/SourceTree-Repos/Project/target/native_libraries/64bits"
62 = {HashMap$Node#10791} "java.vendor" -> "Oracle Corporation"
63 = {HashMap$Node#10792} "java.vm.info" -> "mixed mode"
64 = {HashMap$Node#10793} "java.vm.version" -> "25.45-b02"
65 = {HashMap$Node#10794} "hibernate.bytecode.use_reflection_optimizer" -> "false"
66 = {HashMap$Node#10795} "hibernate.connection.datasource" -> "OracleDS"
67 = {HashMap$Node#10796} "sun.io.unicode.encoding" -> "UnicodeBig"
68 = {HashMap$Node#10797} "java.ext.dirs" -> "/Users/rodrigoarantes1/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java"
69 = {HashMap$Node#10798} "javax.persistence.jdbc.password" -> "ROOT"
70 = {HashMap$Node#10799} "java.class.version" -> "52.0"
71 = {HashMap$Node#10800} "socksNonProxyHosts" -> "local|*.local|169.254/16|*.169.254/16"
More Details:
The metadata generated by hibernate is:
connection = {OracleConnection#10996}
url = {String#10997} "jdbc:oracle:thin:#127.0.0.1:1521:XE"
user = {String#10998} "USER_NAME"
password = {String#10999} "ROOT"
database = {String#11000} "127.0.0.1:1521:XE"
auto_commit = true
protocol = {String#11001} "thin"
db_access = {TTC7Protocol#11002}
conversion = {TTCConversion#11003}
lob_dbaccess = null
XA_wants_error = false
UsingXA = false
m_txn_mode = 0
fdo = null
big_endian = null
statement_table = {Hashtable#11004} size = 0
closed = false
m_clientIdSet = false
m_clientId = null
default_batch = 1
default_row_prefetch = 10
report_remarks = false
include_synonyms = false
restrict_getTables = false
m_accumulateBatchResult = true
m_j2ee13Compliant = false
m_v8compatible = false
looseTimestampDateCheck = false
dataSizeScale = 1
noCachingBuffer = false
trans_level = 2
map = null
m_javaObjectMap = {Hashtable#11005} size = 0
descriptorCache = {Hashtable#11006} size = 0
statement_holding_line = null
m_dbMetaData = {OracleDatabaseMetaData#10994}
connection = {OracleConnection#10996}
url = {String#10997} "jdbc:oracle:thin:#127.0.0.1:1521:XE"
user = {String#10998} "USER_NAME"
password = {String#10999} "ROOT"
database = {String#11000} "127.0.0.1:1521:XE"
auto_commit = true
protocol = {String#11001} "thin"
db_access = {TTC7Protocol#11002}
conversion = {TTCConversion#11003}
lob_dbaccess = null
XA_wants_error = false
UsingXA = false
m_txn_mode = 0
fdo = null
big_endian = null
statement_table = {Hashtable#11004} size = 0
closed = false
m_clientIdSet = false
m_clientId = null
default_batch = 1
default_row_prefetch = 10
report_remarks = false
include_synonyms = false
restrict_getTables = false
m_accumulateBatchResult = true
m_j2ee13Compliant = false
m_v8compatible = false
looseTimestampDateCheck = false
dataSizeScale = 1
noCachingBuffer = false
trans_level = 2
map = null
m_javaObjectMap = {Hashtable#11005} size = 0
descriptorCache = {Hashtable#11006} size = 0
statement_holding_line = null
m_dbMetaData = {OracleDatabaseMetaData#10994}
connection = {OracleConnection#10996}
url = {String#10997} "jdbc:oracle:thin:#127.0.0.1:1521:XE"
user = {String#10998} "USER_NAME"
password = {String#10999} "ROOT"
database = {String#11000} "127.0.0.1:1521:XE"
auto_commit = true
protocol = {String#11001} "thin"
db_access = {TTC7Protocol#11002}
conversion = {TTCConversion#11003}
lob_dbaccess = null
XA_wants_error = false
UsingXA = false
m_txn_mode = 0
fdo = null
big_endian = null
statement_table = {Hashtable#11004} size = 0
closed = false
m_clientIdSet = false
m_clientId = null
default_batch = 1
default_row_prefetch = 10
report_remarks = false
include_synonyms = false
restrict_getTables = false
m_accumulateBatchResult = true
m_j2ee13Compliant = false
m_v8compatible = false
looseTimestampDateCheck = false
dataSizeScale = 1
noCachingBuffer = false
trans_level = 2
map = null
m_javaObjectMap = {Hashtable#11005} size = 0
descriptorCache = {Hashtable#11006} size = 0
statement_holding_line = null
m_dbMetaData = {OracleDatabaseMetaData#10994}
physicalStatus = true
logicalHandle = false
m_opc = null
m_opc_oc = null
m_osql = {OracleSql#11007}
m_warning = null
m_readOnly = false
m_startTime = 0
statementCache = null
m_stmtClearMetaData = false
m_process_escapes = true
m_defaultAutoRefetch = true
m_occ = null
m_privData = null
defaultFixedString = false
m_svptStmt = null
wrapper = null
connectionProperties = {Properties#11008} size = 3
timeout = null
m_clientData = null
m_sessionTimeZone = null
m_dbTzCalendar = null
procedureResultUnknown = 0
procedureNoResult = 1
procedureReturnsResult = 2
procedureColumnUnknown = 0
procedureColumnIn = 1
procedureColumnInOut = 2
procedureColumnOut = 4
procedureColumnReturn = 5
procedureColumnResult = 3
procedureNoNulls = 0
procedureNullable = 1
procedureNullableUnknown = 2
columnNoNulls = 0
columnNullable = 1
columnNullableUnknown = 2
versionColumnUnknown = 0
versionColumnNotPseudo = 1
versionColumnPseudo = 2
importedKeyCascade = 0
importedKeyRestrict = 1
importedKeySetNull = 2
typeNoNulls = 0
typeNullable = 1
typeNullableUnknown = 2
typePredNone = 0
typePredChar = 1
typePredBasic = 2
typeSearchable = 3
tableIndexStatistic = 0
tableIndexClustered = 1
tableIndexHashed = 2
tableIndexOther = 3
attributeNoNulls = 0
attributeNullable = 1
attributeNullableUnknown = 2
sqlStateXOpen = 1
sqlStateSQL99 = 2
physicalStatus = true
logicalHandle = false
m_opc = null
m_opc_oc = null
m_osql = {OracleSql#11007}
isV8Compatible = false
current_argument = 1
parameterCount = 0
i = 26
length = 26
c = 'E' 69
first = false
in_string = false
odbc_sql = {String#11009} "SET TRANSACTION READ WRITE"
oracle_sql = {StringBuffer#11010} "SET TRANSACTION READ WRITE"
token_buffer = {StringBuffer#11011} ""
isLocate = false
m_warning = null
m_readOnly = false
m_startTime = 0
statementCache = null
m_stmtClearMetaData = false
m_process_escapes = true
m_defaultAutoRefetch = true
m_occ = null
m_privData = null
defaultFixedString = false
m_svptStmt = null
wrapper = null
connectionProperties = {Properties#11008} size = 3
0 = {Hashtable$Entry#11018} "user" -> "USER_NAME"
1 = {Hashtable$Entry#11019} "dll" -> "ocijdbc9"
2 = {Hashtable$Entry#11020} "protocol" -> "thin"
timeout = null
m_clientData = null
m_sessionTimeZone = null
m_dbTzCalendar = null
procedureResultUnknown = 0
procedureNoResult = 1
procedureReturnsResult = 2
procedureColumnUnknown = 0
procedureColumnIn = 1
procedureColumnInOut = 2
procedureColumnOut = 4
procedureColumnReturn = 5
procedureColumnResult = 3
procedureNoNulls = 0
procedureNullable = 1
procedureNullableUnknown = 2
columnNoNulls = 0
columnNullable = 1
columnNullableUnknown = 2
versionColumnUnknown = 0
versionColumnNotPseudo = 1
versionColumnPseudo = 2
importedKeyCascade = 0
importedKeyRestrict = 1
importedKeySetNull = 2
typeNoNulls = 0
typeNullable = 1
typeNullableUnknown = 2
typePredNone = 0
typePredChar = 1
typePredBasic = 2
typeSearchable = 3
tableIndexStatistic = 0
tableIndexClustered = 1
tableIndexHashed = 2
tableIndexOther = 3
attributeNoNulls = 0
attributeNullable = 1
attributeNullableUnknown = 2
sqlStateXOpen = 1
sqlStateSQL99 = 2
physicalStatus = true
logicalHandle = false
m_opc = null
m_opc_oc = null
m_osql = {OracleSql#11007}
isV8Compatible = false
current_argument = 1
parameterCount = 0
i = 26
length = 26
c = 'E' 69
first = false
in_string = false
odbc_sql = {String#11009} "SET TRANSACTION READ WRITE"
oracle_sql = {StringBuffer#11010} "SET TRANSACTION READ WRITE"
token_buffer = {StringBuffer#11011} ""
isLocate = false
m_warning = null
m_readOnly = false
m_startTime = 0
statementCache = null
m_stmtClearMetaData = false
m_process_escapes = true
m_defaultAutoRefetch = true
m_occ = null
m_privData = null
defaultFixedString = false
m_svptStmt = null
wrapper = null
connectionProperties = {Properties#11008} size = 3
timeout = null
m_clientData = null
m_sessionTimeZone = null
m_dbTzCalendar = null
procedureResultUnknown = 0
procedureNoResult = 1
procedureReturnsResult = 2
procedureColumnUnknown = 0
procedureColumnIn = 1
procedureColumnInOut = 2
procedureColumnOut = 4
procedureColumnReturn = 5
procedureColumnResult = 3
procedureNoNulls = 0
procedureNullable = 1
procedureNullableUnknown = 2
columnNoNulls = 0
columnNullable = 1
columnNullableUnknown = 2
versionColumnUnknown = 0
versionColumnNotPseudo = 1
versionColumnPseudo = 2
importedKeyCascade = 0
importedKeyRestrict = 1
importedKeySetNull = 2
typeNoNulls = 0
typeNullable = 1
typeNullableUnknown = 2
typePredNone = 0
typePredChar = 1
typePredBasic = 2
typeSearchable = 3
tableIndexStatistic = 0
tableIndexClustered = 1
tableIndexHashed = 2
tableIndexOther = 3
attributeNoNulls = 0
attributeNullable = 1
attributeNullableUnknown = 2
sqlStateXOpen = 1
sqlStateSQL99 = 2
The Exception being thrown by Hibernate:
File: JdbcServicesImpl.java
Method: meta.supportsNamedParameters();
SQLState = null
vendorCode = 17023
next = null
detailMessage = {String#13599} "Unsupported feature"
cause = {SQLException#13595} "java.sql.SQLException: Unsupported feature"
stackTrace = {StackTraceElement[0]#13600}
suppressedExceptions = {Collections$UnmodifiableRandomAccessList#13601} size = 0
Could someone help me figuring out what the problem might be and how to solve it?
Any help is really appreciated.
Thank you
Since I havent used play, my answer is not a copy and paste but it will show you the way how to do it.
It seems that you are missing a lot of properties in your persistence unit. You are not providing required fields such as username, password, url schema etc. Please have a look at:
https://docs.jboss.org/hibernate/entitymanager/3.5/reference/en/html/configuration.html
An example for hsqldb is from the docs above:
<persistence>
<persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL">
<class>org.hibernate.ejb.test.Cat</class>
<class>org.hibernate.ejb.test.Distributor</class>
<class>org.hibernate.ejb.test.Item</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.password" value=""/>
<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:."/>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/
<property name="hibernate.max_fetch_depth" value="3"/>
<!-- cache configuration -->
<property name="hibernate.ejb.classcache.org.hibernate.ejb.test.Item" value="read-write"/>
<property name="hibernate.ejb.collectioncache.org.hibernate.ejb.test.Item.distributors" value="read-write, RegionName"/>
<!-- alternatively to <class> and <property> declarations, you can use a regular hibernate.cfg.xml file -->
<!-- property name="hibernate.ejb.cfgfile" value="/org/hibernate/ejb/test/hibernate.cfg.xml"/ -->
</properties>
</persistence-unit>
</persistence>
The issue was related to the Oracle driver.
My original configuration works fine with the driver ojdbc7.jar
So my play/jpa configuration remained as:
application.conf
db.default.driver=oracle.jdbc.driver.OracleDriver
db.default.url="jdbc:oracle:thin:#IP:1521:SID"
db.default.user=USER_NAME
db.default.pass=ROOT
db.default.jndiName=DefaultDS
jpa.default=defaultPersistenceUnit
persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
</properties>
</persistence-unit>
</persistence>
I hope it helps someone
EDITED:
I also tried with ojdbc14.jar because I needed to connect o an oracle 8i server.
You only need to add the following property to your persistence.xml
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
Thanks
Related
Error with the message "Cannot cast (inet::physicallayer::Ieee80211DimensionalTransmission*) to type 'const inet::physicallayer::IScalarSignal *'"
I use Omnet++ and Inet 4.4, I want to simulate a scenario to investigate the effect of interference, which is as follows: In a network consisting of two pairs of nodes including a node called source and a node called destination, in which node source sends packets to node destination and is tuned in channel 2 of Ieee802.11b/g, let's examine the second pair consisting of node Node1 and node Node2, which node Node1 sends packets to node Node 4 and is tuned in channel 4. But recently a problem appear very often and the simulations are stopped, the error is this: check_and_cast(): Cannot cast (inet::physicallayer::Ieee80211DimensionalTransmission*) to type 'const inet::physicallayer::IScalarSignal *' -- in module (inet::physicallayer::Ieee80211Radio) AnalogModelShowcaseDistanceNetworkRM.source.wlan[1].radio (id=200), at t=0.001s, event #24 My omnetpp.ini is as: [Config Distance] network = AnalogModelShowcaseDistanceNetworkRM sim-time-limit = 5s # Maryam **.radio.packetErrorRate.result-recording-modes = +vector # Maryam **.radio.bitErrorRate.result-recording-modes = +vector # application parameters *.source.numApps = 1 *.source.app[0].typename = "UdpBasicApp" *.source.app[*].destAddresses = "destination" *.source.app[*].destPort = 1000 *.source.app[*].messageLength = 1000byte *.source.app[*].sendInterval = 1ms *.destination.numApps = 1 *.destination.app[0].typename = "UdpSink" *.destination.app[*].localPort = 1000 *.Node1.numApps = 1 *.Node1.app[0].typename = "UdpBasicApp" *.Node1.app[*].destAddresses = "Node2" *.Node1.app[*].destPort = 1001 *.Node1.app[*].messageLength = 1000byte *.Node1.app[*].sendInterval = 1ms *.Node2.numApps = 1 *.Node2.app[0].typename = "UdpSink" *.Node2.app[*].localPort = 1001 *.source.numWlanInterfaces = 2 *.destination.numWlanInterfaces = 2 *.Node1.numWlanInterfaces = 2 *.Node2.numWlanInterfaces = 2 *.source.wlan[*].radio.typename = "Ieee80211DimensionalRadio" *.destination.wlan[*].radio.typename = "Ieee80211DimensionalRadio" *.Node*.wlan[*].radio.typename = "Ieee80211DimensionalRadio" *.source.wlan[*].radio.centerFrequency = 2.412GHz *.source.wlan[*].radio.bandwidth = 2MHz *.source.wlan[*].radio.transmitter.power = 2mW *.source.wlan[*].radio.transmitter.bitrate = 2Mbps *.source.wlan[*].radio.transmitter.preambleDuration = 0s *.source.wlan[*].radio.transmitter.headerLength = 96b *.source.wlan[*].radio.transmitter.modulation = "BPSK" *.source.wlan[*].radio.receiver.sensitivity = -85dBm *.source.wlan[*].radio.receiver.energyDetection = -85dBm *.source.wlan[*].radio.receiver.snirThreshold = 4dB *.destination.wlan[*].radio.centerFrequency = 2.412GHz *.destination.wlan[*].radio.bandwidth = 2MHz *.destination.wlan[*].radio.transmitter.power = 2mW *.destination.wlan[*].radio.transmitter.bitrate = 2Mbps *.destination.wlan[*].radio.transmitter.preambleDuration = 0s *.destination.wlan[*].radio.transmitter.headerLength = 96b *.destination.wlan[*].radio.transmitter.modulation = "BPSK" *.destination.wlan[*].radio.receiver.sensitivity = -85dBm *.destination.wlan[*].radio.receiver.energyDetection = -85dBm *.destination.wlan[*].radio.receiver.snirThreshold = 4dB *.Node*.wlan[*].radio.centerFrequency = 2.412GHz *.Node*.wlan[*].radio.bandwidth = 2MHz *.Node*.wlan[*].radio.transmitter.power = 2mW *.Node*.wlan[*].radio.transmitter.bitrate = 2Mbps *.Node*.wlan[*].radio.transmitter.preambleDuration = 0s *.Node*.wlan[*].radio.transmitter.headerLength = 96b *.Node*.wlan[*].radio.transmitter.modulation = "BPSK" *.Node*.wlan[*].radio.receiver.sensitivity = -85dBm *.Node*.wlan[*].radio.receiver.energyDetection = -85dBm *.Node*.wlan[*].radio.receiver.snirThreshold = 4dB *.source.wlan[0].radio.channelNumber = 2 *.destination.wlan[0].radio.channelNumber = 2 *.Node1.wlan[0].radio.channelNumber = 4 *.Node2.wlan[0].radio.channelNumber = 4 # mobility parameters *.destination.mobility.typename = "LinearMobility" *.destination.mobility.initialMovementHeading = 0deg *.destination.mobility.speed = 200mps *.destination.mobility.constraintAreaMinX = 500m *.destination.mobility.constraintAreaMaxX = 1200m # wlan *.source.**.transmitter.power = 12mW *.source.**.displayCommunicationRange = true **.backgroundNoise.power = -105dBm **.wlan*.mac.*.rateSelection.dataFrameBitrate = 54Mbps **.wlan*.mac.dcf.channelAccess.pendingQueue.packetCapacity = 14 # visualizer parameters *.visualizer.*.numStatisticVisualizers = 2 *.visualizer.*.statisticVisualizer[0].signalName = "packetSentToUpper" *.visualizer.*.statisticVisualizer[0].statisticExpression = "packetErrorRate" *.visualizer.*.statisticVisualizer[0].sourceFilter = "*.destination.wlan[*].radio" *.visualizer.*.statisticVisualizer[0].format = "packetErrorRate(Maryam): %v" *.visualizer.*.statisticVisualizer[1].signalName = "packetSentToUpper" *.visualizer.*.statisticVisualizer[1].statisticExpression = "minimumSnir" *.visualizer.*.statisticVisualizer[1].sourceFilter = "*.destination.wlan[*].radio" *.visualizer.*.statisticVisualizer[1].format = "SNIR(Maryam): %v" *.visualizer.*.statisticVisualizer[1].placementHint = "topLeft" *.visualizer.*.dataLinkVisualizer[0].displayLinks = true *.visualizer.*.packetDropVisualizer[0].displayPacketDrops = true *.visualizer.*.packetDropVisualizer[0].nodeFilter = "destination" *.visualizer.*.packetDropVisualizer[0].labelFormat = "(Maryam) %r" *.visualizer.*.infoVisualizer[0].displayInfos = true *.visualizer.*.infoVisualizer[0].modules = "*.destination.app[0]" How do I solve this?
You need to set the radioMedium type to dimensional as well radioMedium: Ieee80211DimensionalRadioMedium { parameters: #display("p=62.247997,287.14398"); } In the NED file.
mysql_query_rules defined in proxysql.cnf but not loaded
My proxysql.cnf contains: # ... mysql_query_rules: ( { active = 1 match_digest = "^SHOW.*" destination_hostgroup = 3 apply = 0 }, { active = 1 match_digest = "^SELECT.*" destination_hostgroup = 3 apply = 0 }, { active = 1 match_digest = "^SELECT.* FOR UPDATE" destination_hostgroup = 2 apply = 1 }, ) # ... But when proxysql starts, the mysql_query_rules defintion is not loaded. select * from mysql_query_rules; Empty set (0.001 sec) How to make proxysql loads the mysql_query_rules definition from the proxysql.cnf file at startup?
The rule_id field is mandatory. { rule_id=1 active = 1 match_digest = "^SHOW.*" destination_hostgroup = 3 apply = 0 },
tensorflow: After adding a rnn the whole work doesn't work
I have downloaded a code of FCN for image segmentation and it ran well. Now I want to add a rnn layer attempting to refine the result according to the work "ReSeg: A Recurrent Neural Network-Based Model for Semantic Segmentation". My code shows as follows: This part is for the inference: def inference(image, keep_prob): """ Semantic segmentation network definition :param image: input image. Should have values in range 0-255 :param keep_prob: :return: """ print("setting up vgg initialized conv layers ...") #model_data = utils.get_model_data(FLAGS.model_dir, MODEL_URL) model_data = scipy.io.loadmat("H:/Deep Learning/FCN.tensorflow-master/imagenet-vgg-verydeep-19.mat") mean = model_data['normalization'][0][0][0] mean_pixel = np.mean(mean, axis=(0, 1)) weights = np.squeeze(model_data['layers']) processed_image = utils.process_image(image, mean_pixel) with tf.variable_scope("inference"): image_net = vgg_net(weights, processed_image) conv_final_layer = image_net["conv5_3"] pool5 = utils.max_pool_2x2(conv_final_layer) W6 = utils.weight_variable([7, 7, 512, 4096], name="W6") b6 = utils.bias_variable([4096], name="b6") conv6 = utils.conv2d_basic(pool5, W6, b6) relu6 = tf.nn.relu(conv6, name="relu6") if FLAGS.debug: utils.add_activation_summary(relu6) relu_dropout6 = tf.nn.dropout(relu6, keep_prob=keep_prob) W7 = utils.weight_variable([1, 1, 4096, 4096], name="W7") b7 = utils.bias_variable([4096], name="b7") conv7 = utils.conv2d_basic(relu_dropout6, W7, b7) relu7 = tf.nn.relu(conv7, name="relu7") if FLAGS.debug: utils.add_activation_summary(relu7) relu_dropout7 = tf.nn.dropout(relu7, keep_prob=keep_prob) W8 = utils.weight_variable([1, 1, 4096, NUM_OF_CLASSESS], name="W8") b8 = utils.bias_variable([NUM_OF_CLASSESS], name="b8") conv8 = utils.conv2d_basic(relu_dropout7, W8, b8) # annotation_pred1 = tf.argmax(conv8, dimension=3, name="prediction1") # now to upscale to actual image size deconv_shape1 = image_net["pool4"].get_shape() W_t1 = utils.weight_variable([4, 4, deconv_shape1[3].value, NUM_OF_CLASSESS], name="W_t1") b_t1 = utils.bias_variable([deconv_shape1[3].value], name="b_t1") conv_t1 = utils.conv2d_transpose_strided(conv8, W_t1, b_t1, output_shape=tf.shape(image_net["pool4"])) #fuse_1 = tf.add(conv_t1, image_net["pool4"], name="fuse_1") deconv_shape2 = image_net["pool3"].get_shape() W_t2 = utils.weight_variable([4, 4, deconv_shape2[3].value, deconv_shape1[3].value], name="W_t2") b_t2 = utils.bias_variable([deconv_shape2[3].value], name="b_t2") conv_t2 = utils.conv2d_transpose_strided(conv_t1, W_t2, b_t2, output_shape=tf.shape(image_net["pool3"])) #fuse_2 = tf.add(conv_t2, image_net["pool3"], name="fuse_2") shape = tf.shape(image) deconv_shape3 = tf.stack([shape[0], shape[1], shape[2], NUM_OF_CLASSESS]) W_t3 = utils.weight_variable([16, 16, NUM_OF_CLASSESS, deconv_shape2[3].value], name="W_t3") b_t3 = utils.bias_variable([NUM_OF_CLASSESS], name="b_t3") conv_t3 = utils.conv2d_transpose_strided(conv_t2, W_t3, b_t3, output_shape=deconv_shape3, stride=8) /////////////////////////////////////////////////////this is from where i added the rnn shape_5 = tf.shape(image) W_a = 224 H_a = 224 p_size_a = NUM_OF_CLASSESS # x = tf.reshape(conv_t1, [shape_5[0],H_a,W_a, p_size_a]) x = tf.transpose(conv_t3, perm=[0,2,1,3]) x = tf.reshape(x,[-1,H_a,p_size_a]) mat = tf.unstack(x, H_a, 1) lstm_fw_cell = rnn.BasicLSTMCell(N_HIDDEN, forget_bias=1.0) lstm_bw_cell = rnn.BasicLSTMCell(N_HIDDEN, forget_bias=1.0) #with tf.variable_scope('rnn1_1'): try: outputs, _, _ = rnn.static_bidirectional_rnn(lstm_fw_cell, lstm_bw_cell, mat, dtype=tf.float32,scope='rnn1_1') except Exception: # Old TensorFlow version only returns outputs not states outputs = rnn.static_bidirectional_rnn(lstm_fw_cell, lstm_bw_cell, mat, dtype=tf.float32) outputs1 = tf.reshape(outputs,[H_a, shape_5[0], W_a, 2 * N_HIDDEN]) outputs1 = tf.transpose(outputs1,(1,0,2,3)) x_1 = tf.reshape(outputs1,[-1,W_a,2 * N_HIDDEN]) mat_1 = tf.unstack(x_1, W_a, 1) lstm_lw_cell = rnn.BasicLSTMCell(N_HIDDEN, forget_bias=1.0) lstm_rw_cell = rnn.BasicLSTMCell(N_HIDDEN, forget_bias=1.0) #with tf.variable_scope('rnn1_2'): try: outputs2, _, _ = rnn.static_bidirectional_rnn(lstm_lw_cell, lstm_rw_cell, mat_1, dtype=tf.float32,scope = 'rnn1_2') except Exception: # Old TensorFlow version only returns outputs not states outputs2 = rnn.static_bidirectional_rnn(lstm_lw_cell, lstm_rw_cell, mat_1, dtype=tf.float32) outputs2 = tf.reshape(outputs,[W_a, shape_5[0], H_a, 2 * N_HIDDEN]) outputs2 = tf.transpose(outputs2,(1,2,0,3)) ///////////////////////////////////////////////////till here annotation_pred = tf.argmax(outputs2, dimension=3, name="prediction") return tf.expand_dims(annotation_pred, dim=3), outputs2 and this part is for the training: def train(loss_val, var_list): optimizer = tf.train.AdamOptimizer(FLAGS.learning_rate) grads = optimizer.compute_gradients(loss_val, var_list=var_list) if FLAGS.debug: # print(len(var_list)) for grad, var in grads: utils.add_gradient_summary(grad, var) return optimizer.apply_gradients(grads) def main(argv=None): keep_probability = tf.placeholder(tf.float32, name="keep_probabilty") image = tf.placeholder(tf.float32, shape=[None, IMAGE_SIZE, IMAGE_SIZE, 3], name="input_image") annotation = tf.placeholder(tf.int32, shape=[None, IMAGE_SIZE, IMAGE_SIZE, 1], name="annotation") pred_annotation, logits = inference(image, keep_probability) tf.summary.image("input_image", image, max_outputs=2) tf.summary.image("ground_truth", tf.cast(annotation, tf.uint8), max_outputs=2) tf.summary.image("pred_annotation", tf.cast(pred_annotation, tf.uint8), max_outputs=2) loss = tf.reduce_mean((tf.nn.sparse_softmax_cross_entropy_with_logits(logits=logits, labels=tf.squeeze(annotation, squeeze_dims=[3]), name="entropy"))) tf.summary.scalar("entropy", loss) trainable_var = tf.trainable_variables() if FLAGS.debug: for var in trainable_var: utils.add_to_regularization_and_summary(var) train_op = train(loss, trainable_var) print("Setting up summary op...") summary_op = tf.summary.merge_all() print("Setting up image reader...") train_records, valid_records = scene_parsing.read_dataset(FLAGS.data_dir) print(len(train_records)) print(len(valid_records)) print("Setting up dataset reader") image_options = {'resize': True, 'resize_size': IMAGE_SIZE} if FLAGS.mode == 'train': train_dataset_reader = dataset.BatchDatset(train_records, image_options) validation_dataset_reader = dataset.BatchDatset(valid_records, image_options) sess = tf.Session() print("Setting up Saver...") saver = tf.train.Saver() summary_writer = tf.summary.FileWriter(FLAGS.logs_dir, sess.graph) sess.run(tf.global_variables_initializer()) ckpt = tf.train.get_checkpoint_state(FLAGS.logs_dir) if ckpt and ckpt.model_checkpoint_path: saver.restore(sess, ckpt.model_checkpoint_path) print("Model restored...") if FLAGS.mode == "train": for itr in xrange(MAX_ITERATION): train_images, train_annotations = train_dataset_reader.next_batch(FLAGS.batch_size) feed_dict = {image: train_images, annotation: train_annotations, keep_probability: 0.85} sess.run(train_op, feed_dict=feed_dict) if itr % 10 == 0: train_loss, summary_str = sess.run([loss, summary_op], feed_dict=feed_dict) print("Step: %d, Train_loss:%g" % (itr, train_loss)) summary_writer.add_summary(summary_str, itr) if itr % 500 == 0: valid_images, valid_annotations = validation_dataset_reader.next_batch(FLAGS.batch_size) valid_loss = sess.run(loss, feed_dict={image: valid_images, annotation: valid_annotations, keep_probability: 1.0}) print("%s ---> Validation_loss: %g" % (datetime.datetime.now(), valid_loss)) saver.save(sess, FLAGS.logs_dir + "model.ckpt", itr) elif FLAGS.mode == "visualize": valid_images, valid_annotations = validation_dataset_reader.get_random_batch(FLAGS.batch_size) pred = sess.run(pred_annotation, feed_dict={image: valid_images, annotation: valid_annotations, keep_probability: 1.0}) valid_annotations = np.squeeze(valid_annotations, axis=3) pred = np.squeeze(pred, axis=3) for itr in range(FLAGS.batch_size): utils.save_image(valid_images[itr].astype(np.uint8), FLAGS.logs_dir, name="inp_" + str(5+itr)) utils.save_image(valid_annotations[itr].astype(np.uint8), FLAGS.logs_dir, name="gt_" + str(5+itr)) utils.save_image(pred[itr].astype(np.uint8), FLAGS.logs_dir, name="pred_" + str(5+itr)) print("Saved image: %d" % itr) The error was described as: Not found: Key inference/rnn1_2/fw/basic_lstm_cell/weights not found in checkpoint So i think there must be something wrong with the variables. I'll be very appreciate if someone could tell me how to fix it! looking forward to your help!
converting UTF-8 string to ASCII in pure LUA
I have a question about sending and receiving data with special chars. (German Umlauts) When I send the string "Café Zeezicht" with the code below, then on the server-side the string is oke. But how can I receive and decode the receiving data that containing the same chars? Now it look likes "Caf? Zeezicht" I am searching for a pure LUA function, because I have no ability to load libraries. ------------------------------------------------------------ -- Function voor converting ASCII naar UTF8 ------------------------------------------------------------ -- return char as utf8 string local function CodeToUTF8 (Unicode) if (Unicode == nil) then return "" end if (Unicode < 0x20) then return ' '; end; if (Unicode <= 0x7F) then return string.char(Unicode); end; if (Unicode <= 0x7FF) then local Byte0 = 0xC0 + math.floor(Unicode / 0x40); local Byte1 = 0x80 + (Unicode % 0x40); return string.char(Byte0, Byte1); end; if (Unicode <= 0xFFFF) then local Byte0 = 0xE0 + math.floor(Unicode / 0x1000); local Byte1 = 0x80 + (math.floor(Unicode / 0x40) % 0x40); local Byte2 = 0x80 + (Unicode % 0x40); return string.char(Byte0, Byte1, Byte2); end; return ""; -- ignore UTF-32 for the moment end; -- convert ascii string to utf8 string function AsciiToUTF8(str) result = "" for i = 1, #str do result = result .. CodeToUTF8(string.byte(str, i, i+1)) end return result end ------------------------------------------------------------ -- Einde Function voor converting ASCII naar UTF8 ------------------------------------------------------------
local char, byte, pairs, floor = string.char, string.byte, pairs, math.floor local table_insert, table_concat = table.insert, table.concat local unpack = table.unpack or unpack local function unicode_to_utf8(code) -- converts numeric UTF code (U+code) to UTF-8 string local t, h = {}, 128 while code >= h do t[#t+1] = 128 + code%64 code = floor(code/64) h = h > 32 and 32 or h/2 end t[#t+1] = 256 - 2*h + code return char(unpack(t)):reverse() end local function utf8_to_unicode(utf8str, pos) -- pos = starting byte position inside input string (default 1) pos = pos or 1 local code, size = utf8str:byte(pos), 1 if code >= 0xC0 and code < 0xFE then local mask = 64 code = code - 128 repeat local next_byte = utf8str:byte(pos + size) or 0 if next_byte >= 0x80 and next_byte < 0xC0 then code, size = (code - mask - 2) * 64 + next_byte, size + 1 else code, size = utf8str:byte(pos), 1 end mask = mask * 32 until code < mask end -- returns code, number of bytes in this utf8 char return code, size end local map_1252_to_unicode = { [0x80] = 0x20AC, [0x81] = 0x81, [0x82] = 0x201A, [0x83] = 0x0192, [0x84] = 0x201E, [0x85] = 0x2026, [0x86] = 0x2020, [0x87] = 0x2021, [0x88] = 0x02C6, [0x89] = 0x2030, [0x8A] = 0x0160, [0x8B] = 0x2039, [0x8C] = 0x0152, [0x8D] = 0x8D, [0x8E] = 0x017D, [0x8F] = 0x8F, [0x90] = 0x90, [0x91] = 0x2018, [0x92] = 0x2019, [0x93] = 0x201C, [0x94] = 0x201D, [0x95] = 0x2022, [0x96] = 0x2013, [0x97] = 0x2014, [0x98] = 0x02DC, [0x99] = 0x2122, [0x9A] = 0x0161, [0x9B] = 0x203A, [0x9C] = 0x0153, [0x9D] = 0x9D, [0x9E] = 0x017E, [0x9F] = 0x0178, [0xA0] = 0x00A0, [0xA1] = 0x00A1, [0xA2] = 0x00A2, [0xA3] = 0x00A3, [0xA4] = 0x00A4, [0xA5] = 0x00A5, [0xA6] = 0x00A6, [0xA7] = 0x00A7, [0xA8] = 0x00A8, [0xA9] = 0x00A9, [0xAA] = 0x00AA, [0xAB] = 0x00AB, [0xAC] = 0x00AC, [0xAD] = 0x00AD, [0xAE] = 0x00AE, [0xAF] = 0x00AF, [0xB0] = 0x00B0, [0xB1] = 0x00B1, [0xB2] = 0x00B2, [0xB3] = 0x00B3, [0xB4] = 0x00B4, [0xB5] = 0x00B5, [0xB6] = 0x00B6, [0xB7] = 0x00B7, [0xB8] = 0x00B8, [0xB9] = 0x00B9, [0xBA] = 0x00BA, [0xBB] = 0x00BB, [0xBC] = 0x00BC, [0xBD] = 0x00BD, [0xBE] = 0x00BE, [0xBF] = 0x00BF, [0xC0] = 0x00C0, [0xC1] = 0x00C1, [0xC2] = 0x00C2, [0xC3] = 0x00C3, [0xC4] = 0x00C4, [0xC5] = 0x00C5, [0xC6] = 0x00C6, [0xC7] = 0x00C7, [0xC8] = 0x00C8, [0xC9] = 0x00C9, [0xCA] = 0x00CA, [0xCB] = 0x00CB, [0xCC] = 0x00CC, [0xCD] = 0x00CD, [0xCE] = 0x00CE, [0xCF] = 0x00CF, [0xD0] = 0x00D0, [0xD1] = 0x00D1, [0xD2] = 0x00D2, [0xD3] = 0x00D3, [0xD4] = 0x00D4, [0xD5] = 0x00D5, [0xD6] = 0x00D6, [0xD7] = 0x00D7, [0xD8] = 0x00D8, [0xD9] = 0x00D9, [0xDA] = 0x00DA, [0xDB] = 0x00DB, [0xDC] = 0x00DC, [0xDD] = 0x00DD, [0xDE] = 0x00DE, [0xDF] = 0x00DF, [0xE0] = 0x00E0, [0xE1] = 0x00E1, [0xE2] = 0x00E2, [0xE3] = 0x00E3, [0xE4] = 0x00E4, [0xE5] = 0x00E5, [0xE6] = 0x00E6, [0xE7] = 0x00E7, [0xE8] = 0x00E8, [0xE9] = 0x00E9, [0xEA] = 0x00EA, [0xEB] = 0x00EB, [0xEC] = 0x00EC, [0xED] = 0x00ED, [0xEE] = 0x00EE, [0xEF] = 0x00EF, [0xF0] = 0x00F0, [0xF1] = 0x00F1, [0xF2] = 0x00F2, [0xF3] = 0x00F3, [0xF4] = 0x00F4, [0xF5] = 0x00F5, [0xF6] = 0x00F6, [0xF7] = 0x00F7, [0xF8] = 0x00F8, [0xF9] = 0x00F9, [0xFA] = 0x00FA, [0xFB] = 0x00FB, [0xFC] = 0x00FC, [0xFD] = 0x00FD, [0xFE] = 0x00FE, [0xFF] = 0x00FF, } local map_unicode_to_1252 = {} for code1252, code in pairs(map_1252_to_unicode) do map_unicode_to_1252[code] = code1252 end function string.fromutf8(utf8str) local pos, result_1252 = 1, {} while pos <= #utf8str do local code, size = utf8_to_unicode(utf8str, pos) pos = pos + size code = code < 128 and code or map_unicode_to_1252[code] or ('?'):byte() table_insert(result_1252, char(code)) end return table_concat(result_1252) end function string.toutf8(str1252) local result_utf8 = {} for pos = 1, #str1252 do local code = str1252:byte(pos) table_insert(result_utf8, unicode_to_utf8(map_1252_to_unicode[code] or code)) end return table_concat(result_utf8) end Usage: local str1252 = "1\128" -- "one euro" in latin-1 local str_utf8 = str1252:toutf8() -- "1\226\130\172" -- one euro in utf-8 local str1252_2 = str_utf8:fromutf8()
Need help trying to get gateway running ( mx.rpc.events::FaultEvent #0 )
I followed the setup for http://www.zamfbrowser.org/documentation.html When I access http://www.zamfbrowser.org/zamf_demo/gateway.php When I access the http://localhost/gateway.php I get this error message which There was an error loading the server's info. Error: (mx.rpc.events::FaultEvent)#0 bubbles = false cancelable = true currentTarget = (mx.rpc.remoting.mxml::RemoteObject)#1 channelSet = (mx.messaging::ChannelSet)#2 authenticated = false channelIds = (Array)#3 [0] (null) channels = (Array)#4 [0] (mx.messaging.channels::AMFChannel)#5 authenticated = false channelSets = (Array)#6 connected = false connectTimeout = -1 enableSmallMessages = true endpoint = "http://localhot/gateway.php" failoverURIs = (Array)#7 id = (null) mpiEnabled = false netConnection = (flash.net::NetConnection)#8 client = (mx.messaging.channels::AMFChannel)#5 connected = false maxPeerConnections = 8 objectEncoding = 3 proxyType = "none" uri = (null) piggybackingEnabled = false polling = false pollingEnabled = true pollingInterval = 3000 protocol = "http" reconnecting = false recordMessageSizes = false recordMessageTimes = false requestTimeout = -1 uri = "http://localhot/gateway.php" url = "http://localhot/gateway.php" useSmallMessages = false clustered = false connected = false currentChannel = (mx.messaging.channels::AMFChannel)#5 heartbeatInterval = 0 initialDestinationId = (null) messageAgents = (Array)#9 [0] (mx.rpc::AsyncRequest)#10 authenticated = false autoConnect = true channelSet = (mx.messaging::ChannelSet)#2 clientId = (null) connected = false defaultHeaders = (null) destination = "AMF" id = "1D3472F3-161B-0099-5187-B4A799F5FC4C" priority = -1 reconnectAttempts = 0 reconnectInterval = 0 requestTimeout = -1 subtopic = "" concurrency = "multiple" convertParametersHandler = (null) convertResultHandler = (null) destination = "AMF" endpoint = "http://localhot/gateway.php" getServices = (mx.rpc.remoting.mxml::Operation)#11 argumentNames = (Array)#12 arguments = (Object)#13 concurrency = "multiple" lastResult = (null) makeObjectsBindable = true name = "getServices" operationManager = (null) properties = (null) resultElementType = (null) resultType = (null) service = (mx.rpc.remoting.mxml::RemoteObject)#1 showBusyCursor = true makeObjectsBindable = true managers = (null) operations = (Object)#14 getServices = (mx.rpc.remoting.mxml::Operation)#11 requestTimeout = -1 showBusyCursor = true source = "ZendAmfServiceBrowser" eventPhase = 2 fault = (mx.rpc::Fault)#15 content = (Object)#16 errorID = 0 faultCode = "Client.Error.DeliveryInDoubt" faultDetail = "Channel disconnected before an acknowledgement was received" faultString = "Channel disconnected" message = "faultCode:Client.Error.DeliveryInDoubt faultString:'Channel disconnected' faultDetail:'Channel disconnected before an acknowledgement was received'" name = "Error" rootCause = (mx.messaging.events::ChannelEvent)#17 bubbles = false cancelable = false channel = (mx.messaging.channels::AMFChannel)#5 channelId = (null) connected = false currentTarget = (mx.messaging.channels::AMFChannel)#5 eventPhase = 2 reconnecting = true rejected = false target = (mx.messaging.channels::AMFChannel)#5 type = "channelDisconnect" headers = (null) message = (mx.messaging.messages::ErrorMessage)#18 body = (Object)#16 clientId = (null) correlationId = "3407DB24-F4AD-C634-0E23-B4A799F60FC9" destination = "" extendedData = (null) faultCode = "Client.Error.DeliveryInDoubt" faultDetail = "Channel disconnected before an acknowledgement was received" faultString = "Channel disconnected" headers = (Object)#19 messageId = "FB5C929F-69E4-8573-F628-B4A79AFE514B" rootCause = (mx.messaging.events::ChannelEvent)#17 timestamp = 0 timeToLive = 0 messageId = "FB5C929F-69E4-8573-F628-B4A79AFE514B" statusCode = 0 target = (mx.rpc.remoting.mxml::RemoteObject)#1 token = (mx.rpc::AsyncToken)#20 message = (mx.messaging.messages::RemotingMessage)#21 body = (Array)#22 clientId = (null) destination = "AMF" headers = (Object)#23 DSEndpoint = (null) DSId = "nil" messageId = "3407DB24-F4AD-C634-0E23-B4A799F60FC9" operation = "getServices" source = "ZendAmfServiceBrowser" timestamp = 0 timeToLive = 0 responders = (null) result = (null) type = "fault" A lot of information and I don't really know what any of it means When accessing http://localhost/gateway.php I get the message Zend Amf Endpoint
This seemed to be a windows 7 issue, the same code worked on my linux server, although I didn't solve it I'll just move on. thanks M$