Google maps extensions does not find fragment R.id.map - android-maps-extensions

I use google maps extensions library in my app, when I update android version to 5.0 I get NullPointerException at line:
mMap = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map)).getExtendedMap();
findFragmentById(R.id.map) is null
Anybody knows why?
Thanks.
layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/mapParent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="fill_horizontal" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.androidmapsextensions.SupportMapFragment" /></RelativeLayout>
LogCat:
12-08 11:56:57.544: E/AndroidRuntime(20846): FATAL EXCEPTION: main
12-08 11:56:57.544: E/AndroidRuntime(20846): java.lang.NullPointerException
12-08 11:56:57.544: E/AndroidRuntime(20846): at com.analyticadesign.eds.MapPage.setUpMapIfNeeded(MapPage.java:422)
12-08 11:56:57.544: E/AndroidRuntime(20846): at com.analyticadesign.eds.MapPage.onActivityCreated(MapPage.java:321)
12-08 11:56:57.544: E/AndroidRuntime(20846): at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1794)
...

Related

Jboss connection pool doesn't connect with the DataBase

I am using JBoss 7.1, and I'm trying to create a Database Connection Pool through Application Server. I'm using a mysql DB, but I tried also with a Postgre database and the error is just the same. Everything seems to be OK, but when I try to access to the application, it appears an error on console that advises me that the connection with the database was failed. My code is the following:
My Jboss standalone.xml.
<datasource jndi-name="java:jboss/jdbc/exampleDS" pool-name="jdbc/exampleDS" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://127.0.0.1:3306/example?useSSL=false</connection-url>
<driver>mysql-connector-java-5.1.43-bin.jar</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>root</user-name>
<password>password</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
</datasource>
<driver name="mysql-connector-java-5.1.43-bin.jar" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</xa-datasource-class>
</driver>
My web.xml
<resource-ref>
<description>example</description>
<res-ref-name>jdbc/exampleDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
My javacode
private ServiceLocator() {
try {
this.initCtx = new InitialContext();
this.envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
envCtx.lookup("jdbc/exampleDS");
} catch (NamingException e) {
ApplicationException apRE = new ApplicationException(ErrorCode.E_JDNI001, e);
LogService.getLog().fatal(apRE.getMessage(), apRE);
throw apRE;
}
}
Finally, when I start my jboss server, none error appears, but the console said that the tables of my DB don't exist.
I appreciate help <3
I had fixed the error.
First thing to do is creating a jboss-web.xml where web.xml, in my case, webapp/WEB-INF. It must be similar to the following:
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/exampleDS</res-ref-name>
<jndi-name>java:jboss/jdbc/exampleDS</jndi-name>
</resource-ref>
</jboss-web>
Once that is created, we must create a module.xml inside of modules->com->mysql->main, containing the following:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.43-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
You have to insert also, the .jar that you used also inside of the main dir.
Regarding the javacode, you need to change the initCtx.lookup("java:comp/env"); for this: initCtx.lookup("java:");
That's all :)

Application stops with an Error after launching in android Studio Emulator in 3 sec or less

I developed an app from example from WebView load website when online, load local file when offline and it sucessfully installed but now I'm getting error i.e is Splash screen loads and then suddenly it stop with Error "Unfortunately CDPRoutine ( !i.e my app ) is Stopped", I don't know what am I doing wrong ....Any Help would save me from getting insane and would be a much much great help.
Here is the code from Mainactivity.Java
package com.example.sagar.cdproutine;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
WebView webView;
Context context;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webView = new WebView( context );
webView.getSettings().setAppCacheMaxSize( 5 * 1024 * 1024 ); // 5MB
webView.getSettings().setAppCachePath( getApplicationContext().getCacheDir().getAbsolutePath() );
webView.getSettings().setAllowFileAccess( true );
webView.getSettings().setAppCacheEnabled( true );
webView.getSettings().setJavaScriptEnabled( true );
webView.getSettings().setCacheMode( WebSettings.LOAD_DEFAULT ); // load online by default
if ( !isNetworkAvailable() ) { // loading offline
webView.getSettings().setCacheMode( WebSettings.LOAD_CACHE_ELSE_NETWORK );
}
webView.loadUrl( "http://www.google.com" );
}
private boolean isNetworkAvailable() {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService( CONNECTIVITY_SERVICE );
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
}
Here is the Androidmanifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sagar.cdproutine">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/app"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"></activity>
</application>
</manifest>
Here is Error I'm getting
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sagar.cdproutine, PID: 6624
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sagar.cdproutine/com.example.sagar.cdproutine.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at android.view.ViewConfiguration.get(ViewConfiguration.java:364)
at android.view.View.<init>(View.java:3788)
at android.view.View.<init>(View.java:3892)
at android.view.ViewGroup.<init>(ViewGroup.java:573)
at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
at android.webkit.WebView.<init>(WebView.java:597)
at android.webkit.WebView.<init>(WebView.java:542)
at android.webkit.WebView.<init>(WebView.java:525)
at android.webkit.WebView.<init>(WebView.java:512)
at android.webkit.WebView.<init>(WebView.java:502)
at com.example.sagar.cdproutine.MainActivity.onCreate(MainActivity.java:26)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

