2014-10-30 517 views
0

當試圖堅持包含oracle.spatial.geometry.JGeometry對象我不斷收到這樣的警告的實體:ClassNotFoundException的:com.sun.gjc.spi.base.ConnectionHolder

警告:拋出java.lang.ClassNotFoundException :com.sun.gjc.spi.base.ConnectionHolder。

該對象被正確保存在數據庫中,但不知何故我無法擺脫警告。 如果我繞過addGeometry-method並將shapePolygon-field設置爲null(selected.setShapePolygon(null)),則該方法在沒有任何警告的情況下執行。

ConnectionHolder-class是jdbc-core庫的一部分,但據我所知它應該足以在GF-server上包含ojdbc-driver。我已將ojdbc6.jar放入pom.xml和服務器目錄中: $ {GlassFishHome} \ domains \ domain1 \ lib \ ext。 這沒有解決警告。我google了ClassNotFoundException但在這裏也沒有運氣。

我正在使用glassfish 4服務器和Oracle 11g DB以及此應用程序的primefaces。

關於如何擺脫警告的任何想法?

這裏是從的facelet觸發JSF豆的方法調用,調用:

<p:commandButton actionListener="#{gvkStoredKortlomrController.addGeometry()}" value="#{bundle.Save}" update="display,:GvkStoredKortlomrListForm:datalist,:growl" oncomplete="handleSubmit(args,'GvkStoredKortlomrCreateDialog');"/> 

這裏是在JSF豆的相關方法:

public void addGeometry() { 
    FileDataStore store = null; 
    SimpleFeatureIterator iterator = null; 
    try { 
     File file = new File("C:\\tmp\\Primo\\"); 
     store = FileDataStoreFinder.getDataStore(file); 
     SimpleFeatureSource featureSource = store.getFeatureSource(store.getTypeNames()[0]); 
     SimpleFeatureCollection features = featureSource.getFeatures(); 
     iterator = features.features(); 
     Geometry geometry = null; 
     JGeometry jGeometry = null; 

     while (iterator.hasNext()) { 
      SimpleFeature feature = iterator.next(); 
      geometry = (Geometry) feature.getAttribute(0); 
      double x = geometry.getCoordinate().x; 
      double y = geometry.getCoordinate().y; 
      int srid = 25832; 
      jGeometry = new JGeometry(x, y, srid); 
     } 

     selected.setShapePolygon(jGeometry); 
    } catch (IOException ex) { 
     ex.printStackTrace(); 
     System.out.println(ex.getMessage()); 
    } finally { 
     iterator.close(); 
     store.dispose(); 
    } 
    create(); 

} 

public void create() { 
    persist(PersistAction.CREATE, ResourceBundle.getBundle("/Bundle").getString("GvkStoredKortlomrCreated")); 
    if (!JsfUtil.isValidationFailed()) { 
     items = null; // Invalidate list of items to trigger re-query. 
    } 
} 
private void persist(PersistAction persistAction, String successMessage) { 
    if (selected != null) { 
     setEmbeddableKeys(); 
     try { 
      if (persistAction == PersistAction.CREATE) { 
       getFacade().create(selected); 
      } else if (persistAction == PersistAction.UPDATE) { 
       getFacade().edit(selected); 
      } else if (persistAction == PersistAction.DELETE) { 
       getFacade().remove(selected); 
      } 
      JsfUtil.addSuccessMessage(successMessage); 

     } catch (EJBException ex) { 
      String msg = ""; 
      Throwable cause = ex.getCause(); 
      if (cause != null) { 
       msg = cause.getLocalizedMessage(); 
      } 
      if (msg.length() > 0) { 
       JsfUtil.addErrorMessage(msg); 
      } else { 
       JsfUtil.addErrorMessage(ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); 
      } 
     } catch (Exception ex) { 
      Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex); 
      JsfUtil.addErrorMessage(ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); 
     } 
    } 
} 

下面是從地裏實體類:

@EmbeddedId 
protected GvkStoredKortlomrPK gvkStoredKortlomrPK; 
@Size(max = 64) 
@Column(name = "KORTLOMR") 
private String kortlomr; 
@Basic(optional = false) 
@NotNull 
@Column(name = "KORTLOMR_NR") 
private int kortlomrNr; 
@Size(max = 254) 
@Column(name = "FILNAVN") 
private String filnavn; 
@Basic(optional = false) 
@NotNull 
@Column(name = "OBJECTID") 
private BigInteger objectid; 
@Convert(value = "JGeometry") 
@Column(name = "SHAPE_POLYGON") 
private JGeometry shapePolygon; 
@JoinColumn(name = "GVKORTID", referencedColumnName = "GVKORTID", insertable = false, updatable = false) 
@ManyToOne(optional = false) 
private GvkGvkortdb gvkGvkortdb; 

