Codename One - Play a sound - codenameone

The following code works fine in the Simulator, I hear the audio:
try {
Media m = MediaManager.createMedia((Display.getInstance().getResourceAsStream(getClass(), "/notification_sound_bell.mp3")), "audio/mpeg");
m.play();
} catch (IOException err) {
Log.e(err);
}
But it doesn't work at all on real Android devices. What's wrong?
On the generated apk, the "notification_sound_bell.mp3" file is placed in /res/raw folder.
On an Android 4.x device I get:
[EDT] 0:0:0,118 - Codename One revisions: 3b20edadec808867afc2b19774268b66890616ad
[EDT] 0:0:0,129 - Exception: java.lang.NullPointerException - null
java.lang.NullPointerException at
com.codename1.impl.android.AndroidImplementation.createMedia(AndroidImplementation.java:2802)
at com.codename1.ui.Display.createMedia(Display.java:2998) at
com.codename1.media.MediaManager.createMedia(MediaManager.java:125)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:94)
at
it.galgani.app.fiveMinutesAlert.MyApplication.start(MyApplication.java:66)
at
it.galgani.app.fiveMinutesAlert.MyApplicationStub.run(MyApplicationStub.java:140)
at com.codename1.ui.Display.processSerialCalls(Display.java:1116) at
com.codename1.ui.Display.mainEDTLoop(Display.java:911) at
com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at
com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:856) [EDT] 0:0:0,214 - Exception
in Alert every five minutes version 1.0 [EDT] 0:0:0,215 - OS and [EDT]
0:0:0,215 - Error java.lang.NullPointerException [EDT] 0:0:0,216 -
Current Form null [EDT] 0:0:0,217 - Exception:
java.lang.NullPointerException - null java.lang.NullPointerException
at
com.codename1.impl.android.AndroidImplementation.createMedia(AndroidImplementation.java:2802)
at com.codename1.ui.Display.createMedia(Display.java:2998) at
com.codename1.media.MediaManager.createMedia(MediaManager.java:125)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:94)
at
it.galgani.app.fiveMinutesAlert.MyApplication.start(MyApplication.java:66)
at
it.galgani.app.fiveMinutesAlert.MyApplicationStub.run(MyApplicationStub.java:140)
at com.codename1.ui.Display.processSerialCalls(Display.java:1116) at
com.codename1.ui.Display.mainEDTLoop(Display.java:911) at
com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at
com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:856)
On an Android 7.x device I get:
[EDT] 0:0:20,186 - Codename One revisions:
3b20edadec808867afc2b19774268b66890616ad
[EDT] 0:0:20,191 - Exception: java.lang.NullPointerException - Attempt
to invoke virtual method 'int java.io.InputStream.read(byte[], int,
int)' on a null object reference java.lang.NullPointerException:
Attempt to invoke virtual method 'int java.io.InputStream.read(byte[],
int, int)' on a null object reference at
com.codename1.impl.android.AndroidImplementation.createMedia(AndroidImplementation.java:2802)
at com.codename1.ui.Display.createMedia(Display.java:2998) at
com.codename1.media.MediaManager.createMedia(MediaManager.java:125)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:94)
at
it.galgani.app.fiveMinutesAlert.MyApplication.start(MyApplication.java:66)
at
it.galgani.app.fiveMinutesAlert.MyApplicationStub.run(MyApplicationStub.java:140)
at com.codename1.ui.Display.processSerialCalls(Display.java:1116) at
com.codename1.ui.Display.mainEDTLoop(Display.java:911) at
com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at
com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:762) [EDT] 0:0:20,198 - Exception
in Alert every five minutes version 1.0 [EDT] 0:0:20,199 - OS and
[EDT] 0:0:20,201 - Error java.lang.NullPointerException: Attempt to
invoke virtual method 'int java.io.InputStream.read(byte[], int, int)'
on a null object reference [EDT] 0:0:20,202 - Current Form null [EDT]
0:0:20,204 - Exception: java.lang.NullPointerException - Attempt to
invoke virtual method 'int java.io.InputStream.read(byte[], int, int)'
on a null object reference java.lang.NullPointerException: Attempt to
invoke virtual method 'int java.io.InputStream.read(byte[], int, int)'
on a null object reference at
com.codename1.impl.android.AndroidImplementation.createMedia(AndroidImplementation.java:2802)
at com.codename1.ui.Display.createMedia(Display.java:2998) at
com.codename1.media.MediaManager.createMedia(MediaManager.java:125)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:94)
at
it.galgani.app.fiveMinutesAlert.MyApplication.start(MyApplication.java:66)
at
it.galgani.app.fiveMinutesAlert.MyApplicationStub.run(MyApplicationStub.java:140)
at com.codename1.ui.Display.processSerialCalls(Display.java:1116) at
com.codename1.ui.Display.mainEDTLoop(Display.java:911) at
com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at
com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:762)

