How to add javax.activation.DataSource to App Engine devserver?What is the replacement for javax.activation package in java 9?java.lang.NoClassDefFoundError: javax/activation/DataSource on wsimport Intellij java 9NoClassDefFoundError: javax/activation/DataSourceMigration to JDK 11 has error occure “java.lang.NoClassDefFoundError: javax/activation/DataSource” (tomcat 9.0.12)java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStartedDeployment error after upgrading to java8 (GAE Standard Environment)auth for local dev server doesn't workNoClassDefFoundError when running server - GoogleAppEngine/MavenSOLR7 error parsing word documentGetting error when adding second domain in JScapeDeploying intellij maven project to azure web apps using FTP, getting a 500 server errorObjectifyService.begin() throws IllegalStateExceptionDatastoreException throws Non-protobuf error! Problem accessing IDproject:commit

Russian equivalents of "no love lost"

Can a black dragonborn's acid breath weapon destroy objects?

Do any instruments not produce overtones?

Is the term 'open source' a trademark?

Average spam confidence

Implement Homestuck's Catenative Doomsday Dice Cascader

Where does "0 packages can be updated." come from?

How water is heavier than petrol eventhough its molecular weight less than petrol?

Indirectly defined macros: Undefined macro with "@" does not trigger compile error

How to retract an idea already pitched to an employer?

At what point in time did Dumbledore ask Snape to do this thing?

Do simulator games use a realistic trajectory to get into orbit?

Turing patterns

Should I give professor gift at the beginning of my PhD?

Genetic limitations to learn certain instruments

Argon vs nitrogen for preserving wine

How powerful is a "Breathe Air" spell?

Frame failure sudden death?

Last survivors from different time periods living together

Avoiding cliches when writing gods

Example of non-trivial functors

Confusion about off peak timings of London trains

Why only the fundamental frequency component is said to give useful power?

Company did not petition for visa in a timely manner. Is asking me to work from overseas, but wants me to take a paycut



How to add javax.activation.DataSource to App Engine devserver?


What is the replacement for javax.activation package in java 9?java.lang.NoClassDefFoundError: javax/activation/DataSource on wsimport Intellij java 9NoClassDefFoundError: javax/activation/DataSourceMigration to JDK 11 has error occure “java.lang.NoClassDefFoundError: javax/activation/DataSource” (tomcat 9.0.12)java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStartedDeployment error after upgrading to java8 (GAE Standard Environment)auth for local dev server doesn't workNoClassDefFoundError when running server - GoogleAppEngine/MavenSOLR7 error parsing word documentGetting error when adding second domain in JScapeDeploying intellij maven project to azure web apps using FTP, getting a 500 server errorObjectifyService.begin() throws IllegalStateExceptionDatastoreException throws Non-protobuf error! Problem accessing IDproject:commit






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








6















tl;dr: How do I add the javax.activation.DataSource dependency to a server run through the App Engine Maven plugin?



I'm using the App Engine Maven plugin to deploy to a local App Engine server, and I'm trying to use the Blobstore API to upload a file. I'm using Java 11.



pom.xml



<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.happycoding</groupId>
<artifactId>blobstore-test</artifactId>
<version>1</version>
<packaging>war</packaging>

<properties>
<!-- App Engine currently supports Java 8 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>1.2.5</version>
</dependency>

<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.59</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.71</version>
</plugin>
</plugins>
</build>
</project>


index.jsp



<%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>

<form action="<%= BlobstoreServiceFactory.getBlobstoreService().createUploadUrl("/submit") %>"
method="POST"
enctype="multipart/form-data">

Enter some text:
<br/>
<textarea name="text"></textarea>
<br/>
Select a file:
<input type="file" name="image">
<br/>
<input type="submit" value="Submit">
</form>

</body>
</html>


SubmitServlet.java



package io.happycoding.servlets;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/submit")
public class SubmitServlet extends HttpServlet

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
System.out.println("data submitted");




Command to run the local server: mvn appengine:devserver



I can successfully run a local server, and I can see that the form is rendered correctly, including the Blobstore URL.



However, when I submit the form, I get this error:



