Java EE Glassfish - NullPointerException because "dcs" not found - java

Whent trying to run asadmin im getting this error:
/opt/glassfish5/bin $ ./asadmin start-domain
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.glassfish.hk2.api.DynamicConfigurationService.createDynamicConfiguration()" because "dcs" is null
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.initializeServiceLocator(AbstractModulesRegistryImpl.java:152)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newServiceLocator(AbstractModulesRegistryImpl.java:144)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:218)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:224)
at com.sun.enterprise.module.single.StaticModulesRegistry.createServiceLocator(StaticModulesRegistry.java:88)
at com.sun.enterprise.admin.cli.CLIContainer.getServiceLocator(CLIContainer.java:217)
at com.sun.enterprise.admin.cli.CLIContainer.getLocalCommand(CLIContainer.java:255)
at com.sun.enterprise.admin.cli.CLICommand.getCommand(CLICommand.java:231)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:371)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:306)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:57)
My Java JDK:
$ readlink -f $(which java)
/usr/lib/jvm/java-17-openjdk-amd64/bin/java
I've tried adding AS_JAVA="/usr/lib/jvm/java-17-openjdk-amd64" to the asenv.conf file but the error persists. Any help?
Oh yeah, and it doesn't matter if im in /opt/glassfish5/glassfish/bin or /opt/glassfish5/bin the error is the same

GlassFish 5 doesn’t support JDK 17, but the latest versions of GlassFish 6 do. If possible, try to upgrade to GlassFish 6.2.4, which is the current version at the time of writing.

Okay, you need to use Java SDK 1.8 only.

Related

Working with MCRTsim simulator on a LINUX system

I am trying to use the MCRTsim simulator in my research work. As documented in https://resl.csie.nptu.edu.tw/dokuwiki/doku.php?id=guide, I run this command java -jar MCRTsim/dist/MCRTsim2.8.jar in specified directory, but the simulation window did not pop up. Instead, I got following exceptions:
Exception in thread "main" java.lang.NullPointerException
at java.base/java.io.Reader.<init>(Reader.java:167)
at java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:109)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:2440)
at org.apache.commons.io.IOUtils.toString(IOUtils.java:1084)
at org.apache.commons.io.IOUtils.toString(IOUtils.java:1110)
at userInterface.frontEnd.SimulationViewer.setComboBox(SimulationViewer.java:529)
at userInterface.frontEnd.SimulationViewer.initialize(SimulationViewer.java:359)
at userInterface.frontEnd.SimulationViewer.<init>(SimulationViewer.java:97)
at userInterface.UserInterface.initialize(UserInterface.java:45)
at userInterface.UserInterface.<init>(UserInterface.java:31)
at mcrtsim.MCRTsim.main(MCRTsim.java:55)
I am using Ubuntu system and JDK 11. I have not used Java much. I am not able to understand what this error is saying. Would anyone please help me with this?
Finally, I got the solution to this problem. I think this simulator is compatible with openjdk-8. So, I removed openjdk-11 from my system and installed openjdk-8.
After installing openjdk-8, I run the command java -jar dist/MCRTsim2.8.jar . This time I got the following error:
Exception in thread "main" java.awt.AWTError: Assistive Technology not
found: org.GNOME.Accessibility.AtkWrapper
at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:807)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:886)
at java.awt.Window.getToolkit(Window.java:1358)
at java.awt.Window.init(Window.java:506)
at java.awt.Window.<init>(Window.java:537)
at java.awt.Frame.<init>(Frame.java:420)
at javax.swing.JFrame.<init>(JFrame.java:233)
at userInterface.UserInterface.initialize(UserInterface.java:37)
at userInterface.UserInterface.<init>(UserInterface.java:31)
at mcrtsim.MCRTsim.main(MCRTsim.java:55)
After that, I followed this blog https://askubuntu.com/questions/695560/assistive-technology-not-found-awterror to rectify the above error.
I just commented this line #assistive_technologies=org.GNOME.Accessibility.AtkWrapper in /etc/java-8-openjdk/accessibility.properties file.
And, it started working.

Play framework runtime error on OS X

