GXT (EXT-GWT) Default Grid Widget implementation. What's wrong? - gwt

Sample Code for Grid
public class GraduateProject implements EntryPoint {
public static List<Student> getStudents() {
List<Student> students = new ArrayList<Student>();
students.add(new Student("Kostas", "Trichas"));
students.add(new Student("Dimitris", "Elotriviaris"));
students.add(new Student("Dimitris", "Moutafidis"));
students.add(new Student("Stavros", "Baltas"));
students.add(new Student("Panos", "Paikos"));
students.add(new Student("Nikos", "Antarakis"));
students.add(new Student("Vagelis", "Papaiakos"));
return students;
}
#Override
public void onModuleLoad() {
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
column.setId("fname");
column.setHeader("First Name");
column.setWidth(250);
configs.add(column);
column = new ColumnConfig();
column.setId("lname");
column.setHeader("Last Name");
column.setWidth(250);
configs.add(column);
ListStore<Student> studentList = new ListStore<Student>();
studentList.add(getStudents());
ColumnModel cm = new ColumnModel(configs);
final Grid<Student> grid = new Grid<Student>(studentList,cm);
RootPanel.get().add(grid);
}
}
And the error:
onModuleLoad() threw an exception
Exception while loading module com.graduateproject.client.GraduateProject. See Development Mode for details.
java.lang.reflect.InvocationTargetException 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 com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.extjs.gxt.ui.client.widget.grid.GridTemplates' (did you forget to inherit a required module?) at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53) at com.google.gwt.core.client.GWT.create(GWT.java:98) at com.extjs.gxt.ui.client.widget.grid.GridView.initTemplates(GridView.java:1351) at com.extjs.gxt.ui.client.widget.grid.GridView.init(GridView.java:1224) at com.extjs.gxt.ui.client.widget.grid.Grid.onRender(Grid.java:880) at com.extjs.gxt.ui.client.widget.Component.render(Component.java:1022) at com.extjs.gxt.ui.client.widget.Component.onAttach(Component.java:1636) at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:449) at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:127) at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:97) at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:97) at com.graduateproject.client.GraduateProject.onModuleLoad(GraduateProject.java:58) ... 9 more Caused by: java.lang.IncompatibleClassChangeError: Found interface com.google.gwt.core.ext.typeinfo.JClassType, but class was expected at com.extjs.gxt.ui.rebind.core.TemplatesGenerator$SourceGenerator.validateType(TemplatesGenerator.java:142) at com.extjs.gxt.ui.rebind.core.TemplatesGenerator$SourceGenerator.generate(TemplatesGenerator.java:97) at com.extjs.gxt.ui.rebind.core.TemplatesGenerator.generate(TemplatesGenerator.java:56) at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48) at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60) at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:662) at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41) at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:74) at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:259) at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141) at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585) at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455) at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49) ... 20 more

I figured it out myself. There is an incompatibility between the latest GWT 2.2.0 SDK and the standard EXT-GWT version 2.2.1. I switched back the GWT version to the previous release 2.0.4 and everything works fine. I hope EXT-GWT will soon update it's SDK to catch up with GWT.

Related

NoSuchMethodException with "select new" after upgrading to Spring Data JPA 1.10.3