java.lang.NoClassDefFoundError: javax/activation/DataSource
at com.google.appengine.api.blobstore.dev.UploadBlobServlet.handleUpload(UploadBlobServlet.java:171)
at com.google.appengine.api.blobstore.dev.UploadBlobServlet.access$000(UploadBlobServlet.java:69)
at com.google.appengine.api.blobstore.dev.UploadBlobServlet$1.run(UploadBlobServlet.java:115)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.api.blobstore.dev.UploadBlobServlet.doPost(UploadBlobServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:134)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at com.google.appengine.tools.development.jetty9.StaticFileFilter.doFilter(StaticFileFilter.java:123)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at com.google.appengine.tools.development.DevAppServerRequestLogFilter.doFilter(DevAppServerRequestLogFilter.java:44)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
at com.google.appengine.tools.development.jetty9.DevAppEngineWebAppContext.doScope(DevAppEngineWebAppContext.java:94)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at com.google.appengine.tools.development.jetty9.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:595)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:502)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at com.google.appengine.tools.development.DevAppServerClassLoader.loadClass(DevAppServerClassLoader.java:108)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 57 more


Some Googling reveals quite a few questions about this problem:



  • Migration to JDK 11 has error occure “java.lang.NoClassDefFoundError: javax/activation/DataSource”

  • java.lang.NoClassDefFoundError: javax/activation/DataSource on wsimport Intellij java 9

  • What is the replacement for javax.activation package in java 9?

  • NoClassDefFoundError: javax/activation/DataSource

The answers to these questions suggest adding a combination of these dependencies:



<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>

<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>

<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>


I've tried adding each of these, and I've tried adding all of them. But no matter what, I still get the above error.



I understand why this is happening: Java 8 included the javax.activation.DataSource class, and it was subsequently removed. So since I'm using Java 11, that class is missing. But none of the dependencies I've tried so far seem to provide the missing class, possibly because I'm using the App Engine Maven plugin instead of running my own server?



How do I add this dependency to a project that uses the App Engine Maven plugin?










