I replace fragments in my application by next code
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
fragmentManager.beginTransaction()
//.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
.replace(R.id.main, newFragment)
.addToBackStack(Tag)
.commit();
When I uncomment
.setCustomAnimations(R.anim.enter_from_right,
R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
I've got Fatal Error, but it worked before well. I think the reason in AndroidStudio (current ver 1.5.1, SDK or libs). Code stopped working suddenly, but continues to work after compiling on another PC with AndrodStudio 1.5
The only way to reinstall Android Studio hoping that it helps me. But I wanna understand what happened.
The first problem was this:
can't access to TextView
This code worked ok too.
Maybe somebody can explain what wrong
-- enter_from_left.xml ----
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="-100%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="200"/>
</set>
--- enter_from_right.xml ---
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="100%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="200" />
</set>
--- exit_to_left.xml ---
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="-100%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="200"/>
</set>
--- exit_to_right.xml ---
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="100%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="200" />
</set>
FATAL EXCEPTION: main
Process: , PID: 24774
java.lang.NullPointerException
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2939)
at android.view.View.getDisplayList(View.java:13368)
at android.view.View.getDisplayList(View.java:13415)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077)
at android.view.View.getDisplayList(View.java:13311)
at android.view.View.getDisplayList(View.java:13415)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077)
at android.view.View.getDisplayList(View.java:13311)
at android.view.View.getDisplayList(View.java:13415)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077)
at android.view.View.getDisplayList(View.java:13311)
at android.view.View.getDisplayList(View.java:13415)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077)
at android.view.View.getDisplayList(View.java:13311)
at android.view.View.getDisplayList(View.java:13415)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077)
at android.view.View.getDisplayList(View.java:13311)
at android.view.View.getDisplayList(View.java:13415)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077)
at android.view.View.getDisplayList(View.java:13311)
at android.view.View.getDisplayList(View.java:13415)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077)
at android.view.View.getDisplayList(View.java:13311)
at android.view.View.getDisplayList(View.java:13415)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077)
at android.view.View.getDisplayList(View.java:13311)
at android.view.View.getDisplayList(View.java:13415)
at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1570)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1449)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2420)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2292)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1922)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1039)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5648)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5047)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:806)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
I know? the reason in th ADK version, everything work at last version compileSdkVersion 23
buildToolsVersion "23.0.1"
Everything ok on another AndroidStudio, all problems started after update to Android N
I've removed one row "com.android.support:recyclerview-v7:+" from build.gradle and everething work ok
dependencies {
compile 'com.android.support:recyclerview-v7:+'
}
I don't know why, just by successive exclusions
And everything ok if I use
compile 'com.android.support:recyclerview-v7:23.2.1'
Related
grails version 3.3.1
cache-ehcache:3.0.0.M1
can somebody send me a valid ehcache.xmlplease?
My file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="true"
monitoring="autodetect"
dynamicConfig="true">
<diskStore path="java.io.tmpdir"/>
<cache name="sevenSeconds"
maxEntriesLocalHeap="100"
maxEntriesLocalDisk="1000"
eternal="false"
timeToLiveSeconds="7"
timeToIdleSeconds="0"
memoryStoreEvictionPolicy="LFU"
transactionalMode="off">
<persistence strategy="localTempSwap" />
</cache>
<defaultCache
maxElementsInMemory="50000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
and i get this error while startup:
Caused by: org.ehcache.xml.exceptions.XmlConfigurationException: Error parsing XML configuration at file:/home/user/workspaces/api2-grails/grails-app/conf/ehcacheCustom.xml
Caused by: org.xml.sax.SAXParseException: cvc-elt.1.a: Cannot find the declaration of element 'ehcache'.
thanks for suggestions
Since ehcache 3.0.0 the xml format changed. This is my base version:
<?xml version="1.0" encoding="UTF-8"?>
<config
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns='http://www.ehcache.org/v3'
xsi:schemaLocation="ehcache-core.xsd">
<persistence directory="java.io.tmpdir"/>
<cache alias="twentySeconds">
<expiry>
<ttl unit="seconds">20</ttl>
</expiry>
<heap>2</heap>
</cache>
</config>
After struggling with the same issue I found this link and just took it as a base to get the following working example:
<ehcache:config xmlns:ehcache="http://www.ehcache.org/v3" xmlns:jcache="http://www.ehcache.org/v3/jsr107">
<ehcache:cache alias="books">
<ehcache:key-type>java.lang.String</ehcache:key-type>
<ehcache:value-type>hello.Book</ehcache:value-type>
<ehcache:resources>
<ehcache:heap unit="MB">1</ehcache:heap>
<!--ehcache:offheap unit="MB">10</ehcache:offheap-->
</ehcache:resources>
</ehcache:cache>
</ehcache:config>
We are coding in Java 8 + Play 2 application.
We are in process of migrating from Gemfire 6 to Gemfire 8.
Below is my gemfire client-cache.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE client-cache PUBLIC
"-//GemStone Systems, Inc.//GemFire Declarative Caching 6.6//EN"
"http://www.gemstone.com/dtd/cache6_6.dtd">
<client-cache>
<pool name="gemfire_qa_instance" subscription-enabled="true">
<locator host="somehost1" port="42101" />
<locator host="somehost2" port="42101" />
<locator host="somehost3" port="42101" />
<locator host="somehost4" port="42101" />
</pool>
<region name="customer" refid="CACHING_PROXY_HEAP_LRU">
<region-attributes>
<cache-listener>
<class-name>ser.cac.CustomerListener</class-name>
</cache-listener>
</region-attributes>
</region>
<region name="s2o_customer" refid="CACHING_PROXY_HEAP_LRU">
<region-attributes>
<cache-listener>
<class-name>ser.cac.CustomerListener</class-name>
</cache-listener>
</region-attributes>
</region>
<region name="ten_minute_ttl" refid="CACHING_PROXY_HEAP_LRU" />
<region name="five_minute_ttl" refid="CACHING_PROXY_HEAP_LRU" />
<region name="six_hour_idle" refid="CACHING_PROXY_HEAP_LRU"/>
<region name="ten_minute_idle" refid="CACHING_PROXY_HEAP_LRU" />
<resource-manager critical-heap-percentage="99" eviction-heap-percentage="90" />
</client-cache>
With this configuration in place I have number of gemfire related things working except that I receive below exception in the logs.
2017-07-17 06:15:03,718 WARN application - status="0" action="CACHE_PUT_ALL" event_description="failure on cache 'region 'ten_minute_ttl.split_b37_PID0000_document_author'' for key '[757227, CMS_757227]' with message: com.gemstone.gemfire.SerializationException: A ClassNotFoundException was thrown while trying to deserialize cached value." appId="MOBSVC_P2" request_id="5d313d75-e4ec-406b-a842-0a3ff5d9f1a4" version="1.0" locale="fr-CA" productId="JOB" level="WARN" event_status="success" event_severity="info" exception=com.gemstone.gemfire.cache.client.ServerOperationException: com.gemstone.gemfire.SerializationException: A ClassNotFoundException was thrown while trying to deserialize cached value.
at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.handleException(OpExecutorImpl.java:560)
at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.handleException(OpExecutorImpl.java:657)
at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.handleException(OpExecutorImpl.java:495)
at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeOnServer(OpExecutorImpl.java:336)
at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeOn(OpExecutorImpl.java:303)
at com.gemstone.gemfire.cache.client.internal.PoolImpl.executeOn(PoolImpl.java:659)
at com.gemstone.gemfire.cache.client.internal.SingleHopOperationCallable.call(SingleHopOperationCallable.java:45)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.gemstone.gemfire.SerializationException: A ClassNotFoundException was thrown while trying to deserialize cached value.
at com.gemstone.gemfire.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1561)
at com.gemstone.gemfire.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1546)
at com.gemstone.gemfire.internal.cache.VMCachedDeserializable.getDeserializedForReading(VMCachedDeserializable.java:153)
at com.gemstone.gemfire.cache.operations.PutAllOperationContext$UpdateOnlyMap.exportValue(PutAllOperationContext.java:171)
at com.gemstone.gemfire.cache.operations.PutAllOperationContext$UpdateOnlyMap.access$300(PutAllOperationContext.java:144)
at com.gemstone.gemfire.cache.operations.PutAllOperationContext$UpdateOnlyMap$ExportableEntry.getValue(PutAllOperationContext.java:256)
at com.gemstone.gemfire.internal.cache.LocalRegion.verifyPutAllMap(LocalRegion.java:9695)
at com.gemstone.gemfire.internal.cache.LocalRegion.basicPutAll(LocalRegion.java:9842)
at com.gemstone.gemfire.internal.cache.LocalRegion.basicBridgePutAll(LocalRegion.java:9742)
at com.gemstone.gemfire.internal.cache.tier.sockets.command.PutAll.cmdExecute(PutAll.java:206)
at com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand.execute(BaseCommand.java:182)
at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.doNormalMsg(ServerConnection.java:789)
at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.doOneMessage(ServerConnection.java:920)
at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.run(ServerConnection.java:1128)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at com.gemstone.gemfire.internal.cache.tier.sockets.AcceptorImpl$1$1.run(AcceptorImpl.java:577)
... 1 more
Caused by: java.lang.ClassNotFoundException: models.article.Author
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:626)
at com.gemstone.gemfire.internal.InternalDataSerializer$DSObjectInputStream.resolveClass(InternalDataSerializer.java:3563)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at com.gemstone.gemfire.internal.InternalDataSerializer.basicReadObject(InternalDataSerializer.java:2966)
at com.gemstone.gemfire.DataSerializer.readObject(DataSerializer.java:3210)
at com.gemstone.gemfire.internal.util.BlobHelper.deserializeBlob(BlobHelper.java:110)
at com.gemstone.gemfire.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1554)
... 17 more
2017-07-17 06:15:03,729 INFO application - status="0" event_description="produced 2 of the remaining 1 Author(s)" appId="MOBSVC_P2" request_id="5d313d75-e4ec-406b-a842-0a3ff5d9f1a4" version="1.0" locale="fr-CA" productId="JOB" level="DEFAULT" event_status="success" event_severity="info"
Now below are the things I tried to see if it works to resolve this exception
Changed the client-cache.xml file configuration from CACHING_PROXY_HEAP_LRU to CACHING_PROXY and even PROXY. It does not worked, exception is still present
Also tried adding below thing in the client-cache.xml file but it did not worked as well. I did it for all the regions.
<region name="five_minute_ttl" refid="CACHING_PROXY_HEAP_LRU">
<region-attributes pool-name="gemfire_qa_instance">
<eviction-attributes>
<lru-heap-percentage action="local-destroy" />
</eviction-attributes>
</region-attributes>
</region>
Other than this exception, everything seems to be working fine with the gemfire client 6.6.2 connecting to gemfire server 8.1.0
I have updated the gemfire client from 6.6.2 to 8.1.0 and made the changes in the client-cache.xml file so that the XML is compliant to the gemfire 8.1.0 client. Below is my client-cache.xml file for Gemfire 8.1.0 client. But the error is still present.
<?xml version="1.0"?>
<client-cache xmlns="http://schema.pivotal.io/gemfire/cache" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd" version="8.1">
<pool name="gemfire_qa_instance" subscription-enabled="true">
<locator host="somehost1" port="42101" />
<locator host="somehost2" port="42101" />
<locator host="somehost3" port="42101" />
<locator host="somehost4" port="42101" />
</pool>
<region name="customer" refid="CACHING_PROXY_HEAP_LRU">
<region-attributes>
<cache-listener>
<class-name>ser.cac.CustomerListener</class-name>
</cache-listener>
</region-attributes>
</region>
<region name="s2o_customer" refid="CACHING_PROXY_HEAP_LRU">
<region-attributes>
<cache-listener>
<class-name>ser.cac.CustomerListener</class-name>
</cache-listener>
</region-attributes>
</region>
<region name="ten_minute_ttl" refid="CACHING_PROXY_HEAP_LRU" />
<region name="five_minute_ttl" refid="CACHING_PROXY_HEAP_LRU" />
<region name="six_hour_idle" refid="CACHING_PROXY_HEAP_LRU" />
<region name="ten_minute_idle" refid="CACHING_PROXY_HEAP_LRU" />
<resource-manager critical-heap-percentage="99" eviction-heap-percentage="90" />
</client-cache>
Can someone help in this regard?
From the exception, it's clear that the server is trying to deserialize an instance of models.article.Author, but it can't find the class definition within the classpath.
Which data serialization mechanism are you using?, have you tried adding the jar containing the class model to the server's classpath?.
Cheers.
I have tried several suggested methods to resolve this java persistence exception but have not been successful yet. Any suggestions or help would be greatly appreciated.
Below are the details
SQLQueries.xml
-----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings
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/orm_2_0.xsd "
version="2.0">
<sql-query name="GET_NEXT_NUM_SP" callable="true">
<return alias = "nextNumber" class="com.utility.numbergenerator.da.NumberDAOImpl">
<return-property name="nextSeqNum" column="NEXT_SEQ_NUM" />
</return>
{ ? = call Test_Proc }
</sql-query>
</entity-mappings>
persistence.xml
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<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="NG" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<mapping-file>META-INF/SQLQueries.xml</mapping-file>
<class> Several related classes </class>
<properties> Followed by properties </properties>
</persistence-unit>
Stack trace of the exception
-- Initializing database connection --
javax.persistence.PersistenceException: [PersistenceUnit: NG] Error while reading JPA XML file: META-INF/SQLQueries.xml
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1205)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1004)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:282)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:366)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at com.go2uti.oneworld.common.hibernate.HibernateUtil.initializeJPA(HibernateUtil.java:68)
at com.go2uti.oneworld.common.hibernate.HibernateUtil.(HibernateUtil.java:38)
at com.go2uti.oneworld.utility.businessidgenerator.da.EntityManagerFactorySingleton.init(EntityManagerFactorySingleton.java:26)
at com.go2uti.oneworld.utility.businessidgenerator.compatibility.AbstractPersistentTest.initializeContext(AbstractPersistentTest.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.hibernate.InvalidMappingException: Unable to read XML
at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:101)
at org.hibernate.cfg.Configuration.add(Configuration.java:513)
at org.hibernate.cfg.Configuration.add(Configuration.java:509)
at org.hibernate.cfg.Configuration.add(Configuration.java:716)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:801)
at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:152)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1192)
... 34 more
Please help me resolve this issue.
Your META-INF/SQLQueries.xml file is based on JPA 2.0 XML mapping schema which is defined by http://java.sun.com/xml/ns/persistence/orm_2_0.xsd.
Since sql-query element is Hibernate specific you need to replace <entity-mappings> with <hibernate-mapping> as shown below:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<sql-query name="GET_NEXT_NUM_SP" callable="true">
<return alias="nextNumber" class="com.utility.numbergenerator.da.NumberDAOImpl">
<return-property name="nextSeqNum" column="NEXT_SEQ_NUM" />
</return>
{ ? = call Test_Proc }
</sql-query>
</hibernate-mapping>
First,please let me aplogize my english is not good. because I'm Japanese.
I ask,error of JAX-RS project.
I import a sample of the following sites:
http://www.opentone.co.jp/news/release/article04/article0403.html
but i can't be executed that project.
I think "Starting the context failed due to previous errors: Critical" is prime importance.
How they could be solved What if?
And if possible the above sites Please try to import to eclipse the project actually.
You can download the "添付のファイル" from the attached.Near the bottom of the page it.
It is over, thank you.
this is web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Archetype Created Web Application</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
this is stack trace
9 23, 2014 5:18:07 午後 org.apache.catalina.core.StandardContext listenerStart
重大: クラス org.springframework.web.context.ContextLoaderListener のリスナインスタンスにコンテキスト初期化イベントを送信中の例外です
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [jp.sample.jaxrs.service.HelloResource] for bean with name 'helloResource' defined in file [C:\Users\omiz12032\workspace3\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\jax-rs\WEB-INF\classes\jp\sample\jaxrs\service\HelloResource.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: jp/sample/jaxrs/service/HelloResource : Unsupported major.minor version 52.0 (unable to load class jp.sample.jaxrs.service.HelloResource)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1264)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1330)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:896)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.UnsupportedClassVersionError: jp/sample/jaxrs/service/HelloResource : Unsupported major.minor version 52.0 (unable to load class jp.sample.jaxrs.service.HelloResource)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2858)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1282)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1253)
... 24 more
9 23, 2014 5:18:07 午後 org.apache.catalina.core.StandardContext start
重大: Error listenerStart
9 23, 2014 5:18:07 午後 org.apache.catalina.core.StandardContext start
重大: 以前のエラーのためにコンテキストの起動が失敗しました [/jax-rs]
9 23, 2014 5:18:07 午後 org.apache.catalina.core.ApplicationContext log
情報: Closing Spring root WebApplicationContext
9 23, 2014 5:18:07 午後 org.apache.coyote.http11.Http11Protocol start
情報: Coyote HTTP/1.1を http-8080 で起動します
9 23, 2014 5:18:07 午後 org.apache.jk.common.ChannelSocket init
情報: JK: ajp13 listening on /0.0.0.0:8009
9 23, 2014 5:18:07 午後 org.apache.jk.server.JkMain start
情報: Jk running ID=0 time=0/21 config=null
9 23, 2014 5:18:07 午後 org.apache.catalina.startup.Catalina start
情報: Server startup in 4681 ms
anf this is applicationContext.xml.Those for registering a web service
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<context:component-scan base-package="jp.sample.jaxrs" />
<jaxrs:server id="jaxrsservice" address="/">
<jaxrs:serviceBeans>
<ref bean="helloResource" />
</jaxrs:serviceBeans>
</jaxrs:server>
<jaxrs:server id="itemorderresource" address="/">
<jaxrs:serviceBeans>
<ref bean="itemOrderResource" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/jaxrs" />
<property name="username" value="jaxrs" />
<property name="password" value="jaxrs" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:mybatis-config.xml" />
<property name="mapperLocations" value="classpath:mybatis/**/*.xml" />
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
Caused by: java.lang.UnsupportedClassVersionError: jp/sample/jaxrs/service/HelloResource : Unsupported major.minor version 52.0 (unable to load class jp.sample.jaxrs.service.HelloResource)
Basically it means that you compiled your classes with newer JDK than is your server (probably in development environment you have 1.8 and in tomcat server you have 1.7).
Try switching Java compiler level to lower version in development environment.
I'm using struts 2.2.1 and tiles 2.2.2. I've done every step described here but I cannot get tiles work... I get the following error while deploying my war to glassfish 3.1:
[#|2011-10-04T08:43:28.117+0200|SEVERE|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=74;_ThreadName=AutoDeployer;|Exception while invoking class com.sun.enterprise.web.WebApplication start method
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:130)
In my WEB-INF/lib I've got commons-collections-3.1.jar, commons-fileupload-1.2.1.jar, struts2-core-2.2.1.jar, tiles-api-2.2.2.jar, tiles-core-2.2.2.jar, tiles-jsp-2.2.2.jar and xwork-core-2.2.1.jar.
This is my struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="basicstruts2" extends="struts-default">
<interceptors>
<interceptor-stack name="appDefault">
<interceptor-ref name="defaultStack">
<param name="exception.logEnabled">true</param>
<param name="exception.logLevel">ERROR</param>
</interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="appDefault" />
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<global-results>
<result name="exception">/jsp/exceptions/exception.jsp</result>
<result name="webServiceException">/jsp/exceptions/webserviceexception.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="exception" />
<exception-mapping exception="java.io.IOException" result="exception" />
<exception-mapping exception="exceptions.WebServiceExceptionForStruts"
result="webServiceException" />
</global-exception-mappings>
<action name="tilesTest" class="test.action.TilesTest">
<result name="success" type="tiles">/welcome.tiles</result>
</action>
<action name="index">
<result>/jsp/index.jsp</result>
</action>
</package>
</struts>
After inserting the code into my struts.xml, I get this error in eclipse:
And this is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Consumer</display-name>
<welcome-file-list>
<welcome-file>/jsp/index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<context-param>
<param-name>tilesDefinitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
</web-app>
Thank you very much!
You're missing the S2 tiles plugin. It's listed in the referenced article.
Your second issue with the XML is clearly stated in the IDE error; the order of elements given in the error message isn't the order you define the elements in your XML file.
ClassNotFoundException, looks like missing jar issue. Can you see the tiles plugin jar in war that is getting deployed on glassfish server.if not check check the war creation setting in you IDE. We faced this problem when it was not pushing jars from lib to the war.
ClassNotFoundException Always alerts you that some class/jar which is referenced is missing. Make sure you have all the basic jars required for tiles.
In my case, I have these jars (besides struts2 jars) in my struts2 application to test a demo tile project.
commons-beanutils-1.7.0.jar
commons-digester-2.0.jar
commons-logging-1.1.1.jar
commons-logging-api-1.1.jar
ognl-3.0.1.jar
slf4j-api-1.6.2.jar
slf4j-simple-1.6.2.jar
struts2-tiles-plugin-2.2.3.1.jar
tiles-api-2.2.2.jar
tiles-compat-2.2.2.jar
tiles-core-2.2.2.jar
tiles-jsp-2.2.2.jar
tiles-servlet-2.2.2.jar
tiles-template-2.2.2.jar
Best of luck.
Regards,
Amir Ali