I encountered an issue after upgrading our Spring Data JPA from 1.9.2 to 1.10.3.
I have the following repository:
public interface ShipmentStatisticRepository extends JpaRepository<Shipment, Long> {
...
#Query("select new de.l.b.model.dto.shipment.ShipmentStatistic(s.createdYmd, count(distinct s.oid), count(op), sum(op.price)) " +
"from Shipment s " +
"join s.orderPosition op " +
"where s.created between ?1 and ?2 " +
"group by s.createdYmd")
List<ShipmentStatistic> findPerDayBetweenCreated(Date from, Date to);
...
}
When I call this method I get the following Exception:
org.springframework.dao.InvalidDataAccessApiUsageException: Could not instantiate Collection type: org.apache.openjpa.kernel.DelegatingResultList; nested exception is java.lang.IllegalArgumentException: Could not instantiate Collection type: org.apache.openjpa.kernel.DelegatingResultList
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:384)
at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:122)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:436)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
at com.sun.proxy.$Proxy154.findPerDayBetweenCreated(Unknown Source)
at de.l.b.hazelcast.map.ShipmentStatisticPerDayMapLoader.getShipmentStatistic(ShipmentStatisticPerDayMapLoader.java:40)
at de.l.b.hazelcast.map.AbstractShipmentStatisticMapLoader.load(AbstractShipmentStatisticMapLoader.java:38)
at de.l.b.hazelcast.map.AbstractShipmentStatisticMapLoader.loadAll(AbstractShipmentStatisticMapLoader.java:48)
at com.hazelcast.map.impl.MapStoreWrapper.loadAll(MapStoreWrapper.java:143)
at com.hazelcast.map.impl.mapstore.AbstractMapDataStore.loadAll(AbstractMapDataStore.java:56)
at com.hazelcast.map.impl.mapstore.writebehind.WriteBehindStore.loadAll(WriteBehindStore.java:205)
at com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader.loadAndGet(BasicRecordStoreLoader.java:170)
at com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader.doBatchLoad(BasicRecordStoreLoader.java:143)
at com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader.loadValuesInternal(BasicRecordStoreLoader.java:129)
at com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader.access$100(BasicRecordStoreLoader.java:54)
at com.hazelcast.map.impl.recordstore.BasicRecordStoreLoader$GivenKeysLoaderTask.call(BasicRecordStoreLoader.java:112)
at com.hazelcast.util.executor.CompletableFutureTask.run(CompletableFutureTask.java:67)
at com.hazelcast.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:212)
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)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
Caused by: java.lang.IllegalArgumentException: Could not instantiate Collection type: org.apache.openjpa.kernel.DelegatingResultList
at org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:208)
at org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:151)
at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:146)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:119)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:104)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
... 25 more
Caused by: java.lang.InstantiationException: org.apache.openjpa.kernel.DelegatingResultList
at java.lang.Class.newInstance(Class.java:427)
at org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:204)
... 39 more
Caused by: java.lang.NoSuchMethodException: org.apache.openjpa.kernel.DelegatingResultList.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
... 40 more
It looks like the repository can't resolve the correct constructor to fill my projection. With version 1.9.2 everything works fine.
This is my projection class:
public class ShipmentStatistic implements Serializable {
private Date date;
private long totalParcelsSent;
private long totalPositionsSent;
private long totalValue;
public ShipmentStatistic(Date date) {
this.date = date;
this.totalPositionsSent = 0;
this.totalParcelsSent = 0;
this.totalValue = 0;
}
public ShipmentStatistic(Date date, long totalParcelsSent, long totalPositionsSent, long totalValue) {
this.date = date;
this.totalPositionsSent = totalPositionsSent;
this.totalParcelsSent = totalParcelsSent;
this.totalValue = totalValue;
}
public ShipmentStatistic add(ShipmentStatistic other) {
this.totalPositionsSent += other.totalPositionsSent;
this.totalParcelsSent += other.totalParcelsSent;
this.totalValue += other.totalValue;
return this;
}
// getter and setter
}
I made a random shot and tried to add a default constructor but without success.
I can not see my error especially the only change a made was the framework update. We use OpenJPA 2.2.2 as Persistence API by the way. I upgraded to the current version 2.4.1 but this had no effect either.
Any suggestions? May this be a bug in Spring Data JPA in combination with OpenJPA?
From stacktrace, it looks like openjpa is searching for the default constructor. Could you try adding default constructor explicitly in ShipmentStatistic.java?
JPA specification mandates the use of default no-argument constructor.
http://openjpa.apache.org/builds/1.2.3/apache-openjpa/docs/jpa_overview_pc.html#jpa_overview_pc_no_arg

Strange exception using Jersey with embedded Jetty

