I get following error with my application during startup:
Proxy is not supported until module system is fully initialized
I guess the stack trace won't help much?
[SUB] java.lang.InternalError: Proxy is not supported until module system is fully initialized
[SUB] at java.lang.Throwable.fillInStackTrace(Unknown Source)
[SUB] at java.lang.Throwable.<init>(Unknown Source)
[SUB] at java.lang.Error.<init>(Unknown Source)
[SUB] at java.lang.VirtualMachineError.<init>(Unknown Source)
[SUB] at java.lang.InternalError.<init>(Unknown Source)
[SUB] at java.lang.reflect.Proxy$ProxyBuilder.<init>(Unknown Source)
[SUB] at java.lang.reflect.Proxy$ProxyBuilder.<init>(Unknown Source)
[SUB] at java.lang.reflect.Proxy.lambda$getProxyConstructor$0(Unknown Source)
[SUB] at java.lang.reflect.Proxy$$Lambda$1.apply(Unknown Source)
[SUB] at jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(Unknown Source)
[SUB] at jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(Unknown Source)
[SUB] at java.lang.reflect.Proxy.getProxyConstructor(Unknown Source)
[SUB] at java.lang.reflect.Proxy.newProxyInstance(Unknown Source)
[SUB] at javax.rad.util.EventHandler$ListenerHandler.<init>(Unknown Source)
[SUB] at javax.rad.util.EventHandler.setDefaultListener(Unknown Source)
[SUB] at javax.rad.genui.container.AbstractFrame.<init>(Unknown Source)
[SUB] at javax.rad.application.genui.UILauncher.<init>(Unknown Source)
[SUB] at com.sibvisions.rad.ui.javafx.impl.JavaFXLauncher.createUILauncher(Unknown Source)
[SUB] at com.sibvisions.mobilefx.DesktopJavaFXLauncher.createUILauncher(Unknown Source)
[SUB] at com.sibvisions.rad.ui.javafx.impl.JavaFXLauncher.<init>(Unknown Source)
[SUB] at com.sibvisions.mobilefx.DesktopJavaFXLauncher.<init>(Unknown Source)
[SUB] at com.sibvisions.mobilefx.MobileJavaFXLauncher.<init>(Unknown Source)
[SUB] at com.sibvisions.mobilefx.MobileJavaFXApplication.createLauncher(Unknown Source)
[SUB] at com.sibvisions.rad.ui.javafx.impl.JavaFXApplication.start(Unknown Source)
[SUB] at com.sibvisions.mobilefx.MobileJavaFXApplication.start(Unknown Source)
[SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
[SUB] at com.sun.javafx.application.LauncherImpl$$Lambda$9.run(Unknown Source)
[SUB] at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(Unknown Source)
[SUB] at com.sun.javafx.application.PlatformImpl$$Lambda$10.run(Unknown Source)
[SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown Source)
[SUB] at com.sun.javafx.application.PlatformImpl$$Lambda$22.run(Unknown Source)
[SUB] at java.security.AccessController.doPrivileged(Unknown Source)
[SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
[SUB] at com.sun.javafx.application.PlatformImpl$$Lambda$9.run(Unknown Source)
What we doe isn't tricky. We simply create a proxy class for an interface. Should we wait for "initialized" or similar before we start the "app"?
Hm... why is the module system unitialized?
Here's a simple example application, based on Eclipse project template:
public class Application extends MobileApplication
{
#Override
public void init()
{
try
{
//Runnable is only an example, the problem occurs with any interface
Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[] {Runnable.class}, new InvocationHandler()
{
#Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
return null;
}
});
}
catch (Throwable th)
{
th.printStackTrace();
}
addViewFactory(HOME_VIEW, BasicView::new);
}
#Override
public void postInit(Scene scene)
{
Swatch.BLUE.assignTo(scene);
((Stage) scene.getWindow()).getIcons().add(new Image(Application.class.getResourceAsStream("/icon.png")));
}
}
Related
I'm despaired with GraalVM 21 and Tornadofx2 (Java 11). As far I know, gluon should deal with it for me, as it has some specialized handling for JavaFX builds.
My Setup:
JVM: GraalVM Community Edition 21.0.0.2
// Should work only with GraalVM Community Edition 21.0.0.2 and higher
id 'com.gluonhq.client-gradle-plugin' version '0.1.36'
id 'org.openjfx.javafxplugin' version '0.0.9'
Gradle commands:
gradle :clean :assemble :nativeBuild :nativeRun
For some reason, it's doubled. :(
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] Caused by: java.lang.InstantiationException: Type `technology.xxx.yyy.client.view.MainView` can not be instantiated reflectively as it does not have a no-parameter constructor or the no-parameter constructor has not been added explicitly to the native image.
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at java.lang.Class.newInstance(DynamicHub.java:883)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at java.lang.Class.newInstance(DynamicHub.java:883)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at tornadofx.FXKt.find(FX.kt:437)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at tornadofx.FXKt.find(FX.kt:437)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at tornadofx.FXKt.find$default(FX.kt:426)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at tornadofx.FXKt.find$default(FX.kt:426)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at tornadofx.App.stop(App.kt:139)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at tornadofx.App.stop(App.kt:139)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$10(LauncherImpl.java:865)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$10(LauncherImpl.java:865)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at java.security.AccessController.doPrivileged(AccessController.java:102)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at java.security.AccessController.doPrivileged(AccessController.java:102)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] ... 3 more
[So. Apr. 18 14:05:13 MESZ 2021][INFO] [SUB] ... 3 more
My MainApp:
class MyApp: App(MainView::class) {
init {
FX.layoutDebuggerShortcut = KeyCodeCombination(KeyCode.F12)
}
override fun start(stage: Stage) {
with(stage) {
super.start(this)
minWidth = 1920.0
minHeight = 768.0
//isResizable = true
//isMaximized = true
centerOnScreen()
// App Icon
val favicon = MyApp::class.java.getResourceAsStream("/icons/favicon-32x32.png")
addStageIcon(Image(favicon))
find(ThemeController::class).loadThemeByConfig()
}
}
companion object {
#JvmStatic
fun main(args: Array<String>) {
launch<MyApp>(args)
}
}
}
My MainView:
class MainView : View("SpaceUp - Your Uberspace tool"), WsOperation {
private val client: Websocket.Companion.Client by inject()
init {
try {
client.getWs("feedback", this)
}catch(ex: UninitializedPropertyAccessException) {
// NOP
//alert(Alert.AlertType.ERROR,
// "Connection Issue", "Unable to connect with Server!", ButtonType.OK)
}
}
override val root = vbox {
menubar {
menu(messages["File"]) {
separator()
item(messages["File_Exit"]).action {
log.info("Leaving SpaceUp-Client")
Platform.exit()
}
}
menu(messages["Extras"]) {
item(messages["Extras_Settings"]).action {
// open
find<SettingsView>().openModal(stageStyle = StageStyle.UTILITY)
}
}
menu(messages["Help"]) {
item(messages["Help_About"])
}
}
tabpane {
tabClosingPolicy = TabPane.TabClosingPolicy.UNAVAILABLE
tab<SystemView>()
tab<DomainView>()
tab<ServiceView>()
}
toolbar {
add(RestProgressBar::class)
add(ConnectionFragment::class)
}
}
override fun onText(data: String) {
val feedback = Gson().fromJson(data, Feedback::class.java)
val feedbackJsonModel = FeedbackJsonModel()
feedbackJsonModel.info = feedback.info
feedbackJsonModel.error = feedback.error
fire(FeedbackEvent(feedbackJsonModel))
}
}
When I try to apply
id 'com.gluonhq.client-gradle-plugin' version '0.1.38'
id 'org.openjfx.javafxplugin' version '0.0.9'
I get this error:
An exception occurred applying plugin request [id: 'com.gluonhq.client-gradle-plugin', version: '0.1.38']
> Failed to apply plugin 'com.gluonhq.client-gradle-plugin'.
> Could not create task ':nativeRunAgent'.
> Could not create task of type 'ClientNativeRunAgent'.
> javafxplugin:configJavafxRun task not found.
If it is unclear, let me know how to clarify it.
Thank you!
I have a spring boot project which serves as a library (packaged jar file) to some other project. I am trying yo configure caffeine cache that will refresh asynchronously after request is made to the service.
pom.xml (includes) :
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
My configuration class :
#EnableCaching
#Configuration
public class CaffeineCacheConfig {
#Bean
public CacheManager cacheManager(){
CaffeineCacheManager cacheManager = new CaffeineCacheManager("userStories", "features");
cacheManager.setCaffeine(caffeineCacheBuilder());
cacheManager.setAllowNullValues(false);
return cacheManager;
}
Caffeine<Object, Object> caffeineCacheBuilder() {
return Caffeine.newBuilder()
.initialCapacity(100)
.maximumSize(500)
.refreshAfterWrite(1, TimeUnit.MINUTES)
.weakKeys()
.recordStats();
}
}
DAO layer (needs caching here) :
#Component
#EnableCaching
#CacheConfig(cacheNames = {"userStories"})
public class UserStoryDaoImpl implements IUserStoryDao {
#Override
#Cacheable
public List<UserStory> getUserStoriesForProjectAndRelease(UserDto userDto, Set<Integer> reportProjectId, int releaseId) {
return new ArrayList(); //slow and low performing method that returns a list
}
DAO layer (needs caching here as well) :
#Component
#EnableCaching
#CacheConfig(cacheNames = {"features"})
public class FeatureDaoImpl implements IFeatureDao {
#Override
#Cacheable
public List<Features> geFeaturesForProjectAndRelease(UserDto userDto, Set<Integer> reportProjectId, int releaseId) {
return new ArrayList(); //slow and low performing method that returns a list
}
}
I am getting below error stack while running this setup:
2020-03-31 16:55:46,020 ERROR web.context.ContextLoader - Context initialization failed [localhost-startStop-1] {}
java.lang.NullPointerException
at org.springframework.context.annotation.AutoProxyRegistrar.registerBeanDefinitions(AutoProxyRegistrar.java:62)
at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:385)
at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:377)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:205)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:164)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:130)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:287)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:225)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:632)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at com.intland.codebeamer.context.CodeBeamerContextListener.lambda$contextInitialized$1(CodeBeamerContextListener.java:117)
at com.intland.codebeamer.context.CodeBeamerContextListener.logExecutionTime(CodeBeamerContextListener.java:148)
at com.intland.codebeamer.context.CodeBeamerContextListener.contextInitialized(CodeBeamerContextListener.java:117)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4699)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1125)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1859)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2020-03-31 16:55:46,070 INFO codebeamer.context.CodeBeamerContextListener - Context - Destroyed [localhost-startStop-1] {}
2020-03-31 16:55:46,132 WARN context.support.XmlWebApplicationContext - Exception thrown from ApplicationListener handling ContextClosedEvent [localhost-startStop-1] {}
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Tue Mar 31 16:55:35 IST 2020]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1051)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1012)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:586)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
at com.intland.codebeamer.context.CodeBeamerContextListener.contextDestroyed(CodeBeamerContextListener.java:128)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4746)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5403)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1125)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1859)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2020-03-31 16:55:46,132 WARN context.support.XmlWebApplicationContext - Exception thrown from LifecycleProcessor on context close [localhost-startStop-1] {}
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Tue Mar 31 16:55:35 IST 2020]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1059)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1012)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:586)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
at com.intland.codebeamer.context.CodeBeamerContextListener.contextDestroyed(CodeBeamerContextListener.java:128)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4746)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5403)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1125)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1859)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Not sure what is missing in the setup?
Start with removing #EnableCaching from #Component classes - keep
it only on #Configuration.
Not sure about #CacheConfig, normally
you can configure cache name in #Cacheable.
I have previous experience with your idea. The problem here is that refreshing cache needs a method to do the refresh - a method which would produce an up-to-date value based on the key. It's tricky to implement such method when key is based on multiple parameters from the method signature. Also this means that value loading mechanism should be implemented twice: in the annotated method and in the reloader.
I have fixed it to add the next line to the application properties:
cache.ttl=60
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="engine" class="beans.Engine" dependency-check="none" >
</bean>
<bean id="car" class="beans.Car">
<property name="carname" value="Audi" />
<property name="engine" ref="engine"/>
</bean>
**my engine class is look like this **
here i avoid to pass properties
package beans;
public class Engine {
public Engine()
{
System.out.println("Engine");
}
private String modelyear;
public void setModelyear(String modelyear) {
this.modelyear = modelyear;
}
public String getModelyear() {
return modelyear;
}
}
I getting this exception while i try to set dependency-check
Apr 01, 2018 12:06:22 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#520a3426: startup date [Sun Apr 01 12:06:22 IST 2018]; root of context hierarchy
Apr 01, 2018 12:06:22 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [resources/spring.xml]
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML document from class path resource [resources/spring.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 65; Attribute "dependency-check" must be declared for element type "bean".
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:223)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:194)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:258)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:128)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:620)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:521)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
at test.Client.main(Client.java:12)
Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 65; Attribute "dependency-check" must be declared for element type "bean".
at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:428)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
dependency-check is deprecated (source).
Quote:
The current spring-beans 3.0 XSD favors a more explicit configuration and relies less on the container to provide some configuration "magic".
The following attributes were removed:
"default-dependency-check" attribute of the root element
"dependency-check" attribute of the element
Jan 23, 2014 3:34:13 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext#32fb4f: startup date [Thu Jan 23 15:34:13 PST 2014]; root of context hierarchy
Jan 23, 2014 3:34:13 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring.xml]
Jan 23, 2014 3:34:14 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#140c281: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,datasource,sessionfactory,employeeDaoImpl,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Jan 23, 2014 3:34:14 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#140c281: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,datasource,sessionfactory,employeeDaoImpl,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionfactory' defined in class path resource [spring.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/annotations/Entity
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:591)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at User.Client.main(Client.java:13)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/annotations/Entity
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:162)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
... 13 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/Entity
at org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.<init>(AnnotationSessionFactoryBean.java:89)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
... 15 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.Entity
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 21 more
You need the hibernate-annotations.jar in the classpath. If you use maven / gradle for your dependencies, then you'll probably need 'org.hibernate:hibernate-annotations:3.5.6-Final' (or whatever version you are using)
Trying to get my app to connect to oracle. Using ojdbc6.jar (with Java 6). Maven 3.0.4. Tomcat 7.0.42 (clean install). Here's my context.xml:
<Context reloadable="true" crossContext="false">
<Valve className="org.dcri.tomcat.auth.ExtendedFormAuthenticator" includePassword="false" />
<Realm className="org.dcri.tomcat.auth.DatabaseServerLoginModule"
connectionName="xxxxxx"
connectionPassword="xxxxxx"
connectionURL="jdbc:oracle:oci8:#xxxxxx"
driverName="oracle.jdbc.OracleDriver"
digest="SHA1"
.......
Using sqlplus, I'm able to login to the db no problem. when trying to connect with app I get:`
SEVERE: Exception opening database connection
java.sql.SQLException: ??
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:650)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:338)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490)
at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:133)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:465)
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:710)
at org.apache.catalina.realm.JDBCRealm.startInternal(JDBCRealm.java:788)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5317)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.StandardContext listenerStart
FINE: Configuring event listener class 'org.apache.catalina.deploy.ApplicationListener#59bdbfec'
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.StandardContext listenerStart
FINE: Configuring event listener class 'org.apache.catalina.deploy.ApplicationListener#4463a1ae'
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.StandardContext listenerStart
FINE: Configuring event listener class 'org.apache.catalina.deploy.ApplicationListener#690bc995'
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.StandardContext listenerStart
FINE: Configuring event listener class 'org.apache.catalina.deploy.ApplicationListener#5675b3ee'
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.StandardContext listenerStart
FINE: Configuring event listener class 'org.apache.catalina.deploy.ApplicationListener#4977fa9a'
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.StandardContext listenerStart
FINE: Configuring event listener class 'org.apache.catalina.deploy.ApplicationListener#58d51a54'
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.StandardContext listenerStart
FINE: Configuring event listener class 'org.apache.catalina.deploy.ApplicationListener#5e54777e'
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.StandardContext listenerStart
FINE: Sending application start events
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.ApplicationContext log
INFO: Set web app root system property: 'webapp.root' = [C:\work\apache-tomcat-7.0.42\apache-tomcat-7.0.42\webapps\employee\]
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing log4j from [C:\work\apache-tomcat-7.0.42\apache-tomcat-7.0.42\webapps\employee\WEB-INF\classes\log4j.xml]
Aug 20, 2013 2:05:49 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Aug 20, 2013 2:05:53 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deploymentController' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy56.findAll(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:126)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at edu.services.aop.TimingAdvice.invoke(TimingAdvice.java:32)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy57.findAll(Unknown Source)
at edu.services.actions.DeploymentControllerImpl.init(DeploymentControllerImpl.java:232)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 29 more
Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1463)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
... 56 more
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (??)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
... 61 more
Not sure what the issue could be. The ?? doesn't really provide much guidance...ideas?
thanks