我希望获得上传文件的临时链接,但却在使用内容类型标题。我已经尝试了org.apache.openejb.OpenEJBException: org.apache.openejb.OpenEJBRuntimeException: javax.persistence.PersistenceException: [PersistenceUnit: my_internet_shop] Unable to build Hibernate SessionFactory: javax.persistence.PersistenceException: [PersistenceUnit: my_internet_shop] Unable to build Hibernate SessionFactory
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:872)
... 65 more
Caused by: org.apache.openejb.OpenEJBRuntimeException: javax.persistence.PersistenceException: [PersistenceUnit: my_internet_shop] Unable to build Hibernate SessionFactory
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:136)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.<init>(ReloadableEntityManagerFactory.java:105)
at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:157)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:866)
... 65 more
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: my_internet_shop] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:951)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:881)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:151)
at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable.call(EntityManagerFactoryCallable.java:122)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:134)
... 68 more
Caused by: org.hibernate.HibernateException: Could not access BeanManager ListenerFactory class [org.hibernate.jpa.event.internal.jpa.ListenerFactoryBeanManagerStandardImpl] to handle CDI extensions
at org.hibernate.jpa.event.spi.jpa.ListenerFactoryBuilder.buildBeanManagerListenerFactory(ListenerFactoryBuilder.java:96)
at org.hibernate.jpa.event.spi.jpa.ListenerFactoryBuilder.buildStandardBeanManagerListenerFactory(ListenerFactoryBuilder.java:59)
at org.hibernate.jpa.event.spi.jpa.ListenerFactoryBuilder.buildListenerFactory(ListenerFactoryBuilder.java:42)
at org.hibernate.jpa.event.spi.JpaIntegrator.integrate(JpaIntegrator.java:135)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:278)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:493)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:878)
... 71 more
Caused by: java.lang.IllegalStateException: On a thread without an initialized context nor a classloader mapping a deployed app
at org.apache.openejb.cdi.ThreadSingletonServiceImpl.get(ThreadSingletonServiceImpl.java:287)
at org.apache.openejb.cdi.ThreadSingletonServiceImpl.getContext(ThreadSingletonServiceImpl.java:263)
at org.apache.openejb.cdi.ThreadSingletonServiceImpl.get(ThreadSingletonServiceImpl.java:298)
at org.apache.openejb.cdi.ThreadSingletonServiceImpl.get(ThreadSingletonServiceImpl.java:60)
at org.apache.webbeans.config.WebBeansFinder.getSingletonInstance(WebBeansFinder.java:51)
at org.apache.webbeans.config.WebBeansContext.getInstance(WebBeansContext.java:185)
at org.apache.webbeans.config.WebBeansContext.currentInstance(WebBeansContext.java:203)
at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable$1.findBm(EntityManagerFactoryCallable.java:105)
at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable$1.invoke(EntityManagerFactoryCallable.java:96)
at com.sun.proxy.$Proxy70.toString(Unknown Source)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at org.hibernate.jpa.event.internal.jpa.ListenerFactoryBeanManagerStandardImpl.<init>(ListenerFactoryBeanManagerStandardImpl.java:60)
at org.hibernate.jpa.event.internal.jpa.ListenerFactoryBeanManagerStandardImpl.fromBeanManagerReference(ListenerFactoryBeanManagerStandardImpl.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.hibernate.jpa.event.spi.jpa.ListenerFactoryBuilder.buildBeanManagerListenerFactory(ListenerFactoryBuilder.java:80)
... 77 more
标头的几种组合,但是全部都出错了。另外,我如何使用函数java.lang.IllegalStateException: On a thread without an initialized context nor a classloader mapping a deployed app
代替此代码。请让我知道。
这是我的代码:
Content-Type
答案 0 :(得分:1)
看起来您Content-Type
和正文的格式不正确。这是一个适合我的版本:
jQuery.ajax({
url: 'https://api.dropboxapi.com/2/files/get_temporary_link',
type: 'POST',
processData: false,
data: JSON.stringify({"path": "/test.txt"}),
contentType: 'application/json',
headers: {
"Authorization": "Bearer <ACCESS_TOKEN>"
},
success: function (data) {
console.log(data);
},
error: function (error) {
console.log(error);
}
})