I'm trying to install Play 2.2 on a fresh MacBook Pro with Java 7. Scala has already been installed. Here's what I get:
Okihara-MacBook-Pro:Extensions okihara$ play help
Exception in thread "main" java.lang.IncompatibleClassChangeError: Expected static method scala.Array$.unapplySeq(Ljava/lang/Object;)Lscala/Option;
at xsbt.boot.Boot$.main(Boot.scala:14)
at xsbt.boot.Boot.main(Boot.scala)
I saw Issue getting SBT to work on Mac OS X but there's no conclusive answer. I tried running the Scala REPL and that seems to work well too.
I only used Play on Linux before, this is my first attempt to install it on OS X.
Where should I look?
EDIT
As done in the other SO question, I get the above message with the scala-* jars in the Library/Java/Extensions folder. If I remove them, I get:
Okihara-MacBook-Pro:Extensions okihara$ play
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.ivy.core.RelativeUrlResolver.$init$$6ce060cb(Lscala/collection/mutable/HashTable$HashUtils;)V
at scala.collection.mutable.HashMap.<init>(HashMap.scala:39)
at scala.collection.mutable.HashMap.<init>(HashMap.scala:55)
at scala.collection.mutable.Map$.empty$7fee4dfc(Map.scala:68)
at scala.collection.generic.MutableMapFactory.newBuilder(MutableMapFactory.scala:29)
at scala.collection.generic.GenMapFactory.apply$41cb962a(GenMapFactory.scala:47)
at scala.sys.SystemProperties$.propertyHelp$lzycompute(SystemProperties.scala:62)
at scala.sys.SystemProperties$.noTraceSupression$lzycompute(SystemProperties.scala:80)
at scala.sys.SystemProperties$.noTraceSupression(SystemProperties.scala:80)
at scala.util.control.NoStackTrace$.<init>(NoStackTrace.scala:31)
at scala.util.control.NoStackTrace$.<clinit>(NoStackTrace.scala)
at scala.util.control.BreakControl.fillInStackTrace(Breaks.scala:93)
at java.lang.Throwable.<init>(Throwable.java:250)
at scala.util.control.BreakControl.<init>(Breaks.scala:93)
at scala.util.control.Breaks.<init>(Breaks.scala:28)
at scala.collection.Traversable$.<init>(Traversable.scala:96)
at scala.collection.Traversable$.<clinit>(Traversable.scala)
at scala.package$.<init>(package.scala:46)
at scala.package$.<clinit>(package.scala)
at scala.Predef$.<init>(Predef.scala:90)
at scala.Predef$.<clinit>(Predef.scala)
at scala.Array$.unapplySeq(Array.scala:443)
at xsbt.boot.Boot$.main(Boot.scala:14)
at xsbt.boot.Boot.main(Boot.scala)
Removing ivy-*.jar from /Library/Java/Extensions solved the
issue.
FWIW, I also have no scala*.jar in the extensions folder and I'm running Java 1.7.0_21. Play is symlinked as advised. HTH.

getting NoSuchMethodError for getNamespaceContext() when running with jdk 1.5 but not with 1.6

I'm running a program written in java, deployed on an Oracle application Server, running 1.5 JVM.following is the stack trace:
Exception in thread "main" java.lang.NoSuchMethodError: com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.getNamespaceContext()Lcom/sun/org/apache/xerces/internal/xni/NamespaceContext;
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.<init>(XMLStreamReaderImpl.java:99)
at com.sun.xml.internal.stream.XMLInputFactoryImpl.getXMLStreamReaderImpl(XMLInputFactoryImpl.java:264)
at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader(XMLInputFactoryImpl.java:136)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory$Zephyr.newInstance(XMLStreamReaderFactory.java:251)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory.<clinit>(XMLStreamReaderFactory.java:84)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:805)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:262)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:129)
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:265)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:228)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:176)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)
at javax.xml.ws.Service.<init>(Service.java:56)
at com.earthport.bind.MerchantAPIService.<init>(MerchantAPIService.java:50)
at com.earthport.client.service.stub.MerchantAPIClientImpl$1CustomMerchantAPIService. <init>(MerchantAPIClientImpl.java:107)
at com.earthport.client.service.stub.MerchantAPIClientImpl.createMerchantAPIService(MerchantAPI ClientImpl.java:111)
at com.earthport.client.service.stub.MerchantAPIClientImpl.<init> (MerchantAPIClientImpl.java:84)
at com.earthport.client.service.ServiceProxyFactoryImpl.createServiceProxy(ServiceProxyFactoryI mpl.java:25)
at utils.AmxEPAccCre.<init>(AmxEPAccCre.java:79)
at utils.WService.<init>(WService.java:95)
at utils.WService.main(WService.java:795)
Process exited.
If i run the exact same program with jdk 1.6 though, the program runs perfectly. Is this a specific issue with a library reference? anyone see this exception before?
cheers.
I bet you are having a conflict between the Xerces implementation that comes with your app or the Oracle AppServer, and the one that comes with the JDK.
It works with the one that comes in JDK6, but is not compatible with the one in JDK 5.

sqlj runtime error