I have created an embedded Jetty application which utilizes Jersey in order to implement several RESTful services. I am using some standard code as described here in Stack Overflow as well as other websites:
public static void main(String[] args)
{
Server server = new Server(8080);
ServletContextHandler ctx = new ServletContextHandler(
ServletContextHandler.SESSIONS);
ctx.setContextPath("/");
ServletHolder holder = ctx.addServlet(
"org.glassfish.jersey.servlet.ServletContainer.class", "/*");
holder.setInitOrder(0);
holder.setInitParameter("jersey.config.server.provider.classnames",
RestfulClass.class.getCanonicalName());
server.setHandler(ctx);
try
{
server.start();
server.join();
}
catch(Exception exe)
{
exe.printStackTrace();
}
}
I've used all the recommended jar files, and several other jar files that the various blogs and sites failed to mention. When running the Jetty application, I get the following exception:
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer.class
at java.net.URLClassLoader$1.run(Unknown Source)
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 org.eclipse.jetty.util.Loader.loadClass(Loader.java:86)
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:95)
<several lines omitted for brevty>
Caused by: javax.servlet.UnavailableException: org.glassfish.jersey.servlet.ServletContainer.class
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:102)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:361)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:874)
... 11 more
It is the "UnavailableException" that I do not understand. The ServletContainer class is actually in one of the Jar files (in jersey-container-servlet-core.jar, to be precise), but for some reason it is identified as "unavailable". This is causing a class that is actually in a referenced Jar file to be "not found"!
Can anyone tell me what is causing this UnavailableException and (more importantly) how I can prevent it from being thrown?
Someone please advise...
ServletHolder holder = ctx.addServlet(
"org.glassfish.jersey.servlet.ServletContainer.class", "/*");
You are using a String for the class name. When doing this, you don't use the .class suffix. That at only when you want to get the actual Class object. You have two options
Remove the .class from the String
ServletHolder holder = ctx.addServlet(
"org.glassfish.jersey.servlet.ServletContainer", "/*");
Remove the "" (double quotes) and just use the Class object1.
ServletHolder holder = ctx.addServlet(
org.glassfish.jersey.servlet.ServletContainer.class, "/*");
1 - See addServlet(Class, String)

SWTBotShell widget not found exception

I am writing automated testing using swtBot in eclipse Juno Service Release 2.Below My code
#BeforeClass
public static void beforeClass() {
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
bot = new SWTWorkbenchBot();
try {
bot.viewByTitle("Welcome").close();
} catch (WidgetNotFoundException e) {
// ignore
}
bot.menu("Window").menu("Preferences").click();
SWTBotShell shell = bot.shell("Preferences");
shell.activate();
SWTBotView view = bot.viewByTitle("Preferences");
bot.tree().expandNode("General").select("Workspace");
SWTBotCheckBox buildAuto = bot.checkBox("Build automatically");
if (buildAuto != null && buildAuto.isChecked())
buildAuto.click();
bot.button("Apply").click();
bot.tree().expandNode("General").select("Perspectives");
SWTBotRadio radio = bot.radio("Always open");
if (radio != null && !radio.isSelected())
radio.click();
bot.button("OK").click();
}
I am getting following exception:
org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException:
Could not find shell matching: with text 'Preferences' at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetAppears(SWTBotFactory.java:387)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.shells(SWTBotFactory.java:114)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.shell(SWTBotFactory.java:104)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.shell(SWTBotFactory.java:95)
at com.packtpub.e4.junit.plugin.UITest.beforeClass(UITest.java:49)
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)
Don't put your test code in the method annotated with #BeforeClass. At this point the test class isn't even instantiated. Cf. this answer here for an explanation of the annotations.
If you have moved the relevant code to a #Test annotated method and the code still doesn't work, check spelling, etc.

JavaFX 8 TreeTableColumn setText ClassCastException

