Step 1, Download glassfish: http://dlc.sun.com.edgesuite.net/glassfish/3.1.2/promoted/glassfish-3.1.2-b19-unix.sh or if you’re not on any sort of unix, choose your own platform.. http://dlc.sun.com.edgesuite.net/glassfish/3.1.2/promoted/
Step 2, Install Glassfish: Nothing fancy here, just run the script/installer with default options etc. (my $JAVA_HOME is set to jdk 1.7.0_01, the installer will use/inherit that in the config for glassfish) The installer will ask you to create a domain, just choose the defaults. Step 3, Download Gemini JPA: http://www.eclipse.org/downloads/download.php?file=/gemini/jpa/r1.0/gemini-jpa-1.0.0.RELEASE.zip Copy the file org.eclipse.gemini.jpa_1.0.0.RELEASE.jar from the download zip into <GF_HOME>/glassfish/domains/domain1/autodeploy/bundles Domain1 is the default name of the domain the installer will create, if you don't choose to change it when asked. Step 4, Start the domain: The default option for the installer is to auto start the domain after it's been created, so it should be already running. But in case you need to stop and start it for whatever reason the following commands will serve you well: # <GF_HOME>/bin/asadmin stop-domain # <GF_HOME>/bin/asadmin start-domain Step 5, Configure DataSource: In my setup I use MySQL, and I am assuming you know how to set that up... if not let me know. (I had other issues with the built-in/embedded Derby driver/db) I also created a blank database called osgi_example (referenced later in the db pool config). Download the MySQL JDBC driver from: http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.18.zip/from/http://mysql.mirrors.hoobly.com/ And place the mysql-connector-java-5.1.18-bin.jar file under <GF_HOME>/glassfish/domains/domain1/lib. Oh and restart (stop, start) the domain now! Go to http://localhost:4848/ and login using the username and password specified during installation. The username by default is admin. 1. From the left hand side, Resources -> JDBC -> JDBC Connection Pools 2. Click New 2.5. Name: OSGiExample 3. Resource Type javax.sql.ConnectionPoolDataSource 4. Select MySQL from list of databases 5. Click Next 6. Delete all the silly properties it gives you and enter these: User: <mysql username here> Password: secret ServerName: localhost DatabaseName: osgi_example 7. Click save 8. Click Ping to test... 9. the left hand side, Resources -> JDBC -> JDBC Resources 10. Click new 11. JNDI name: jdbc/osgi-example 12. Select our OSGiExample pool. 13. Click save. 14.. I think that’s it. Step 6, Deploy my entity bundle: Copy my entity bundle (will email that directly to you) to <GF_HOME>/glassfish/domains/domain1/autodeploy/bundles Step 7, Observe error under: <GF_HOME>/glassfish/domains/domain1/logs/server.log You'll have to put up with the horrible glassfish logging format... my apologies... Step 8, Profit! Regards, Aaron Whiteside -----Original Message----- From: Richard S. Hall [mailto:[email protected]] Sent: Thursday, January 26, 2012 5:21 PM To: [email protected] Subject: Re: NPE in BundleWiringImpl No attachments to the list, so you can just send to me personally... However, you'll need to give me more detailed steps to reproduce than what you have below, because I don't use any of that stuff, so I have no idea what you are talking about...steps to reproduce should include the artifacts necessary (or URLs to get them) as well as the set of steps to reproduce the error...it might come as a surprise, but I rarely create or use any bundles, my life as been stuck in the framework for the past 11 years. ;-) -> richard On 1/26/12 14:34, Aaron Whiteside wrote: > Just checked the version in the Glassfish's bundled felix.jar and it is 4.0.2. > > It is reproducible.. I have Gemini JPA deployed and are deploying my own JPA > bundle. > > Attached is my persistence.xml. You would have to create the datasource in > glassfish. And you can use empty entities or I suspect different entity > classes. > > <?xml version="1.0" encoding="UTF-8"?> > <persistence version="2.0" > xmlns="http://java.sun.com/xml/ns/persistence" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence > http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> > > <persistence-unit name="osgi-example" transaction-type="JTA"> > <jta-data-source>jdbc/osgi-example</jta-data-source> > > <class>com.mm.osgiexample.entity.User</class> > <class>com.mm.osgiexample.entity.Group</class> > > <exclude-unlisted-classes>true</exclude-unlisted-classes> > > <properties> > <property name="eclipselink.target-database" value="MySQL"/> > > <!--<property name="eclipselink.logging.level" > value="FINEST"/>--> > <property name="eclipselink.logging.exceptions" value="true"/> > > <!-- turn off DDL generation after the model is stable --> > <property name="eclipselink.ddl-generation" > value="drop-and-create-tables"/> > <property name="eclipselink.ddl-generation.output-mode" > value="both"/> > <property name="eclipselink.ddl.default-table-suffix" > value="engine=InnoDB"/> > <property name="eclipselink.weaving" value="false"/> > </properties> > > </persistence-unit> > > </persistence> > > > Can I send attachments to the mailing list? If so I'll just send the sample > bundle. > > Regards, > Aaron Whiteside > Director of Technical Architecture > MOBILEMESSENGER > > > -----Original Message----- > From: Richard S. Hall [mailto:[email protected]] > Sent: Thursday, January 26, 2012 12:54 PM > To: [email protected] > Subject: Re: NPE in BundleWiringImpl > > First things first, if you are running 4.0.1, you should try with 4.0.2 > since that addressed some NPE situations in the resolver due to > refactoring that occurred in 4.0.0. To use it with GF you should just be > able to copy the 4.0.2 felix.jar file over the existing felix.jar file. > > If that doesn't resolve the issue and if it is easily repeatable, then > please describe the precise set of steps to reproduce and I can try to > look into it. > > -> richard > > On 1/26/12 12:02, Aaron Whiteside wrote: >> Thought I might let the felix guys know about this... >> >> http://www.eclipse.org/forums/index.php/m/783881/#msg_783881 >> >> >> Running in Glassfish 3.1.2-b19 (Felix 4.0.1 I think..) >> >> Stacktrace below.. >> >> [#|2012-01-26T11:37:55.594-0500|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=81;_ThreadName=Thread-2;|[EL >> Severe]: 2012-01-26 11:37:55.594--ServerSession(1197114060)--Local >> Exception Stack: >> Exception [EclipseLink-7060] (Eclipse Persistence Services - >> 2.3.2.v20111125-r10461): >> org.eclipse.persistence.exceptions.ValidationException >> Exception Description: Cannot acquire data source [jdbc/osgi-example]. >> Internal Exception: javax.naming.NamingException: Lookup failed for >> 'jdbc/osgi-example' in >> SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, >> java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is >> javax.naming.NamingException: Unable to lookup resource : jdbc/osgi-example >> [Root exception is javax.naming.CommunicationException: Communication >> exception for >> SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, >> java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is >> java.lang.NullPointerException]]] >> at >> org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:497) >> at >> org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:109) >> at >> org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162) >> at >> org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:330) >> at >> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:293) >> at >> org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:418) >> at >> org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:216) >> at >> org.eclipse.persistence.sessions.server.ExternalConnectionPool.startUp(ExternalConnectionPool.java:146) >> at >> org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:484) >> at >> org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:633) >> at >> org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:208) >> at >> org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488) >> at >> org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188) >> at >> org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277) >> at >> org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294) >> at >> org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272) >> at >> com.mm.osgiexample.OSGiEntityManagerFactoryFactory.create(OSGiEntityManagerFactoryFactory.java:32) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:601) >> at >> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:145) >> at >> org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570) >> at >> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:982) >> at >> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:878) >> at >> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:484) >> at >> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455) >> at >> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) >> at >> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) >> at >> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) >> at >> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192) >> at >> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) >> at >> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) >> at >> org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:60) >> at >> org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:325) >> at >> org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85) >> at >> org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:290) >> at >> org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137) >> at java.lang.Thread.run(Thread.java:722) >> Caused by: javax.naming.NamingException: Lookup failed for >> 'jdbc/osgi-example' in >> SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, >> java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is >> javax.naming.NamingException: Unable to lookup resource : jdbc/osgi-example >> [Root exception is javax.naming.CommunicationException: Communication >> exception for >> SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, >> java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is >> java.lang.NullPointerException]]] >> at >> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518) >> at >> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455) >> at >> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:654) >> at javax.naming.InitialContext.lookup(InitialContext.java:415) >> at javax.naming.InitialContext.lookup(InitialContext.java:415) >> at >> org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:103) >> ... 37 more >> Caused by: javax.naming.NamingException: Unable to lookup resource : >> jdbc/osgi-example [Root exception is javax.naming.CommunicationException: >> Communication exception for >> SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, >> java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is >> java.lang.NullPointerException]] >> at >> org.glassfish.javaee.services.ResourceProxy.throwResourceNotFoundException(ResourceProxy.java:119) >> at org.glassfish.javaee.services.ResourceProxy.create(ResourceProxy.java:95) >> at >> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:507) >> ... 42 more >> Caused by: javax.naming.CommunicationException: Communication exception for >> SerialContext[myEnv={java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, >> java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is >> java.lang.NullPointerException] >> at >> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:542) >> at >> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455) >> at javax.naming.InitialContext.lookup(InitialContext.java:411) >> at javax.naming.InitialContext.lookup(InitialContext.java:411) >> at >> com.sun.appserv.connectors.internal.api.ResourceNamingService.lookup(ResourceNamingService.java:221) >> at org.glassfish.javaee.services.ResourceProxy.create(ResourceProxy.java:93) >> ... 43 more >> Caused by: java.lang.NullPointerException >> at >> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432) >> at >> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72) >> at >> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:356) >> at java.lang.Class.forName0(Native Method) >> at java.lang.Class.forName(Class.java:264) >> at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:63) >> at >> javax.naming.spi.NamingManager.getObjectFactoryFromReference(NamingManager.java:146) >> at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:319) >> at >> com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556) >> at >> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514) >> ... 48 more >> |#] >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

