1

I am deploying webapp to the openshift cloud.

While compiling the resources by maven automatically after deploying, it shows Base64: symbol not found However when I maven compile it on my Pc, their are no errors and build is successfull. I tried to change Base64 from java.util to apache.commons.codecs. The error is still there while deploying and it successfully runs at my local machine

Following is the pom.xml

           <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <inherited>true</inherited>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>

 <dependencies>
<dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.4</version>
    </dependency>

Should I place the commons-codec jar in WEB_INF directory. i read the solution somewhere but was not sure about it. please suggest a solution. Thank you

</dependencies>
Irshad
  • 1,016
  • 11
  • 30

1 Answers1

2

My guess is that you're using JDK 8 on your machine, but JDK 7 where the error is happening as java.util.Base64 is only available since Java SE 8.

I recommend to use the same Java version on both machines.

Otherwise you should consider cross-compiling. Just setting the source and target level is not enough, as you can see, as you're still able to call new APIs.

Puce
  • 37,247
  • 13
  • 80
  • 152
  • I am using apache.commons.codes. Are they also dependent on java8 ? – Irshad Jul 23 '15 at 14:58
  • You mentioned java.util.Base64. Please provide the error stack trace for both cases. Did you replace all references to java.util.Base64? – Puce Jul 23 '15 at 15:00
  • "I tried to change Base64 from java.util to apache.commons.codecs. The error is still there while deploying and it successfully runs at my local machine".. I already mentioned that I switched from `java.util` to `apache.commons`. Anyway, i solved the issue. basically issues are with java.util. `apache.commons` works.. Thank you for ur time – Irshad Jul 23 '15 at 15:15
  • @Sheikh_Irshad I've read that you tried that. Again, please provide the stack trace for both cases or at least the one where you're using Apache Commons. – Puce Jul 23 '15 at 15:20