Error when trying to create custom Json to XML transformer in Mule

I'm trying to create a custom Json to XML conversion in mule (custom transformer), its just a one to one direct mapping values, not a complex transformation.
here is my flow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" basePath="/test" doc:name="HTTP Listener Configuration"/>
<flow name="test_finalFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<json:json-to-xml-transformer metadata:id="57c0cd3d-ece4-48fe-9adf-79fc36a31b12" doc:name="JSON to XML"/>
<logger level="INFO" doc:name="Logger"/>
</flow>
</mule>
I'm using theses files to configure my Json to XML component
jsonFile.json:
{
"inData": "value"
}
xml file: outData.xml
<?xml version='1.0' encoding='UTF-8'?>
<root>
<outData>someValue</outData>
</root>
setting the metadata:
right now when I deploy the application I do not have any problem,
but when I use postman to send a POST data with payload I got these errors:
and this is the full output of the console:
*******************************************************************************************************
* - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - *
*******************************************************************************************************
* test_final * default * DEPLOYED *
*******************************************************************************************************
ERROR 2017-01-17 21:23:29,014 [[test_final].HTTP_Listener_Configuration.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : java.io.IOException: Illegal character: <i> (javax.xml.stream.XMLStreamException)
Payload : org.glassfish.grizzly.utils.BufferInputStream#526ed3db
Transformer : JsonToXml{this=6993c8df, name='JsonToString', ignoreBadInput=false, returnClass=SimpleDataType{type=java.lang.String, mimeType='text/xml', encoding='null'}, sourceTypes=[SimpleDataType{type=java.lang.String, mimeType='*/*', encoding='null'}, SimpleDataType{type=java.io.InputStream, mimeType='*/*', encoding='null'}, SimpleDataType{type=[B, mimeType='*/*', encoding='null'}, SimpleDataType{type=java.io.Reader, mimeType='*/*', encoding='null'}, SimpleDataType{type=java.net.URL, mimeType='*/*', encoding='null'}, SimpleDataType{type=java.io.File, mimeType='*/*', encoding='null'}]}
Element : /test_finalFlow/processors/0 # test_final:test_final.xml:13 (JSON to XML)
Element XML : <json:json-to-xml-transformer metadata:id="57c0cd3d-ece4-48fe-9adf-79fc36a31b12" doc:name="JSON to XML"></json:json-to-xml-transformer>
--------------------------------------------------------------------------------
Root Exception stack trace:
java.io.IOException: Illegal character: <i>
at de.odysseus.staxon.json.stream.impl.Yylex.yylex(Yylex.java:641)
at de.odysseus.staxon.json.stream.impl.Yylex.nextSymbol(Yylex.java:271)
at de.odysseus.staxon.json.stream.impl.JsonStreamSourceImpl.next(JsonStreamSourceImpl.java:107)
at de.odysseus.staxon.json.stream.impl.JsonStreamSourceImpl.peek(JsonStreamSourceImpl.java:250)
at de.odysseus.staxon.json.JsonXMLStreamReader.consume(JsonXMLStreamReader.java:128)
at de.odysseus.staxon.json.JsonXMLStreamReader.consume(JsonXMLStreamReader.java:161)
at de.odysseus.staxon.base.AbstractXMLStreamReader.initialize(AbstractXMLStreamReader.java:216)
at de.odysseus.staxon.json.JsonXMLStreamReader.<init>(JsonXMLStreamReader.java:65)
at de.odysseus.staxon.json.JsonXMLInputFactory.createXMLStreamReader(JsonXMLInputFactory.java:139)
at de.odysseus.staxon.json.JsonXMLInputFactory.createXMLStreamReader(JsonXMLInputFactory.java:120)
at de.odysseus.staxon.json.JsonXMLInputFactory.createXMLStreamReader(JsonXMLInputFactory.java:44)
at org.mule.module.json.transformers.JsonToXml.doTransform(JsonToXml.java:55)
at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:415)
at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:366)
at org.mule.DefaultMuleMessage.transformMessage(DefaultMuleMessage.java:1589)
at org.mule.DefaultMuleMessage.applyAllTransformers(DefaultMuleMessage.java:1488)
at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1462)
at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1454)
at org.mule.transformer.AbstractTransformer.process(AbstractTransformer.java:114)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:102)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.construct.DynamicPipelineMessageProcessor.process(DynamicPipelineMessageProcessor.java:55)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88)
Any idea about what causing the error ?
java.io.IOException: Illegal character: i ?
Note:
I'm trying to create this custom transformer because I'm using just Mule server 3.8.1 CE right now , I'll get access soon to an enterprise edition version that's why I'm trying to deploy in a community edition server at this time.
please refer the below link for creating a custom json to xml transformer
https://docs.mulesoft.com/mule-user-guide/v/3.6/creating-custom-transformers