我在課堂級別上使用以下注釋:

@StructConverter(name = "JGeometry", converter = "org.eclipse.persistence.platform.database.oracle.converters.JGeometryConverter") 

下面是完整的堆棧跟蹤:

WARNING: java.lang.ClassNotFoundException: com.sun.gjc.spi.base.ConnectionHolder 
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) 
at org.eclipse.persistence.platform.server.glassfish.GlassfishPlatform.unwrapGlassFishConnectionHelper(GlassfishPlatform.java:124) 
at org.eclipse.persistence.platform.server.glassfish.GlassfishPlatform.unwrapConnection(GlassfishPlatform.java:105) 
at org.eclipse.persistence.platform.database.oracle.Oracle8Platform.getConnection(Oracle8Platform.java:104) 
at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.setParameterValueInDatabaseCall(DatabasePlatform.java:2438) 
at org.eclipse.persistence.platform.database.oracle.Oracle9Platform.setParameterValueInDatabaseCall(Oracle9Platform.java:525) 
at org.eclipse.persistence.internal.databaseaccess.BindCallCustomParameter.set(BindCallCustomParameter.java:69) 
at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.setParameterValueInDatabaseCall(DatabasePlatform.java:2435) 
at org.eclipse.persistence.platform.database.oracle.Oracle9Platform.setParameterValueInDatabaseCall(Oracle9Platform.java:525) 
at org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareStatement(DatabaseCall.java:797) 
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:619) 
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558) 
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2002) 
at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:298) 
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242) 
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228) 
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:377) 
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:165) 
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:180) 
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:489) 
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80) 
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90) 
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:301) 
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58) 
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899) 
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:798) 
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108) 
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85) 
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896) 
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804) 
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786) 
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1737) 
at org.eclipse.persistence.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:226) 
at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:125) 
at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:4207) 
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1441) 
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1531) 
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.issueSQLbeforeCompletion(UnitOfWorkImpl.java:3168) 
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.issueSQLbeforeCompletion(RepeatableWriteUnitOfWork.java:352) 
at org.eclipse.persistence.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:158) 
at org.eclipse.persistence.transaction.JTASynchronizationListener.beforeCompletion(JTASynchronizationListener.java:68) 
at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:452) 
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:854) 
at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:719) 
at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:503) 
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566) 
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2074) 
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2044) 
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:220) 
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88) 
at com.sun.proxy.$Proxy263.create(Unknown Source) 
at dk.geus.gvkort.control.__EJB31_Generated__GvkStoredKortlomrFacade__Intf____Bean__.create(Unknown Source) 
at dk.geus.gvkort.view.GvkStoredKortlomrController.persist(GvkStoredKortlomrController.java:186) 
at dk.geus.gvkort.view.GvkStoredKortlomrController.create(GvkStoredKortlomrController.java:123) 
at dk.geus.gvkort.view.GvkStoredKortlomrController.addGeometry(GvkStoredKortlomrController.java:177) 
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:606) 
at javax.el.ELUtil.invokeMethod(ELUtil.java:332) 
at javax.el.BeanELResolver.invoke(BeanELResolver.java:537) 
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256) 
at com.sun.el.parser.AstValue.invoke(AstValue.java:283) 
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304) 
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40) 
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) 
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) 
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:147) 
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88) 
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:813) 
at javax.faces.component.UICommand.broadcast(UICommand.java:300) 
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) 
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) 
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) 
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) 
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) 
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) 
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:70) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) 
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) 
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) 
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) 
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282) 
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) 
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) 
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) 
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175) 
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) 
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) 
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561) 
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) 
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) 
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) 
at java.lang.Thread.run(Thread.java:744) 

編輯 我當然應該提到,已經嘗試添加了JDBC核心罐子。既作爲maven依賴項,也作爲服務器目錄($ {GlassFishHome} \ domains \ domain1 \ lib)。後者解決方案,我得到一個com.sun.gjc.spi.jdbc40.Jdbc40ObjectsFactory ClassNotFound的,但是當我加入這個(jdbc40-3.0.1.jar)到服務器目錄我得到以下幾點:

SEVERE: java.lang.AbstractMethodError: com.sun.gjc.spi.JdbcObjectsFactory.getDataSourceInstance(Lcom/sun/gjc/spi/ManagedConnectionFactoryImpl;Ljavax/resource/spi/ConnectionManager;)Ljavax/sql/DataSource; 
at com.sun.gjc.spi.ManagedConnectionFactoryImpl.createConnectionFactory(ManagedConnectionFactoryImpl.java:139) 
at com.sun.enterprise.resource.naming.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:156) 
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321) 
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:527) 
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:487) 
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438) 
at javax.naming.InitialContext.lookup(InitialContext.java:411) 
at javax.naming.InitialContext.lookup(InitialContext.java:411) 
at org.glassfish.resourcebase.resources.naming.ResourceNamingService.lookup(ResourceNamingService.java:236) 
at org.glassfish.resourcebase.resources.api.ResourceProxy.create(ResourceProxy.java:87) 
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:480) 
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438) 
at javax.naming.InitialContext.lookup(InitialContext.java:411) 
at javax.naming.InitialContext.lookup(InitialContext.java:411) 
at org.glassfish.resourcebase.resources.naming.ResourceNamingService.lookup(ResourceNamingService.java:236) 
at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl.lookup(ConnectorResourceAdminServiceImpl.java:224) 
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:511) 
at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63) 
at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71) 
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108) 
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142) 
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107) 
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223) 
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510) 
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230) 
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) 
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535) 
at java.security.AccessController.doPrivileged(Native Method) 
at javax.security.auth.Subject.doAs(Subject.java:356) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557) 
at java.security.AccessController.doPrivileged(Native Method) 
at javax.security.auth.Subject.doAs(Subject.java:356) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722) 
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534) 
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224) 
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189) 
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) 
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) 
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) 
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175) 
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) 
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) 
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561) 
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) 
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) 
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) 
at java.lang.Thread.run(Thread.java:744) 
SEVERE: Exception while preparing the appSEVERE: 
Exception during lifecycle processing 

回答

0

正如你在你的問題中寫的那樣,缺課是在jdbc-core.jar

它不包含在ojdbc6.jar中,所以當然不能在類路徑中包含這個jar。

看起來你有兩種選擇:忽略警告添加JDBC-core.jar添加

FYI這是導致此錯誤的方法:

/** 
* @return unwrapped GlassFish connection, null if connection can not be unwrapped. 
*/ 
private Connection unwrapGlassFishConnectionHelper(Connection connection) { 
    // Currently "GlassFish" creates a separate instance of jdbc connector classloader 
    // for each application. The connection wrapper passed here is created using this class loader. Hence caching 
    // the class will not help. 
    // If GlassFish behavior changes, both reflective call below should be cached. 
    Connection unwrappedConnection = null; 
    try { 
     Class connectionWrapperClass = connection.getClass().getClassLoader().loadClass("com.sun.gjc.spi.base.ConnectionHolder"); 
     if(connectionWrapperClass.isInstance(connection)) { 
      Method unwrapMethod = connectionWrapperClass.getDeclaredMethod("getConnection"); 
      unwrappedConnection = (Connection) unwrapMethod.invoke(connection); 
     } 
    } catch (Exception e) { 
     getDatabaseSession().getSessionLog().logThrowable(SessionLog.WARNING, SessionLog.SERVER, e); 
    } 

    return unwrappedConnection; 
} 

它被用這種方法叫:

public java.sql.Connection unwrapConnection(final Connection connection) { 
    Connection unwrappedConnection; 

    if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { 
     unwrappedConnection = AccessController.doPrivileged(new PrivilegedAction<Connection>() { 
      public Connection run() { 
       return unwrapGlassFishConnectionHelper(connection); 
      } 
     }); 
    } else { 
     unwrappedConnection = unwrapGlassFishConnectionHelper(connection); 
    } 

    if (unwrappedConnection == null) { 
     unwrappedConnection = super.unwrapConnection(connection); 
    } 
    return unwrappedConnection; 
} 
+0

非常感謝您的回覆。不幸的是,當運行我的應用程序時,我無法添加jdbc-core.jar而沒有崩潰服務器。 – PeteHegn 2014-11-01 09:37:44

相關問題