My situation is: I have a TreeTableView that has a TreeTableColumn. The Columns head text will be changed on runtime.
When I change the text through setText or textProperty().bind(...) before I show the stage, all works as expectet.
But if i change the text after showing the stage, I get a massive java.lang.ClassCastException.
I have tried this with Java SE 1.8.0 b132 and with Java 1.8.0_20 b17 EA.
Is there a workaround for this except recreating the TreeTableColumn?
My Sample Code:
TreeTableView<String> ttv = new TreeTableView<>();
TreeTableColumn<String, String> ttc = new TreeTableColumn<>();
ttc.setText("Hello");
ttv.getColumns().add(ttc);
ttv.setOnMouseClicked(new EventHandler<MouseEvent>() {
#Override
public void handle(MouseEvent t) {
ttc.setText("World");
}
});
Scene scene = new Scene(ttv);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
The Exception(after clicking on TreeTableView):
Exception in Application start method
java.lang.reflect.InvocationTargetException
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:483)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
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:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassCastException: javafx.scene.control.TreeTableColumn cannot be cast to javafx.scene.control.TableColumn
at com.sun.javafx.scene.control.skin.TableHeaderRow$10.invalidated(TableHeaderRow.java:277)
at javafx.beans.WeakInvalidationListener.invalidated(WeakInvalidationListener.java:83)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:339)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:103)
at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:110)
at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:143)
at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:49)
at javafx.scene.control.TableColumnBase.setText(TableColumnBase.java:189)
at com.kalasch.test.TreeTableTest.start(TreeTableTest.java:39)
at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837)
at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
... 1 more
Exception running application com.kalasch.test.TreeTableTest
UPDATE 08/04/2014:
Submitted Bug report to javafx-jira:
https://bugs.openjdk.java.net/browse/JDK-8095931
UPDATE 08/05/2014:
Fix Version will be: 8u40
#thatjavaguy09 fix does work.
Greetings, Kalsch
Looking through the stack trace, it seems the issue is that your TreeTableColumn is trying to be casted into a TableColumn which is what is throwing the ClassCastException (since that is in fact an invalid cast).
It seems the call is coming from TableHeaderRow.invalidated. Looking at this method, I see where the cast is coming from.
private final InvalidationListener columnTextListener = new InvalidationListener() {
#Override public void invalidated(Observable observable) {
**TableColumn<?,?> column = (TableColumn<?,?>) ((StringProperty)observable).getBean();**
CheckMenuItem menuItem = columnMenuItems.get(column);
if (menuItem != null) {
menuItem.setText(getText(column.getText(), column));
}
}
};
This might be a bug with the JDK. I believe the correct cast should be to a TableColumnBase. I would submit this to their bug tracker:
https://javafx-jira.kenai.com/secure/Dashboard.jspa

Getting exception in initializing log4j files

When trying to initialize hibernate from configuration file, I get NullPointerException ..
Root cause is shown as
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
I have all the logging related jars and properties files in class path.
My hibernate initialization code is :
private static final SessionFactory sessionFactory;
private static final ThreadLocal<Session> hibernateSession=new ThreadLocal<Session>();
static{
try{
sessionFactory=new Configuration().configure("llhs_hibernate.cfg.xml").buildSessionFactory();
System.out.println("done");
}catch (HibernateException he){
he.printStackTrace();
throw new ExceptionInInitializerError(he);
}catch (Exception e){
e.printStackTrace();
throw new ExceptionInInitializerError(e);
}
Simple java classes does not complain about log related error, for example following java class does not complain ..It properly initializes and writes to logs folder
public class MetadataService implements Serializable {
private static final Logger logger = LogManager.getLogger(MetadataService.class);
private static final long serialVersionUID = 1L;
public MetaData getMetaData(){
logger.info("Info");
try {
//some code here
} catch (Exception e1) {
logger.error("Error");
}
return metaData;
}
Since it works for stand alone Java class and not for class doing hibernate initialization --I am more perplexed ..Any pointer? Detailed trace
java.lang.ExceptionInInitializerError
at com.llhs.persistence.impl.db.hibernate.utils.HibernateUtils.<clinit>(HibernateUtils.java:17)
at com.llhs.persistence.impl.hibernate.HibernateDbImplTest.addStudentDetails(HibernateDbImplTest.java:61)
at com.llhs.persistence.impl.hibernate.HibernateDbImplTest.testAddFindStudentDetails(HibernateDbImplTest.java:128)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
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:292)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
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.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException(Caused by java.lang.NullPointerException))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:126)
... 26 more
Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 30 more
Caused by: java.lang.NullPointerException
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
... 31 more
There is alignment issue while posting trace, sorry abt that, not able to correct that one..
Finally, I was able to solve this. As later guessed it turned out to be an eclipse configuration. In eclipse 3.7, code name indigo, the way libs were being added to the classpath caused this issue ..
First way:
Debug Configurations->classpath->bootstarp entries, if Add libs added by selecting "Add Jars" options, THIS DOES NOT Work.
Correct WAY:
Define a classpath variable from window->preferences->java->buildpath->classpath variable, say HIBERNATE_LIBS and point it ti libs folder
Now, got to Debug Configurations->classpath->bootstarp entries, select "Advanced option" and add the class path variable. This FIXED the issue.
I guess this is specific to 3.7, as I upgraded the eclipse version and started getting this issue, First way still works in eclipse 3.2