wildfly registering mysql as a datasource

I have been trying to configure mysql as a datasource in wildfly. I am not sure what i am missing out, i get an error on startup .
I have the mysql-connector-java-5.0.8-bin.jar and the module.xml in the folder:
"/wildfly-8.1.0.Final/modules/system/layers/base/com/mysql/main"
below are the files
module.xml
<module xmlns="urn:jboss:module:1.1"
name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.0.8.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
standalone.xml
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jta="true" jndi-name="java:jboss/datasources/proj" pool-name="proj" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>admin123</password>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
I have tested the jdbc connectivity with a standalone program in eclipse and it worked
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class ConnectSql {
public static void main(String []args){
String userName = "root";
String pass = "admin123";
String url = "jdbc:mysql://localhost/";
String driver ="com.mysql.jdbc.Driver";
String db = "proj";
try{
//registering the driver.
Class.forName(driver);
Connection con = DriverManager.getConnection(url+db,userName,pass);
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select f_name from t_users");
while(rs.next()){
System.out.println("name :"+rs.getString(1));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch(ClassNotFoundException cnf){
cnf.printStackTrace();
}
}
}
Referred to the below link and modified the module.xml
Wildfly 8.0.0 mysql problems with datasource
Here is a the error log i get on start up
02:45:17,169 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) JBAS014613: Operation ("add") failed -
address: ([
("subsystem" => "datasources"),
("data-source" => "proj") ]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.data-source.java:jboss/datasources/proj is missing [jboss.jdbc-driver.mysql]",
"jboss.driver-demander.java:jboss/datasources/proj is missing [jboss.jdbc-driver.mysql]" ]} 02:45:17,175 ERROR
[org.jboss.as.controller.management-operation] (Controller Boot
Thread) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "proj") ]) - failure description: {
"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.data-source.java:jboss/datasources/proj is missing [jboss.jdbc-driver.mysql]",
"jboss.driver-demander.java:jboss/datasources/proj is missing [jboss.jdbc-driver.mysql]"
],
"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {
"Services that were unable to start:" => [
"jboss.data-source.reference-factory.proj",
"jboss.naming.context.java.jboss.datasources.proj"
],
"Services that may be the cause:" => ["jboss.jdbc-driver.mysql"]
} }
To resolve the mysql datasource configuration issue on Wildfly i used the admin console to add the datasource and test it.
If you login to the web console and find the datasource you tried configuring disable
that a remove it . The standalone.xml and the module.xml get reset to the orginal.
Steps for accessing web console
Configure a new datasource :
name :mysql
JNDI :java:jboss/datasources/proj
Click next and enter the url (i used the below) and click enable and then click test
url : jdbc:mysql://localhost/proj
The test should show success
The changes to the standalone.xml and the module.xml are automatically made .
If you restart the server now it should start without any errors and you should be able to access the database from your web project
I have working configuration of mysql driver on wildfly.
<datasources>
// ...
<drivers>
// ...
<driver name="mysql" module="com.mysql.jdbc">
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<driver-class>com.mysql.jdbc.Driver</driver-class>
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
The little difference seems to be presence of "driver-class" tag.
I hope it will help.
(Deploying mysql driver as a deployment also works and it's recommended way. https://docs.jboss.org/author/display/WFLY8/DataSource+configuration )
[edit]
I have mysql module under wildfly/modules/com/mysql/jdbc/main/ . I've noticed just now you module path doesn't correspond to module name. And I haven't find any doc's just yet, but I don't think you should mess with modules/system directory.
module.xml
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql.jdbc">
<resources>
<resource-root path="mysql-connector-java-5.1.31-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Two things: I just got mine working, and have the driver and xml located in $JBOSS_HOME/modules/com/mysql/jdbc/main - I'm fairly new with this as well so I'm not sure if that matters. Another thing: I don't know if it is just a typo, but if it was just copied and pasted it looks like your JAR name is incorrect
<resource-root path="mysql-connector-java-5.0.8.jar"/>
when it should be
<resource-root path="mysql-connector-java-5.0.8-bin.jar"/>
I forgot the .jar in mine, and that ended up fixing it. Hope that helps!
This may happen when you download the mysql connector zip and uploading the zip as a deployment. But the correct way is to unzip your download and point to the contained jar.
There are three ways using which you can simply create datasource into wildfly
Using admin console
Manually adding into standalone.xml
Creating datasource file that is xml file.
Go to WildFly directory/standalone/deployments
Simplest way to create datasource xml with following content
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
<datasource jndi-name="APP_DS" pool-name="APP_DS" enabled="true" use-ccm="false">
<connection-url>jdbc:mysql://localhost:3306/DB_NAME</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<!-- sql to call when connection is created -->
<new-connection-sql>SELECT 1</new-connection-sql>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>50</max-pool-size>
</pool>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
<!-- sql to call on an existing pooled connection when it is obtained from pool -->
<validation>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
</validation>
<timeout>
<blocking-timeout-millis>300000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
<statement>
<track-statements>true</track-statements>
</statement>
</datasource>
</datasources>

Google Map V2 having trouble to display

Any idea what is wrong with my code?
I just want to display the map
but the map having force close error, when I onclick a textview.
I've done the necessary thing at the XML layout, by adding
android:onClick="onClick"
android:clickable="true"
I've check the map.java, actually, it is working fine.
I've also check the onclick textview too, it is also working fine.
However, when I want to link both together, meaning show map.java upon onclick textview. However it gave me error.
Can someone advice me what is wrong with my code?
Thank you in advance.
the onclick textview code:
I've implements the onclicklistener
#Override
public void onClick(View v) {
//TODO Auto-generated method stub
startActivity(new Intent(SingleMenuItemActivity.this,
map.class));
}
map.java
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
public class map extends FragmentActivity {
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
map = fm.getMap();
map.animateCamera(CameraUpdateFactory.zoomIn());
}
}
map_shown.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
class="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
logcat error:
08-13 01:54:05.850: E/AndroidRuntime(4183): FATAL EXCEPTION: main
08-13 01:54:05.850: E/AndroidRuntime(4183): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fambond/com.example.fambond.map}: java.lang.NullPointerException
08-13 01:54:05.850: E/AndroidRuntime(4183): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
08-13 01:54:05.850: E/AndroidRuntime(4183): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
08-13 01:54:05.850: E/AndroidRuntime(4183): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-13 01:54:05.850: E/AndroidRuntime(4183): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
08-13 01:54:05.850: E/AndroidRuntime(4183): at android.os.Handler.dispatchMessage(Handler.java:99)
08-13 01:54:05.850: E/AndroidRuntime(4183): at android.os.Looper.loop(Looper.java:130)
08-13 01:54:05.850: E/AndroidRuntime(4183): at android.app.ActivityThread.main(ActivityThread.java:3691)
08-13 01:54:05.850: E/AndroidRuntime(4183): at java.lang.reflect.Method.invokeNative(Native Method)
08-13 01:54:05.850: E/AndroidRuntime(4183): at java.lang.reflect.Method.invoke(Method.java:507)
08-13 01:54:05.850: E/AndroidRuntime(4183): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
08-13 01:54:05.850: E/AndroidRuntime(4183): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
08-13 01:54:05.850: E/AndroidRuntime(4183): at dalvik.system.NativeStart.main(Native Method)
08-13 01:54:05.850: E/AndroidRuntime(4183): Caused by: java.lang.NullPointerException
08-13 01:54:05.850: E/AndroidRuntime(4183): at com.example.fambond.map.onCreate(map.java:18)
08-13 01:54:05.850: E/AndroidRuntime(4183): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
08-13 01:54:05.850: E/AndroidRuntime(4183): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
08-13 01:54:05.850: E/AndroidRuntime(4183): ... 11 more
Probably this line
map = fm.getMap();
returns you null, and then you call something on null object -> exception