It seems our system has a special treatment to the notification_sound prefix in a file name on Android for usage with background notification sounds on Android. Just rename the file to something else and it should work as expected.

Related

getting this error nosuchelementexception : this element is locating but still idk why it is showing this exception.also help me with other exception

1.)Exception in thread "main" org.openqa.selenium.json.JsonException: java.lang.reflect.InvocationTargetException
2.)org.openqa.selenium.json.JsonException: Attempting to close incomplete json stream
Build info: version: '4.6.0', revision: '79f1c02ae20'
3.)Caused by: java.lang.reflect.InvocationTargetException
4.)Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"[placeholder='Select Country']"}
Note:does not allowing me to paste all code so just written down exception can anyone help me with these

Error creating style SignatureButtonBox. selected: false prefix: throws exception

Upon instansiation of SignatureComponent,
SignatureComponent custSignature = new SignatureComponent();
Throws:
[EDT] 0:1:21,183 - Error creating style SignatureButtonBox. selected: false prefix:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
[EDT] 0:1:21,183 - Exception: java.lang.ClassCastException - java.lang.Integer cannot be cast to java.lang.String
I have refreshed all CN1 libs, clean compiles.
Thoughts?

How do I debug errors like this in Codenameone?

I have an app that works well on the simulator. I did an Android build and installed on a device. Now , several functionalities don't work. The debug log I receive contain several errors of this sort
[EDT] 0:23:31,275 - Exception in Ziemozi version 1.0
[EDT] 0:23:31,275 - OS and
[EDT] 0:23:31,275 - Error java.lang.NullPointerException: Attempt to invoke virtual method 'void com.codename1.ab.l.n(int)' on a null object reference
[EDT] 0:23:31,276 - Current Form null
[EDT] 0:23:31,276 - Exception: java.lang.NullPointerException - Attempt to invoke virtual method 'void com.codename1.ab.l.n(int)' on a null object reference
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.codename1.ab.l.n(int)' on a null object reference
at com.codename1.g.j.a(InfiniteScrollAdapter.java:156)
at com.codename1.g.j.a(InfiniteScrollAdapter.java:143)
at com.codename1.ab.aa.t(InfiniteContainer.java:177)
at com.codename1.ab.aa$5.run(InfiniteContainer.java:193)
at com.codename1.ab.r.n(Display.java:1298)
at com.codename1.ab.r.l(Display.java:1242)
at com.codename1.ab.r.k(Display.java:1130)
at com.codename1.ab.ao.run(RunnableWrapper.java:120)
at com.codename1.impl.b$1.run(CodenameOneThread.java:60)
How do I debug this or how does it arise so I can fix it?
This happens when one of the components returned from InfiniteContainer is null. E.g. you did something like:
public Component[] fetchComponents(int index, int amount);
// ...
return cmps;
}
cmps is a valid array that's bigger than 0 but one of its elements is null.

Facebook native SDK conflicts with Parse4CN1 on Android