share|improve this question




























    6















    tl;dr: How do I add the javax.activation.DataSource dependency to a server run through the App Engine Maven plugin?



    I'm using the App Engine Maven plugin to deploy to a local App Engine server, and I'm trying to use the Blobstore API to upload a file. I'm using Java 11.



    pom.xml



    <project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.happycoding</groupId>
    <artifactId>blobstore-test</artifactId>
    <version>1</version>
    <packaging>war</packaging>

    <properties>
    <!-- App Engine currently supports Java 8 -->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    </properties>

    <dependencies>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>4.0.1</version>
    <scope>provided</scope>
    </dependency>

    <dependency>
    <groupId>org.apache.taglibs</groupId>
    <artifactId>taglibs-standard-spec</artifactId>
    <version>1.2.5</version>
    </dependency>

    <dependency>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-api-1.0-sdk</artifactId>
    <version>1.9.59</version>
    </dependency>

    </dependencies>

    <build>
    <plugins>
    <plugin>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-maven-plugin</artifactId>
    <version>1.9.71</version>
    </plugin>
    </plugins>
    </build>
    </project>


    index.jsp



    <%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    </head>
    <body>

    <form action="<%= BlobstoreServiceFactory.getBlobstoreService().createUploadUrl("/submit") %>"
    method="POST"
    enctype="multipart/form-data">

    Enter some text:
    <br/>
    <textarea name="text"></textarea>
    <br/>
    Select a file:
    <input type="file" name="image">
    <br/>
    <input type="submit" value="Submit">
    </form>

    </body>
    </html>


    SubmitServlet.java



    package io.happycoding.servlets;

    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    @WebServlet("/submit")
    public class SubmitServlet extends HttpServlet

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    System.out.println("data submitted");




    Command to run the local server: mvn appengine:devserver



    I can successfully run a local server, and I can see that the form is rendered correctly, including the Blobstore URL.



    However, when I submit the form, I get this error:



    java.lang.NoClassDefFoundError: javax/activation/DataSource
    at com.google.appengine.api.blobstore.dev.UploadBlobServlet.handleUpload(UploadBlobServlet.java:171)
    at com.google.appengine.api.blobstore.dev.UploadBlobServlet.access$000(UploadBlobServlet.java:69)
    at com.google.appengine.api.blobstore.dev.UploadBlobServlet$1.run(UploadBlobServlet.java:115)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at com.google.appengine.api.blobstore.dev.UploadBlobServlet.doPost(UploadBlobServlet.java:112)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
    at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:134)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at com.google.appengine.tools.development.jetty9.StaticFileFilter.doFilter(StaticFileFilter.java:123)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at com.google.appengine.tools.development.DevAppServerRequestLogFilter.doFilter(DevAppServerRequestLogFilter.java:44)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
    at com.google.appengine.tools.development.jetty9.DevAppEngineWebAppContext.doScope(DevAppEngineWebAppContext.java:94)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at com.google.appengine.tools.development.jetty9.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:595)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:502)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
    at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at com.google.appengine.tools.development.DevAppServerClassLoader.loadClass(DevAppServerClassLoader.java:108)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 57 more


    Some Googling reveals quite a few questions about this problem:



    • Migration to JDK 11 has error occure “java.lang.NoClassDefFoundError: javax/activation/DataSource”

    • java.lang.NoClassDefFoundError: javax/activation/DataSource on wsimport Intellij java 9

    • What is the replacement for javax.activation package in java 9?

    • NoClassDefFoundError: javax/activation/DataSource

    The answers to these questions suggest adding a combination of these dependencies:



    <dependency>
    <groupId>javax.activation</groupId>
    <artifactId>javax.activation-api</artifactId>
    <version>1.2.0</version>
    </dependency>

    <dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1.1</version>
    </dependency>

    <dependency>
    <groupId>com.sun.activation</groupId>
    <artifactId>javax.activation</artifactId>
    <version>1.2.0</version>
    </dependency>


    I've tried adding each of these, and I've tried adding all of them. But no matter what, I still get the above error.



    I understand why this is happening: Java 8 included the javax.activation.DataSource class, and it was subsequently removed. So since I'm using Java 11, that class is missing. But none of the dependencies I've tried so far seem to provide the missing class, possibly because I'm using the App Engine Maven plugin instead of running my own server?



    How do I add this dependency to a project that uses the App Engine Maven plugin?










    share|improve this question
























      6












      6








      6


      1






      tl;dr: How do I add the javax.activation.DataSource dependency to a server run through the App Engine Maven plugin?



      I'm using the App Engine Maven plugin to deploy to a local App Engine server, and I'm trying to use the Blobstore API to upload a file. I'm using Java 11.



      pom.xml



      <project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>

      <groupId>io.happycoding</groupId>
      <artifactId>blobstore-test</artifactId>
      <version>1</version>
      <packaging>war</packaging>

      <properties>
      <!-- App Engine currently supports Java 8 -->
      <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <failOnMissingWebXml>false</failOnMissingWebXml>
      </properties>

      <dependencies>
      <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>4.0.1</version>
      <scope>provided</scope>
      </dependency>

      <dependency>
      <groupId>org.apache.taglibs</groupId>
      <artifactId>taglibs-standard-spec</artifactId>
      <version>1.2.5</version>
      </dependency>

      <dependency>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-api-1.0-sdk</artifactId>
      <version>1.9.59</version>
      </dependency>

      </dependencies>

      <build>
      <plugins>
      <plugin>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-maven-plugin</artifactId>
      <version>1.9.71</version>
      </plugin>
      </plugins>
      </build>
      </project>


      index.jsp



      <%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>

      <!DOCTYPE html>
      <html>
      <head>
      <meta charset="UTF-8">
      </head>
      <body>

      <form action="<%= BlobstoreServiceFactory.getBlobstoreService().createUploadUrl("/submit") %>"
      method="POST"
      enctype="multipart/form-data">

      Enter some text:
      <br/>
      <textarea name="text"></textarea>
      <br/>
      Select a file:
      <input type="file" name="image">
      <br/>
      <input type="submit" value="Submit">
      </form>

      </body>
      </html>


      SubmitServlet.java



      package io.happycoding.servlets;

      import javax.servlet.annotation.WebServlet;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;

      @WebServlet("/submit")
      public class SubmitServlet extends HttpServlet

      @Override
      public void doPost(HttpServletRequest request, HttpServletResponse response)
      System.out.println("data submitted");




      Command to run the local server: mvn appengine:devserver



      I can successfully run a local server, and I can see that the form is rendered correctly, including the Blobstore URL.



      However, when I submit the form, I get this error:



      java.lang.NoClassDefFoundError: javax/activation/DataSource
      at com.google.appengine.api.blobstore.dev.UploadBlobServlet.handleUpload(UploadBlobServlet.java:171)
      at com.google.appengine.api.blobstore.dev.UploadBlobServlet.access$000(UploadBlobServlet.java:69)
      at com.google.appengine.api.blobstore.dev.UploadBlobServlet$1.run(UploadBlobServlet.java:115)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at com.google.appengine.api.blobstore.dev.UploadBlobServlet.doPost(UploadBlobServlet.java:112)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
      at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:134)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.tools.development.jetty9.StaticFileFilter.doFilter(StaticFileFilter.java:123)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
      at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
      at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.tools.development.DevAppServerRequestLogFilter.doFilter(DevAppServerRequestLogFilter.java:44)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
      at com.google.appengine.tools.development.jetty9.DevAppEngineWebAppContext.doScope(DevAppEngineWebAppContext.java:94)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      at com.google.appengine.tools.development.jetty9.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:595)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      at org.eclipse.jetty.server.Server.handle(Server.java:502)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
      at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
      at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
      at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
      at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
      at com.google.appengine.tools.development.DevAppServerClassLoader.loadClass(DevAppServerClassLoader.java:108)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      ... 57 more


      Some Googling reveals quite a few questions about this problem:



      • Migration to JDK 11 has error occure “java.lang.NoClassDefFoundError: javax/activation/DataSource”

      • java.lang.NoClassDefFoundError: javax/activation/DataSource on wsimport Intellij java 9

      • What is the replacement for javax.activation package in java 9?

      • NoClassDefFoundError: javax/activation/DataSource

      The answers to these questions suggest adding a combination of these dependencies:



      <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>javax.activation-api</artifactId>
      <version>1.2.0</version>
      </dependency>

      <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <version>1.1.1</version>
      </dependency>

      <dependency>
      <groupId>com.sun.activation</groupId>
      <artifactId>javax.activation</artifactId>
      <version>1.2.0</version>
      </dependency>


      I've tried adding each of these, and I've tried adding all of them. But no matter what, I still get the above error.



      I understand why this is happening: Java 8 included the javax.activation.DataSource class, and it was subsequently removed. So since I'm using Java 11, that class is missing. But none of the dependencies I've tried so far seem to provide the missing class, possibly because I'm using the App Engine Maven plugin instead of running my own server?



      How do I add this dependency to a project that uses the App Engine Maven plugin?










      share|improve this question














      tl;dr: How do I add the javax.activation.DataSource dependency to a server run through the App Engine Maven plugin?



      I'm using the App Engine Maven plugin to deploy to a local App Engine server, and I'm trying to use the Blobstore API to upload a file. I'm using Java 11.



      pom.xml



      <project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>

      <groupId>io.happycoding</groupId>
      <artifactId>blobstore-test</artifactId>
      <version>1</version>
      <packaging>war</packaging>

      <properties>
      <!-- App Engine currently supports Java 8 -->
      <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <failOnMissingWebXml>false</failOnMissingWebXml>
      </properties>

      <dependencies>
      <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>4.0.1</version>
      <scope>provided</scope>
      </dependency>

      <dependency>
      <groupId>org.apache.taglibs</groupId>
      <artifactId>taglibs-standard-spec</artifactId>
      <version>1.2.5</version>
      </dependency>

      <dependency>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-api-1.0-sdk</artifactId>
      <version>1.9.59</version>
      </dependency>

      </dependencies>

      <build>
      <plugins>
      <plugin>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-maven-plugin</artifactId>
      <version>1.9.71</version>
      </plugin>
      </plugins>
      </build>
      </project>


      index.jsp



      <%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>

      <!DOCTYPE html>
      <html>
      <head>
      <meta charset="UTF-8">
      </head>
      <body>

      <form action="<%= BlobstoreServiceFactory.getBlobstoreService().createUploadUrl("/submit") %>"
      method="POST"
      enctype="multipart/form-data">

      Enter some text:
      <br/>
      <textarea name="text"></textarea>
      <br/>
      Select a file:
      <input type="file" name="image">
      <br/>
      <input type="submit" value="Submit">
      </form>

      </body>
      </html>


      SubmitServlet.java



      package io.happycoding.servlets;

      import javax.servlet.annotation.WebServlet;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;

      @WebServlet("/submit")
      public class SubmitServlet extends HttpServlet

      @Override
      public void doPost(HttpServletRequest request, HttpServletResponse response)
      System.out.println("data submitted");




      Command to run the local server: mvn appengine:devserver



      I can successfully run a local server, and I can see that the form is rendered correctly, including the Blobstore URL.



      However, when I submit the form, I get this error:



      java.lang.NoClassDefFoundError: javax/activation/DataSource
      at com.google.appengine.api.blobstore.dev.UploadBlobServlet.handleUpload(UploadBlobServlet.java:171)
      at com.google.appengine.api.blobstore.dev.UploadBlobServlet.access$000(UploadBlobServlet.java:69)
      at com.google.appengine.api.blobstore.dev.UploadBlobServlet$1.run(UploadBlobServlet.java:115)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at com.google.appengine.api.blobstore.dev.UploadBlobServlet.doPost(UploadBlobServlet.java:112)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
      at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:134)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.tools.development.jetty9.StaticFileFilter.doFilter(StaticFileFilter.java:123)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
      at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
      at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      at com.google.appengine.tools.development.DevAppServerRequestLogFilter.doFilter(DevAppServerRequestLogFilter.java:44)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)
      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
      at com.google.appengine.tools.development.jetty9.DevAppEngineWebAppContext.doScope(DevAppEngineWebAppContext.java:94)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      at com.google.appengine.tools.development.jetty9.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:595)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      at org.eclipse.jetty.server.Server.handle(Server.java:502)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
      at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
      at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
      at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
      at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
      at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
      at com.google.appengine.tools.development.DevAppServerClassLoader.loadClass(DevAppServerClassLoader.java:108)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      ... 57 more


      Some Googling reveals quite a few questions about this problem:



      • Migration to JDK 11 has error occure “java.lang.NoClassDefFoundError: javax/activation/DataSource”

      • java.lang.NoClassDefFoundError: javax/activation/DataSource on wsimport Intellij java 9

      • What is the replacement for javax.activation package in java 9?

      • NoClassDefFoundError: javax/activation/DataSource

      The answers to these questions suggest adding a combination of these dependencies:



      <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>javax.activation-api</artifactId>
      <version>1.2.0</version>
      </dependency>

      <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <version>1.1.1</version>
      </dependency>

      <dependency>
      <groupId>com.sun.activation</groupId>
      <artifactId>javax.activation</artifactId>
      <version>1.2.0</version>
      </dependency>


      I've tried adding each of these, and I've tried adding all of them. But no matter what, I still get the above error.



      I understand why this is happening: Java 8 included the javax.activation.DataSource class, and it was subsequently removed. So since I'm using Java 11, that class is missing. But none of the dependencies I've tried so far seem to provide the missing class, possibly because I'm using the App Engine Maven plugin instead of running my own server?



      How do I add this dependency to a project that uses the App Engine Maven plugin?







      java maven google-app-engine blobstore appengine-maven-plugin






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 15:39









      Kevin WorkmanKevin Workman

      34.8k64374




      34.8k64374






















          2 Answers
          2






          active

          oldest

          votes


















          1














          Google App Engine doesn't support Java 11. It only supports Java 8.






          share|improve this answer























          • Yes, I know that. I'm asking how I can deploy locally with a later version of Java. Is there some official documentation that says this is not supported?

            – Kevin Workman
            Mar 28 at 16:39


















          1














          I'd first try adding



          <dependency>
          <groupId>javax.activation</groupId>
          <artifactId>activation</artifactId>
          <version>1.1.1</version>
          </dependency>


          as you pointed out, but my expectation is that you're getting the NoClassDefFound error because the javax.activation classes aren't getting added to the war by maven. I still mostly do my jar/war/ear building with Ant for this very reason: more verbose, but less magic. If you look in your project's /target folder you should be able to see the war file: if you do a jar tf <warfile> you should be able to see all the jar files added to WEB-INF/lib, and this will tell you if it is adding the activation jar.



          Looking at https://github.com/GoogleCloudPlatform/appengine-maven-plugin, the recommended sample includes this plugin:



          <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>2.3</version>
          <configuration>
          <archiveClasses>true</archiveClasses>
          </configuration>
          </plugin>


          before the appengine-maven-plugin entry in the build section of your pom. I'd put that in and then see if it properly builds the war.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325496%2fhow-to-add-javax-activation-datasource-to-app-engine-devserver%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Google App Engine doesn't support Java 11. It only supports Java 8.






            share|improve this answer























            • Yes, I know that. I'm asking how I can deploy locally with a later version of Java. Is there some official documentation that says this is not supported?

              – Kevin Workman
              Mar 28 at 16:39















            1














            Google App Engine doesn't support Java 11. It only supports Java 8.






            share|improve this answer























            • Yes, I know that. I'm asking how I can deploy locally with a later version of Java. Is there some official documentation that says this is not supported?

              – Kevin Workman
              Mar 28 at 16:39













            1












            1








            1







            Google App Engine doesn't support Java 11. It only supports Java 8.






            share|improve this answer













            Google App Engine doesn't support Java 11. It only supports Java 8.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 28 at 4:16









            Zack LaValleeZack LaVallee

            896




            896












            • Yes, I know that. I'm asking how I can deploy locally with a later version of Java. Is there some official documentation that says this is not supported?

              – Kevin Workman
              Mar 28 at 16:39

















            • Yes, I know that. I'm asking how I can deploy locally with a later version of Java. Is there some official documentation that says this is not supported?

              – Kevin Workman
              Mar 28 at 16:39
















            Yes, I know that. I'm asking how I can deploy locally with a later version of Java. Is there some official documentation that says this is not supported?

            – Kevin Workman
            Mar 28 at 16:39





            Yes, I know that. I'm asking how I can deploy locally with a later version of Java. Is there some official documentation that says this is not supported?

            – Kevin Workman
            Mar 28 at 16:39













            1














            I'd first try adding



            <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
            </dependency>


            as you pointed out, but my expectation is that you're getting the NoClassDefFound error because the javax.activation classes aren't getting added to the war by maven. I still mostly do my jar/war/ear building with Ant for this very reason: more verbose, but less magic. If you look in your project's /target folder you should be able to see the war file: if you do a jar tf <warfile> you should be able to see all the jar files added to WEB-INF/lib, and this will tell you if it is adding the activation jar.



            Looking at https://github.com/GoogleCloudPlatform/appengine-maven-plugin, the recommended sample includes this plugin:



            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
            <archiveClasses>true</archiveClasses>
            </configuration>
            </plugin>


            before the appengine-maven-plugin entry in the build section of your pom. I'd put that in and then see if it properly builds the war.






            share|improve this answer



























              1














              I'd first try adding



              <dependency>
              <groupId>javax.activation</groupId>
              <artifactId>activation</artifactId>
              <version>1.1.1</version>
              </dependency>


              as you pointed out, but my expectation is that you're getting the NoClassDefFound error because the javax.activation classes aren't getting added to the war by maven. I still mostly do my jar/war/ear building with Ant for this very reason: more verbose, but less magic. If you look in your project's /target folder you should be able to see the war file: if you do a jar tf <warfile> you should be able to see all the jar files added to WEB-INF/lib, and this will tell you if it is adding the activation jar.



              Looking at https://github.com/GoogleCloudPlatform/appengine-maven-plugin, the recommended sample includes this plugin:



              <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-war-plugin</artifactId>
              <version>2.3</version>
              <configuration>
              <archiveClasses>true</archiveClasses>
              </configuration>
              </plugin>


              before the appengine-maven-plugin entry in the build section of your pom. I'd put that in and then see if it properly builds the war.






              share|improve this answer

























                1












                1








                1







                I'd first try adding



                <dependency>
                <groupId>javax.activation</groupId>
                <artifactId>activation</artifactId>
                <version>1.1.1</version>
                </dependency>


                as you pointed out, but my expectation is that you're getting the NoClassDefFound error because the javax.activation classes aren't getting added to the war by maven. I still mostly do my jar/war/ear building with Ant for this very reason: more verbose, but less magic. If you look in your project's /target folder you should be able to see the war file: if you do a jar tf <warfile> you should be able to see all the jar files added to WEB-INF/lib, and this will tell you if it is adding the activation jar.



                Looking at https://github.com/GoogleCloudPlatform/appengine-maven-plugin, the recommended sample includes this plugin:



                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                <archiveClasses>true</archiveClasses>
                </configuration>
                </plugin>


                before the appengine-maven-plugin entry in the build section of your pom. I'd put that in and then see if it properly builds the war.






                share|improve this answer













                I'd first try adding



                <dependency>
                <groupId>javax.activation</groupId>
                <artifactId>activation</artifactId>
                <version>1.1.1</version>
                </dependency>


                as you pointed out, but my expectation is that you're getting the NoClassDefFound error because the javax.activation classes aren't getting added to the war by maven. I still mostly do my jar/war/ear building with Ant for this very reason: more verbose, but less magic. If you look in your project's /target folder you should be able to see the war file: if you do a jar tf <warfile> you should be able to see all the jar files added to WEB-INF/lib, and this will tell you if it is adding the activation jar.



                Looking at https://github.com/GoogleCloudPlatform/appengine-maven-plugin, the recommended sample includes this plugin:



                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                <archiveClasses>true</archiveClasses>
                </configuration>
                </plugin>


                before the appengine-maven-plugin entry in the build section of your pom. I'd put that in and then see if it properly builds the war.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 2 at 14:52









                FemiFemi

                59.8k8101131




                59.8k8101131



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid …


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325496%2fhow-to-add-javax-activation-datasource-to-app-engine-devserver%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

                    Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?