I experienced an odd behavior with a java desktop application that uses Toplink essentials as persistence provider.
I have a single directory containing all I need for my application: a jar, a lib folder and a JavaDB database. The whole directory is self-contained (I copied it several times without problems, even between different computers).
Today I wanted to copy once more, but my target folder contained a german Umlaut ü (html: ü).
Starting my application failed, with an exception that made it hard to find the reason why (see below).
Of course I know the old naming conventions, but I thought we already left that behind. So my question is, if there is a way to make it run independent of directory naming. It's important since I want to give the application to clients and have only little influence on install dirs.
System: Windows 7, JavaDB 10.5.3
Thanks in advance for your help!
SCHWERWIEGEND: Application class jlabps.JLabPSApp failed to launch
javax.persistence.PersistenceException: No Persistence provider for EntityManage
r named JLAPS_EMB: The following providers:
oracle.toplink.essentials.PersistenceProvider
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
Returned null to createEntityManagerFactory.
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:154)
at jlabps.JLabPSView.initComponents(JLabPSView.java:401)
at jlabps.JLabPSView.<init>(JLabPSView.java:47)
at jlabps.JLabPSApp.startup(JLabPSApp.java:71)
at org.jdesktop.application.Application$1.run(Application.java:171)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-0" java.lang.Error: Application class jlabps
.JLabPSApp failed to launch
at org.jdesktop.application.Application$1.run(Application.java:177)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: javax.persistence.PersistenceException: No Persistence provider for E
ntityManager named JLAPS_EMB: The following providers:
oracle.toplink.essentials.PersistenceProvider
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
Returned null to createEntityManagerFactory.
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:154)
at jlabps.JLabPSView.initComponents(JLabPSView.java:401)
at jlabps.JLabPSView.<init>(JLabPSView.java:47)
at jlabps.JLabPSApp.startup(JLabPSApp.java:71)
at org.jdesktop.application.Application$1.run(Application.java:171)
... 14 more
Odd. What JVM are you using?
Ensure you have the latest TopLink Essentials patch, I remember an issue with spaces, but not Umlats.
You could also try upgrading to EclipseLink and see if the same issue occurs, if it does please log a bug.
Related
So I have a problem with exporting my eclipse project.
The project works perfectly when running it inside eclipse, but when exporting it, it doesn't do anything.
I can't post a third link since I have less than 10 reputation, but in there I chose my "main" as launch configuration, and "package required libraries.
When I double click the runnable Jar nothing happens, nothing pops up.. No message nothing.
When I run it using java -jar smergy.jar I receive
`C:\Users\Jean>java -jar Smergy.jar
java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at smergy.SmergyMain.<init>(SmergyMain.java:162)
at smergy.SmergyMain$1.run(SmergyMain.java:50)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP
rivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)`
Most likely the images are not being packaged into the jar. Or they are not being loaded.
One way to deal with loading resources is using the Toolkit like this:
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/package1/package2/dump.jpg")));
I am new to optaPlanner and am trying to better learn how to use it by changing around the dinner party example to solve a different type of problem. I added a new score rule called sameSleepingPreference, which uses a new enum I created called sleepingPreference that is a property of the guest. People who have the same sleeping preference are put next to each other.
rule "sameSleepingPreference"
when
$leftDesignation : SeatDesignation($leftGuest : guest)
$rightDesignation : SeatDesignation(isRightOf($leftDesignation), $rightGuest : guest)
eval($leftGuest.sleepingPreference.equals($rightGuest.sleepingPreference))
then
scoreHolder.addConstraintMatch(kcontext, +1);
end
When I try to run optaPlanner using a data sheet of only four people, the example works fine. However, I made a longer list of 144 people by changing around one of the original data sheets from the dinner party example, and it gives me this error:
2015-07-23 10:41:59,414 [AWT-EventQueue-0] INFO Opened: data\dinnerparty\unsolved\hannahWeddingTest.xml
2015-07-23 10:42:01,012 [SwingWorker-pool-4-thread-1] INFO Solving started: time spent (97), best score (uninitialized/-14400), environment mode (REPRODUCIBLE), random (JDK with seed 0).
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Solving failed.
at org.optaplanner.examples.common.swingui.SolverAndPersistenceFrame$SolveWorker.done(SolverAndPersistenceFrame.java:297)
at javax.swing.SwingWorker$5.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(Unknown Source)
at sun.swing.AccumulativeRunnable.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(Unknown Source)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$300(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.RuntimeException: org.optaplanner.examples.dinnerparty.solver.Rule_sameSleepingPreference1438171934Eval0Invoker#a59a25b3 : java.lang.NullPointerException
at org.drools.core.rule.EvalCondition.isAllowed(EvalCondition.java:123)
at org.drools.core.phreak.PhreakEvalNode.doLeftInserts(PhreakEvalNode.java:55)
at org.drools.core.phreak.PhreakEvalNode.doNode(PhreakEvalNode.java:39)
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:342)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:231)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:106)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1016)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1302)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1289)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1262)
at org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.calculateScore(DroolsScoreDirector.java:87)
at org.optaplanner.examples.dinnerparty.solver.solution.initializer.DinnerPartySolutionInitializer.initializeSeatDesignationList(DinnerPartySolutionInitializer.java:69)
at org.optaplanner.examples.dinnerparty.solver.solution.initializer.DinnerPartySolutionInitializer.changeWorkingSolution(DinnerPartySolutionInitializer.java:41)
at org.optaplanner.core.impl.phase.custom.DefaultCustomPhase.doStep(DefaultCustomPhase.java:78)
at org.optaplanner.core.impl.phase.custom.DefaultCustomPhase.solve(DefaultCustomPhase.java:60)
at org.optaplanner.core.impl.solver.DefaultSolver.runPhases(DefaultSolver.java:213)
at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:176)
at org.optaplanner.examples.common.business.SolutionBusiness.solve(SolutionBusiness.java:302)
at org.optaplanner.examples.common.swingui.SolverAndPersistenceFrame$SolveWorker.doInBackground(SolverAndPersistenceFrame.java:286)
at org.optaplanner.examples.common.swingui.SolverAndPersistenceFrame$SolveWorker.doInBackground(SolverAndPersistenceFrame.java:1)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.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)
Caused by: java.lang.NullPointerException
at org.optaplanner.examples.dinnerparty.solver.Rule_sameSleepingPreference1438171934.eval0(Rule_sameSleepingPreference1438171934.java:8)
at org.optaplanner.examples.dinnerparty.solver.Rule_sameSleepingPreference1438171934Eval0InvokerGenerated.evaluate(Unknown Source)
at org.optaplanner.examples.dinnerparty.solver.Rule_sameSleepingPreference1438171934Eval0Invoker.evaluate(Unknown Source)
at org.drools.core.rule.EvalCondition.isAllowed(EvalCondition.java:118)
... 27 more
Is my example of 144 people just impossible to solve, or is there a different problem? I have tried making the sleeping preference rule add points and subtract points from the score, (I am using simple score) but both cause the program to fail.
This is the recommended way to write that rule, as "eval" is deprecated and drools =='s turn into equal calls:
rule "sameSleepingPreference"
when
$leftDesignation : SeatDesignation($leftGuest : guest)
$rightDesignation : SeatDesignation(isRightOf($leftDesignation), $leftGuest.sleepingPreference == guest.sleepingPreference)
then
scoreHolder.addConstraintMatch(kcontext, +1);
end
I have created a java application to connect to a MySQL database.
Once through the program install creator I created an .exe .
This executable runs, and the first form is login. When he tries to access the database to confirm the details of login gives this error.
java.lang.NullPointerException
Someone can help me solve this? The path is correct, because if run the .jar the application runs normally.
I apologize for the inconvenience.
Only have this to try explain better my question :S
I'm so sorry... I'm running a executable version from my java aplication.
java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at sensores.forms.jTMainMenu.initComponents(jTMainMenu.java:786)
at sensores.forms.jTMainMenu.<init>(jTMainMenu.java:57)
at sensores.forms.jTLoginConsulta.jBLoginActionPerformed(jTLoginConsulta.java:351)
at sensores.forms.jTLoginConsulta.access$000(jTLoginConsulta.java:59)
at sensores.forms.jTLoginConsulta$1.actionPerformed(jTLoginConsulta.java:110)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
You have an error in this class/line
jTMainMenu.java:786
Seems you tried to load a image in this point of your code, i don't know how you are generating a executable from your java code but this may be the source of the problem. Try to put this image outside of your executable/jar and use a relative path to load the image, like './my_image'.
You also have to take care if your user make a link to your executable, in this case a relative path can't resolve your problem. A simple way to solve this in java is get the source code location.
getClass().getProtectionDomain().getCodeSource().getLocation();
And use this location to find your image.
Please check the line number from the Stacktrace where you are getting the NullPointerException.
it is straight forward to find out the null pointer exception. Object is null or not initialize on which you are calling the method
try{
// add database connection statement here
}catch(Exception e){
e.printstacktrace();
}
// run the program from the command prompt.
// you can print the e.printstacktrace() on the popup as well to get the exception details
If you make a .jar, move that jar somewhere separate from the IDE (i.e. their classpaths), and start the jar, do you receive a NullPointerException?
This can be caused by resources, getResource, getResourceAsStreem, getBundle, as they are not case-sensitive in the Windows file system, but are case sensitive in a jar(and under Linux/MacOS).
(Also File cannot be used for jar resources.)
You might look in the jar with 7zip or so to inspect all paths.
I think it is not getting image icon in defined path
at javax.swing.ImageIcon.<init>(Unknown Source)
I have the following two guesses:
There is a problem with your path or classpath and loading the resource
The lines
at sensores.forms.jTMainMenu.initComponents(jTMainMenu.java:786)
at sensores.forms.jTMainMenu.(jTMainMenu.java:57)
indicate that something is initialized. Usually Swing/AWT uses multiple threads, so you might have a race condition here: The reference to the resource is handed to ImageIcon in your ìnitComponents method before another thread could set the value to something non-null. Try using proper synchronization/locking.
I want to profile a Java EE application runs on JBoss 4. I use Ubuntu . Java 1.5. JProfiler 8.0.1. Server is Jboss 4. Once I set the host as localhost and try to profile,(New Session -> Attach -> Attach to profile JVM(Local or remote) ) JProfiler says, "Could not connect to localhost:8849. Please make sure that the remote address is correct ". But in the terminal, it shows the JBoss starting and I can access the web applications as well. I want to trace all creating java Ojbects and their sizes. How can I solve this issue ?
EDIT: The error log file of JProfiler shows.
sun.awt.X11.XException: Cannot write XdndAware property
at sun.awt.X11.XDnDDropTargetProtocol.registerDropTarget(Unknown Source)
at sun.awt.X11.XDropTargetRegistry.registerDropSite(Unknown Source)
at sun.awt.X11.XWindowPeer.addDropTarget(Unknown Source)
at sun.awt.X11.XComponentPeer.addDropTarget(Unknown Source)
at java.awt.dnd.DropTarget.addNotify(Unknown Source)
at java.awt.Component.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at com.ejt.framework.gui.aq.b(ejt:290)
at com.ejt.framework.wizard.o.b(ejt:43)
at com.ejt.framework.wizard.o.<init>(ejt:18)
at com.ejt.framework.wizard.g.b(ejt:125)
at com.jprofiler.frontend.d.a.p.actionPerformed(ejt:29)
at com.jprofiler.frontend.g.g.l(ejt:63)
at com.jprofiler.frontend.g.g.a(ejt:17)
at com.jprofiler.frontend.g.h.run(ejt:56)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Probably JBoss is not profiled, i.e. the profiling agent is not loaded.
You have to use the integration wizard to modify the JBoss start script.
Invoke
Session->Integration wizards->New Server Integration
select JBoss 4.x and follow the steps in the wizard.
We've been struggling here at the office with a seemingly unsolvable bug in one of our (massive) applets, this one being a Java simulation of MS Word, for exam purposes. The exception seems to stem from swing itself, and I'm not sure how I would go about solving it. Here's what happens:
The applet loads with a loading screen till 100%. After this, the components are all displayed in a broken way as if some of their paint methods are not being called correctly, hovering the cursor over some buttons etc. does make them flash/display for a while. And an exception is printed to the console every second or so. (See below) This bug does NOT occur within Eclipse, only in the browser.
Summary: Applet components all get built without exceptions, but on every "paint" call of a some component (I assume), it visually bugs out and the following is printed every second:
Exception in thread "AWT-EventQueue-11" java.lang.ClassCastException: javax.swing.JLabel cannot be cast to javax.swing.text.JTextComponent
at javax.swing.text.html.EditableView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.ParagraphView.paint(Unknown Source)
at javax.swing.text.html.ParagraphView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.plaf.basic.BasicHTML$Renderer.paint(Unknown Source)
at javax.swing.plaf.basic.BasicLabelUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager$3.run(Unknown Source)
at javax.swing.RepaintManager$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$1000(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Help would be greatly appreciated, as this is driving me nuts, I can't seem to find what triggers this, as the code is from a previous developer, and an utter mess. I have tried different JDK versions.
Thanx.
java.lang.ClassCastException: javax.swing.JLabel cannot be cast to
javax.swing.text.JTextComponent
see components tree for JTextComponents, there isn't JLabel, JLabel isn't member of JTextComponents
safest could be to test if (Xxx instanceof JTextComponent) before any casting
Found a fix to my problem. The target Java version was wrong. In the build.xml file, there were the following lines:
<property name="target" value="1.5" />
<property name="source" value="1.5" />
Changed those to 1.7, and voila! This seems to have been a Swing bug that has been fixed in the newer versions of Java.
I've noticed that this problem can occur when a JLabel with tags around the content contains nested tags. The solution is to escape the angle brackets on the