I'm currently having some trouble with an issue that was previously fixed through a build hint some time ago as you can see in the following thread:
https://groups.google.com/forum/#!searchin/codenameone-discussions/parse4cn1%7Csort:date/codenameone-discussions/4xipU9Sy5rY/IbX1YMmGBQAJ
I'm still keeping the build hint android.excludeBolts=true as well as the facebook.appId build hint set to my app id, but it now fails with the following error:
2019-03-19 00:35:44.832 9571-9571/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.guarumo.ego, PID: 9571
java.lang.NoClassDefFoundError: Failed resolution of: Lbolts/AppLinks;
at com.facebook.appevents.internal.SourceApplicationInfo$Factory.create(SourceApplicationInfo.java:131)
at com.facebook.appevents.internal.ActivityLifecycleTracker.onActivityCreated(ActivityLifecycleTracker.java:155)
at com.facebook.appevents.internal.ActivityLifecycleTracker$1.onActivityCreated(ActivityLifecycleTracker.java:101)
at android.app.Application.dispatchActivityCreated(Application.java:208)
at android.app.Activity.onCreate(Activity.java:1110)
at com.codename1.impl.android.CodenameOneActivity.onCreate(CodenameOneActivity.java:306)
at com.guarumo.ego.EgoStub.onCreate(EgoStub.java:53)
at android.app.Activity.performCreate(Activity.java:7383)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Caused by: java.lang.ClassNotFoundException: Didn't find class "bolts.AppLinks" on path: DexPathList[[zip file "/data/app/com.guarumo.ego-nsZJW8Y8XXNjxF5pwA3RMQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.guarumo.ego-nsZJW8Y8XXNjxF5pwA3RMQ==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.facebook.appevents.internal.SourceApplicationInfo$Factory.create(SourceApplicationInfo.java:131)
at com.facebook.appevents.internal.ActivityLifecycleTracker.onActivityCreated(ActivityLifecycleTracker.java:155)
at com.facebook.appevents.internal.ActivityLifecycleTracker$1.onActivityCreated(ActivityLifecycleTracker.java:101)
at android.app.Application.dispatchActivityCreated(Application.java:208)
at android.app.Activity.onCreate(Activity.java:1110)
at com.codename1.impl.android.CodenameOneActivity.onCreate(CodenameOneActivity.java:306)
at com.guarumo.ego.EgoStub.onCreate(EgoStub.java:53)
at android.app.Activity.performCreate(Activity.java:7383)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
On the other hand, if I set the android.excludeBolts build hint to false I get the problem presented on the previously mentioned thread:
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbolts/AggregateException;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbolts/AndroidExecutors;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbolts/AndroidExecutors$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbolts/AndroidExecutors$UIThreadExecutor;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbolts/BoltsExecutors;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbolts/BoltsExecutors$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbolts/BoltsExecutors$ImmediateExecutor;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbolts/CancellationToken;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lbolts/CancellationTokenRegistration;
Dex: Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Translation has been interrupted
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:615)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:313)
at com.android.dx.command.dexer.Main.runDx(Main.java:291)
at com.android.dx.command.dexer.Main.main(Main.java:247)
at com.android.dx.command.Main.main(Main.java:94)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:607)
... 4 more
:transformClassesWithDexForRelease FAILED
:transformClassesWithDexForRelease (Thread[Daemon worker,5,main]) completed. Took 22.043 secs.
I think this might be being caused by the change to a newer version of the Facebook SDK, but couldn't confirm it. Could you please help me out with this problem?
Thanks in advance.
I'm guessing this relates to the second answer in this question. This was caused because of this fix. As a temporary workaround you can probably set the SDK to the older/deprecated facebook SDK with the build hint: android.facebookSdkVersion=4.7.0.
To property fix this problem (if that answer is indeed correct) you will need to add parse bolts to the build hints:
android.gradleDep=compile 'com.parse.bolts:bolts-tasks:1.4.0'; compile 'com.parse.bolts:bolts-applinks:1.4.0';

Glassfish RAR5058: Error while Resizing pool. Exception : null

