Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

OSGI Bundle for MSSQL - error javax.net.SocketFactory classdefnotfound

Avatar

Level 7

I am trying to create an OSGI bundle for MSSQL driver.  I'll post my Manifest below.

Basically, I get an error javax.net.SocketFactory no class def found.

 

 

com.adobe.granite.workflow.WorkflowException: Process execution resulted in an error
	at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:201) [com.adobe.granite.workflow.core:2.0.240.CQ650-B0016]
	at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:260) [com.adobe.granite.workflow.core:2.0.240.CQ650-B0016]
	at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:502) [org.apache.sling.event:4.2.12]
	at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:293) [org.apache.sling.event:4.2.12]
	at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:60) [org.apache.sling.event:4.2.12]
	at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:229) [org.apache.sling.event:4.2.12]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: javax/net/SocketFactory
	at com.microsoft.sqlserver.jdbc.SocketFinder.getSocketFactory(IOBuffer.java:2636)
	at com.microsoft.sqlserver.jdbc.SocketFinder.getConnectedSocket(IOBuffer.java:2687)
	at com.microsoft.sqlserver.jdbc.SocketFinder.getDefaultSocket(IOBuffer.java:2674)
	at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2358)
	at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:672)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2747)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2418)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2265)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1291)

 

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jdbc
Bundle-SymbolicName: com.s360g.mssql.jdbc
Bundle-Version: 1.0.0
Automatic-Module-Name: com.s360g.mssql.jdbc
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.microsoft.sqlserver.jdbc,
 microsoft.sql
Import-Package: javax.naming,
 javax.naming.spi,
 javax.net,
 javax.net.ssl,
 javax.security.auth,
 javax.security.auth.login,
 javax.security.auth.x500,
 javax.sql,
 javax.transaction.xa,
 javax.xml.parsers,
 javax.xml.stream,
 javax.xml.transform,
 javax.xml.transform.dom,
 javax.xml.transform.sax,
 javax.xml.transform.stax,
 javax.xml.transform.stream,
 org.ietf.jgss,
 org.w3c.dom,
 org.xml.sax,
 org.xml.sax.helpers

 

crich2784_0-1622724951606.png

 

Help would be appreciated.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

javax.net should be provided by the java runtime, and for that reason the Felix Framework makes the export of that package. Nevertheless I am not sure what happens if that package is provided by the Java runtime.

 

What version of Java are you using? Can you show the version as exposed in the MBean java.lang:Runtime of AEM (/system/console/jmx)

View solution in original post

5 Replies

Avatar

Correct answer by
Employee Advisor

javax.net should be provided by the java runtime, and for that reason the Felix Framework makes the export of that package. Nevertheless I am not sure what happens if that package is provided by the Java runtime.

 

What version of Java are you using? Can you show the version as exposed in the MBean java.lang:Runtime of AEM (/system/console/jmx)

Avatar

Level 7
Thank you for replying. Jorg, I might be overcomplicating this. Maybe I do not need to wrap into OSGI container. I just tried to point straight to the jar downloaded from Microsoft as it has an osgi Activator,etc in the jar. That worked and started. Still having a problem finding my JDBC DataSource but, maybe the driver issue is solved. Verifying my direction would be great.

Avatar

Level 7
Looks like service won't start: org.osgi.service.jdbc cannot be resolved.

Avatar

Level 7
Ok, I used version 6.2 and it installed and is running.