9 Jul 2021

Android Studio - Flutter / Dart plugin not installed

Problem: Errors of Flutter / Dart plugins not installed were shown even though they were already installed.
[!] Android Studio (version 4.2)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.

Cause: The Android Studio was upgraded and the symbolic link was not updated.

Solution: Update the symbolic link:

ln -s ~/Library/Application\ Support/Google/AndroidStudio4.2/plugins ~/Library/Application\ Support/AndroidStudio4.2

29 May 2021

Python - Module not found

Problem: File "/Users/testuser/Documents/Python/test.py", line 2, in import matplotlib.pyplot as plt ModuleNotFoundError: No module named 'matplotlib

Cause: matplotlib is not installed.

Solution: python3 -m pip install matplotlib

13 May 2013

Unsupported major.minor version 51.0

Problem: Unsupported major.minor version 51.0.

Cause: The compiled application is not compatible with the JDK version of the application server.

Solution: Compile the source code again using the correct JDK version as of the application server.

The reported major numbers are:

J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45

8 May 2013

Eclipse is running in a JRE, but a JDK is required

Problem: Eclipse is running in a JRE, but a JDK is required.

Cause:

  1. The ServiceReference can be null if no HelloService is registered, resulting in NullPointerException on line 6.
  2. The HelloService object cannot be got, due to missing permissions, possible timing issues if the HelloService unregisters between lines 5 and 6, causing NullPointerException on line 6.
  3. The HelloService may have become unusable, resulting in any RuntimeException subclass, most likely IllegalStateException on line 6.

Solution: Add the following at the beginning of eclipse.ini
-vm C:\Program Files\Java\jdk1.6.0_31\jre\bin\server

-vm C:\Program Files\Java\jdk1.6.0_31\jre\bin\server -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -Xms40m -Xmx512m -XX:MaxPermSize=256m

Failed to lazily initialize a collection of role: could not initialize proxy - no Session

Problem: When lazy loading in used in Hibernate, it fails to initialize a collection of role.

failed to lazily initialize a collection of role: could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Session

Cause: The session was closed, so it can't load the actual contents of the collection.

Solution: add an @Transactional annotation to it, or the entry point from which it is called.

26 Mar 2013

How to fix the PermGen Space (Out of Memory) Error in Eclipse

Problem: PermGen Space (Out of Memory)

Cause: PermGen is the permanent generation of objects in the VM (Class names, internalized strings, objects that will never get garbage-collected).
The memory limit is too small that the Eclipse quickly runs out of memory, causing the aforesaid error.

Solution: Increase the permanent generation space available to Eclipse by adding the following in eclipse.ini
-XX:MaxPermSize=256m

-vm C:\Program Files\Java\jdk1.7.0_15\jre\bin\server -startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m -XX:MaxPermSize=256m

21 Mar 2013

java.lang.NullPointerException: A null service reference is not allowed.

Problem: When trying to get a service from the BundleContext, NullPointerException is found.

public class Activator implements BundleActivator { ServiceReference helloServiceReference; public void start(BundleContext context) throws Exception { System.out.println("Hello World!!"); helloServiceReference= context.getServiceReference(HelloService.class.getName()); HelloService helloService =(HelloService)context.getService(helloServiceReference); System.out.println(helloService.sayHello()); } public void stop(BundleContext context) throws Exception { System.out.println("Goodbye World!!"); context.ungetService(helloServiceReference); } } org.osgi.framework.BundleException: Exception in com.javaworld.sample.helloworld.Activator.start() of bundle com.javaworld.sample.HelloWorld. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:389) at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1131) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544) at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) Caused by: java.lang.NullPointerException: A null service reference is not allowed. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService(BundleContextImpl.java:586) at com.javaworld.sample.helloworld.Activator.start(Activator.java:20) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711) at java.security.AccessController.doPrivileged(AccessController.java:251) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702) ... 12 more

Cause:

  1. The ServiceReference can be null if no HelloService is registered, resulting in NullPointerException on line 6.
  2. The HelloService object cannot be got, due to missing permissions, possible timing issues if the HelloService unregisters between lines 5 and 6, causing NullPointerException on line 6.
  3. The HelloService may have become unusable, resulting in any RuntimeException subclass, most likely IllegalStateException on line 6.

Solution: Use ServiceTracker instead.

References

  1. OSGi Service