Could somebody tell me what is causing this error when using sqlj in Oracle 11g. I am using Solaris 8 and I have tried changing JDK versions (tried both 1.5 and 1.6).
bash-2.03$ ~/11.2.0.2/bin/sqlj -compile=false -classpath '~/11.2.0.2/sqlj/lib/translator.jar:~/11.2.0.2/sqlj/lib/runtime12.jar'
Exception in thread "main" java.lang.NoClassDefFoundError: sqlj/runtime/profile/DefaultLoader
at sqlj.tools.Sqlj.resetStaticVariables(Sqlj.java:2905)
at sqlj.tools.Sqlj.statusMain(Sqlj.java:189)
at sqlj.tools.Sqlj.main(Sqlj.java:150)
The same command works fine with Oracle 10g:
bash-2.03$ ~/10.2.0.3/bin/sqlj -compile=false -classpath '~/10.2.0.3/sqlj/lib/translator.jar::~/10.2.0.3/sqlj/lib/runtime12.jar'
Error: This SQLJ runtime must be run under an Oracle JDBC driver.
Thanks,
Raj
According to this site the runtime12.jar should contain this class - so the question is - did you try running ls ~/11.2.0.2/sqlj/lib/runtime12.jar to verify the path exists?

Hibernate fails with NullPointerException in EntityTuplizerFactory.constructTuplizer? Why?

I have a problem when I try to instantiate Hibernate and connect with a MySQL database (see error message below).
Curiously enough the connection works fine using the exact same hibernate.cfg.xml file when running Junit tests but it refuses to work when run from Tomcat...
I am starting to run out of ideas.
Any clues or tip where to look?
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.DynamicMapEntityTuplizer]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:110)
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:135)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.(EntityEntityModeToTuplizerMapping.java:69)
at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:323)
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:456)
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:131)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:267)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at se.fmt.atlantism.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:16)
... 38 more
Caused by: java.lang.NullPointerException
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:107)
... 47 more
I'm writing this for future Googlers and reference.
I've done some more research and the root source of the problem is still not known. However the following article throw me on the right track.
http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/
It seems like the Tomcat (version 6 at least) packages available in Ubuntu (and Debian) are not working correctly. Instead I installed Tomcat using the following guide:
http://www.ctrip.ufl.edu/tomcat6-debian-lenny-howto
While this might not be the premium choice of installation it seems necessary to get Tomcat version 6 running without problems on Ubuntu and/or Debian Lenny.
In my case, this error was resolved by switching the <dependency/> order in my pom.xml. When hibernate (3.2.7.ga) comes before hibernate-annotations (3.4.0.GA) this error occurs. The other way around, it works fine. This is the case even with scope=compile.
I would guess that you need to tweak your classpath, except that (assuming you've dropped both jars in WEB-INF/lib) it should alpha-sort in the correct order. But maybe this will give someone a hint on how to move forward.
In my case it was a simple mistake - the config file *.hbm.xml had a property that the mapped object didnt have! I also heard of cases of that error apearing when you misspell a get/set function - very similar to my case.
I was facing the same problem. It went away after I downloaded "javassist.jar" and put it in the classpath: http://www.java2s.com/Code/Jar/JKL/Downloadjavassistjar.htm
This is how the Tomcat daemon process looks:
root 2605 0.0 0.0 16584 376 ? Ss 15:39 0:00
/usr/bin/jsvc -user tomcat6
-cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat6/bin/bootstrap.jar
-outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat6.pid
-Djava.awt.headless=true -Xmx128M
-Djava.endorsed.dirs=/usr/share/tomcat6/endorsed
-Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6
-Djava.io.tmpdir=/tmp/tomcat6-temp -Djava.security.manager
-Djava.security.policy=/var/lib/tomcat6/work/catalina.policy
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties
org.apache.catalina.startup.Bootstrap
This is how the Tomcat process looks when run from within Eclipse using the Sysdeo Tomcat launcher plugin:
(this one actually works)
jzaruba 2655 19.7 4.5 358304 46152 ? Sl 15:43 0:01
/usr/lib/jvm/java-6-sun-1.6.0.15/bin/java
-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:37377
-Dcatalina.home=/usr/share/tomcat6
-Djava.endorsed.dirs=/usr/share/tomcat6/endorsed
-Dcatalina.base=/var/lib/tomcat6 -Djava.io.tmpdir=/var/lib/tomcat6/temp
-Dfile.encoding=UTF-8 -classpath
/usr/share/tomcat6/bin/bootstrap.jar:/usr/lib/jvm/java-6-sun-1.6.0.15/lib/tools.jar
org.apache.catalina.startup.Bootstrap start
The working one (Eclipse launched) is run using java-6-sun-1.6.0.15, I'm Windows user so I don't know how to tell which JRE is used for /usr/lib/jsvc (looking at it though), but my guess would be it is some OpenJDK... Could this be the difference?
update: jsvc probably uses the same JRE Sysdeo Tomcat launcher does

Categories

Resources