How to fix Glassfish error - glassfish-4

I am not a good Java programmer yet, but I dream of becoming one. I am practicing building an eCommerce web app with an online Affablebean project using java, my IDE is NetBeans, database is MySQL and MySQL workbench, the server on the Netbeans IDE is Glassfish server 4.
So whenever I try to Ping, to create a connection between Glassfish and MySQL database, I get an error message like this
Ping Connection Pool failed for AffableBeanPool. Connection could not
be allocated because: java.lang.ClassCastException:
java.math.BigInteger cannot be cast to java.lang.Long Please check the
server.log for more details.
How can I fix this problem?

Related

Whille deploying RESTful webservice, Shows error JdbcDataSource. not found

I have been trying to create my first RESTful execrcise using. But I am unable to deploy module due to error "com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/playerDB__pm"
I checked and I have JNDI, daata source created.
Unlike specified in link. I am using:
-Netbeans 8.0.3, Java EE 7, GlassFish Server 4.
Also I have checked GlassFish is running fine.
Edit 1:
I have re-checked my 'Services' tab, and I could not find jdbc/__playedDB ,even though I have created it.
Its a bug, the JDBC resource file is not being created (atleast with versions I am using: GlassFish 4.1, Netbeans 8.0.2). Using GlassFish manually create.
There could still be different error untill you set following connectins:
database(data source) <- connection pool <- JNDI.

Unable to reconnect to Derby from Tomcat server started via Eclipse

I'm running on Win 7 using Eclipse 4.2 starting a web app on a Tomcat 7 server and using Derby database. I have tried many approaches but run consistently into a common problem:
Everything works just fine the first time I start up and run.
When I redeploy my application after a change, all database connections hang (any kind of restart).
If I stop Eclipse and restart Eclipse, that clears up the problem and the next run works fine again.
Having done some investigation, it appears that the problem is that the Derby port (1527) is not released from one execution of the server to the next. That seems very strange to me since Derby is started by the Tomcat instance which is a separate javaw process.
I've tried:
Configuring the Derby connection as a Tomcat resource
Establishing the connection within my code (rather than via Tomcat resource)
Both the embedded and the network driver
Starting / stopping the network driver from a servlet on startup and shutdown of the Tomcat server
Shutting down the embedded driver via servlet on shutdown of Tomcat
Again, every approach works fine to connect the first time.
One other symptom that doesn't appear to be related (except for as a possible indicator of whether or not shutdown completes correctly) is that the db.lck file for my database never gets deleted. However, whether or not it exists has no bearing on whether or not I can reconnect (only stopping/starting eclipse has an impact).
Any insight would be appreciated.
Thanks!
After some further investigation I'm going to call this a duplicate of: Cannot create JDBC driver of class ' ' for connect URL 'null' : I do not understand this exception. It's not quite the same thing, but that solution (creating META-INF/context.xml) allows it to proceed to failing calls rather than hangs, which is a significant improvement and suggests it's largely related.
I did finally figure this out. It turns out I had the derby jars in the Tomcat lib folder (for Tomcat) and in the deployment assembly for my application in Eclipse (rather than just in the build path). So Tomcat was using the built-in libs, while my app was using the embedded libs, and this resulted in conflicts. Leaving the libs as part of Tomcat and removing them from my war file solved the problem completely.

IBM Worklight 6.1 - Unable to initialize the project due to DB2 error

I'm getting the following error while trying to access the Worklight server deployed in my machine:
Error 500: Worklight Console initialization failed.Logged Exception:
java.lang.RuntimeException: FWLSE0206E: The project /worklight failed to initialize, because the project database schema for data source jdbc:db2://xxxxx:50000/WRKLGHT is from version N/A, which is not supported by the server from version 6.1.0.00.20131126-0630. Use the Worklight ant tasks to upgrade the project database schema. [project worklight]
Follow what the error message suggests.
Make sure that the database schema you use for your DB2 database is one that fits Worklight 6.1
Upgrading from a previous version
How to manually update the database
How to configure the database using Ant
Make sure that you have properly configured your application server for working with DB2
Also make sure that you have properly set up DB2...

netbeans jboss client connection failure

I just started to learn EJB by going thru a tutorial. I started a JBoss server on localhost. The server started ok, listening on port 4447, 9999 & 8080.
But I keep getting an error running a client. The error message is:
Could not obtain connection to any of these urls: localhost:1099.
I tried to change the port number to 4447, 9999,8080, but still keep getting the same error message.
JBoss version jboss-as-7.1.0.Final. NetBeans 7.4. JDK 1.6. I already spent hours on it, but still was not able fix it. Any help will be appreciated.
Your client is using the old jnp-protocol for JNDI-lookup (see jndi.properties or code). This is not supported in jboss7. You need to go along the lines of https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI

Ant build in Eclipse with Weblogic 9.2 - deployment exception - Unable to connect to 't3://localhost:7001': invalid type code: 31

It gives me the following exception message as I am trying to deploy an application.
BUILD FAILED
C:\eclipse\workspace\SLGIADMIN\build.xml:14: The following error occurred while executing this line:
C:\eclipse\buildcommon.xml:243: weblogic.Deployer$DeployerException: weblogic.deploy.api.tools.deployer.DeployerException: Unable to connect to 't3://localhost:7001': invalid type code: 31. Ensure the url represents a running admin server and that the credentials are correct. If using http protocol, tunneling must be enabled on the admin server.
I am using ant build in Eclipse and deploying to Weblogic 9.2.
I have been trying to find solution online. I have tried enable the tunneling in the Weblogic console. Doesn't work.
I have seen people mention we can use JDK 1.5 which will turn on tunneling on deploying. I have verified mine version is 1.5 too. I have ensured that too but did not fix the issue.
Invalid type code 31 is always because you're connecting with a different version of Java than what the server is running. Weblogic 9.2 only supports Java 1.5. Make sure that's what your ant task is using. You can also connect with later versions of Java if you set the following property in your client:
-Dsun.lang.ClassLoader.allowArraySyntax=true