I am using GlassFish 3.1.1, SQL Server 2008, and NetBeans with Hibernate 3 and JSF 2.0 to create a web application. I am able to retrieve data with the hibernate API successfully but for some reason, the connection pool becomes null when I try to click a commandButton that takes me from one page to another page. In the action method, I am simply making a call to getOriginCount() but the hibernate API is giving a weird null error. Not sure if it's glassfish pool, hibernate, or sql server.
WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ perfpro-jdbc-pool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException
WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: null]
SEVERE: 1237767 [http-thread-pool-8080(2)] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null
SEVERE: 1237772 [http-thread-pool-8080(2)] ERROR org.hibernate.util.JDBCExceptionReporter - Error in allocating a connection. Cause: null
WARNING: /cloneBuilderMenu.xhtml #31,168 rendered="#{cloneBuilderBean.canCreateMoreClones}": org.hibernate.exception.GenericJDBCException: Cannot open connection
javax.el.ELException: /cloneBuilderMenu.xhtml #31,168 rendered="#{cloneBuilderBean.canCreateMoreClones}": org.hibernate.exception.GenericJDBCException: Cannot open connection
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:413)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1166)
at javax.faces.component.UIForm.processDecodes(UIForm.java:225)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:933)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
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:160)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:81)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473)
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.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:344)
at $Proxy146.beginTransaction(Unknown Source)
at com.perpro.controller.dao.impl.AssessmentDaoImpl.getOriginCount(AssessmentDaoImpl.java:145)
at com.perpro.controller.cloneBuilderBean.getCanCreateMoreClones(cloneBuilderBean.java:248)
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 javax.el.BeanELResolver.getValue(BeanELResolver.java:302)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstValue.getValue(AstValue.java:116)
at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
... 36 more
Caused by: java.sql.SQLException: Error in allocating a connection. Cause: null
at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:120)
at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:92)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
... 60 more
Caused by: javax.resource.spi.ResourceAllocationException: Error in allocating a connection. Cause: null
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:307)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:190)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:160)
at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:113)
... 62 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:103)
at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282)
at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1501)
at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:944)
at com.sun.enterprise.resource.pool.ConnectionPool.resizePoolAndGetNewResource(ConnectionPool.java:792)
at com.sun.enterprise.resource.pool.ConnectionPool.getResourceFromPool(ConnectionPool.java:760)
at com.sun.enterprise.resource.pool.ConnectionPool.getUnenlistedResource(ConnectionPool.java:632)
at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:526)
at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381)
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:242)
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:167)
at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:338)
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:301)
... 66 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:924)
at com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1185)
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98)
... 78 more
Caused by: java.lang.NullPointerException
at com.microsoft.sqlserver.jdbc.FailoverMapSingleton.getFailoverInfo(FailOverMapSingleton.java:37)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:685)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnectionInternal(SQLServerDataSource.java:593)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnection(SQLServerDataSource.java:57)
at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:113)
at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907)
... 80 more
WARNING: RAR5058: Error while Resizing pool perfpro-jdbc-pool. Exception : null
WARNING: RAR5058: Error while Resizing pool perfpro-jdbc-pool. Exception : null
WARNING: RAR5058: Error while Resizing pool perfpro-jdbc-pool. Exception : null
WARNING: RAR5058: Error while Resizing pool perfpro-jdbc-pool. Exception : null
WARNING: RAR5058: Error while Resizing pool perfpro-jdbc-pool. Exception : null
WARNING: RAR5058: Error while Resizing pool perfpro-jdbc-pool. Exception : null
WARNING: RAR5058: Error while Resizing pool perfpro-jdbc-pool. Exception : null
Here is the method where the nullpointer happens at session.beginTransaction(); The HibernateUtil class is generated by Netbeans.
public Integer getOriginCount() throws Exception {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
Integer originCount = ((Long) session.createQuery("select count(*) from origin").uniqueResult()).intValue();
session.getTransaction().commit();
return originCount;
}
The NPE seem to originate from a SQLServerDataSource.getConnection call. It is possible that either your datasource or database is incorrectly configured. To start with, I will try disabling failover clustering.

Resources